Web Technology Ppt1
Web Technology Ppt1
rad
What is CSS?
• CSS stands for Cascading Style Sheets and it is the
language used to style the visual presentation of web
pages.
• CSS is the language that tells web browsers how to
render the different parts of a web page.
• Every item or element on a web page is part of a
document written in a markup language. In most cases,
HTML is the markup language, but there are other
languages in use such as XML.
CSS Syntax
• CSS syntax includes selectors, properties, values,
declarations, declaration blocks, rulesets, at-rules, and
statements.
• A selector is a code snippet used to identify the web page
element or elements that are to be affected by the styles.
• A property is the aspect of the element that is to be
affected. For example, color, padding, margin, and
background are some of the most commonly used CSS
properties.
• A value is used to define a property. For example, the
property color might be given the value of red like
this: color: red;
University Institute of Engineering (UIE)
Department of Computer Science and Engineering (CSE)
• Classes and IDs are used as hooks for CSS styles. While
the way CSS renders is not affected by the use of classes
and hooks, they give developers the ability to pinpoint
HTML elements that they wish to style.
• Classes and IDs aren’t interchangeable. It’s important to
know when to use each.
Inline Styles
• Inline styles are applied to specific HTML elements. The
HTML attribute style is used to define rules that only
apply to that specific element. Here’s a look at the syntax
for writing inline styles.
• <h1 style="color:red; padding:10px; text-
decoration:underline;">Example Heading</h1>
• That code would cause just that heading to render with
red underlined text and 10 pixels of padding on all sides.
There are very few instances where inline styles should
be used.
• In nearly all cases they should be avoided and the styles
added to a stylesheet.
University Institute of Engineering (UIE)
Department of Computer Science and Engineering (CSE)
Internal Stylesheets
• The earlier examples in this tutorial make use of internal
stylesheets. An internal stylesheet is a block of CSS added
to an HTML document head element.
• The style element is used between the opening and
closing head tags, and all CSS declarations are added
between the style tags.
• We can duplicate the inline styles from the code above in
an internal stylesheet using this syntax.
• <head>
• <style> h1 { color: red; padding: 10px;
text-decoration: underline; } </style></head>
• <body> <h1>Example Heading</h1>
• </body>
External Stylesheets
• External stylesheets are documents containing nothing other
than CSS statements. The rules defined in the document are
linked to one or more HTML documents by using the link tag
within the head element of the HTML document.
• To use an external stylesheet, first create the CSS document.
• /*************************************************Save with
a name ending in .css such as
styles.css*************************************************/
h1 { color: red; padding: 10px; text-decoration:
underline;
}
SUMMARY
• Need for CSS,
• introduction to CSS,
• basic syntax and structure,
• using CSS
REFERENCES
• Web Link:
Intimidated By CSS? The Definitive Guide To Make Your F
ear Disappear » (html.com)
• Video Lecture: https://www.youtube.com/watch?
v=1Rs2ND1ryYc