Unit1 2
Unit1 2
(CSS)
What is CSS?
•CSS2 (Cascading Style Sheets Level2) - Released in May 1998, CSS2 introduced new
features such as positioning, z-index, media types, and more advanced selectors
like attribute selectors and child selectors.
•CSS3 (Cascading Style Sheets Level 3) - CSS3 is a collection of modules that extend the
capabilities of CSS. It introduces numerous new features and enhancements,
including advanced selectors, multiple column layouts, animations,
transformations, gradients, shadows, and more.
•CSS4 (Cascading Style Sheets Level 4) - CSS4 is an ongoing effort to extend CSS3 with
new features and enhancements.
Benefits of CSS: (Why Use CSS?)
CSS Saves Time: You can write CSS once and then reuse same sheet in multiple HTML pages.
Pages Load Faster: If you are using CSS, you do not need to write HTML tag or attributes
every time. Just write one CSS rule of a tag and apply it to all the occurrences of that tag.
Easy Maintenance: To make a global change, simply change the style, and all elements in all
the web pages will be updated automatically.
Superior Styles to HTML: CSS has a much wider array of attributes than HTML, so you can
get a far better look to your HTML page.
Multiple Device Compatibility: For the same HTML document, different versions of a
website can be presented for different screen widths.
Global Web Standards: Now most of the HTML attributes are being deprecated and it is
being recommended to use CSS.
Continue…
CSS OUTLINE PROPERTIES
CSS - Links
You can set following properties of a hyper link:
• The :link Signifies unvisited hyperlinks.
• The :visited Signifies visited hyperlinks.
• The :hover Signifies an element that currently has the
user's mouse pointer hovering over it.
• The :active Signifies an element on which the user is
currently clicking.
CSS LIST PROPERTY
Background Properties This exceptionally helpful property permits
you to consolidate a few qualities into one: the background
property. It is similar to textual style, utilizes the default values
when they are not available in the announcement. CSS LONGHAND
background-color: #456;
background-image:url("backdrop.gif");
background-repeat: repeat-y;
background-attachment: fixed;
background-position: 50% 50%;
CSS SHORTHAND
<p id="p1">Green</p>
<p id="p2">Light green</p>
<p id="p3">Dark green</p>
<p id="p4">Pastel green</p>
<p id="p5">Violet</p>
<p id="p6">Pastel violet</p>
</body>
<!DOCTYPE html>
<html>
<body>
<p>In addition to the predefined color names, colors can be specified using RGB, HEX, HSL, or even
transparent colors using RGBA or HSLA color values.</p>
</body>
</html>
CSS Box Model
CSS Borders