CSS: Cascading style sheet
CSS is used to define styles for your web pages, in ing the design, layout and variations in
les fi a
y ges, including t ign, lay 7
; and color attributes we ification, i
Started a nightmare for web developers. Development of large we ate ae att
color information were ad 4
vee 3 nt of large websites, where fonts and
led to every single page, became a long and expensive process.
SS Syntax
Selector ; Declaration Declaration
@® vcolor:blue; font-size: 12px;}
aac waa Saar Value
The selector points to the HTML element to style. The declaration block
contains one or more declarations separate h declaration
includes a 2S popety nae ad valu, Sepratea bys ean Sl
CSS declarations are separated with semicolons, and declaration blocks are
surrounded by curly braces.
Types of Style sheets:
Used to style a single HTML element by connecting a CSS property to a component in the
body section. The style is defined within an HTML tag using the style attribute.
e.g
A Blue Heading
A red paragraph.
Used to j . The style
rules are saved ina t with the extensi SAPPY THE to multiple
pages, an extemal style sheet can be accessed by ereating a link within the head section of
ultiple webpages can use the same link to access the style sheet.
© scanned with OKEN ScannerAvead> body <
J
bachptound Colona; fournblus;
jf Ai
chl>This is a heading As
This is a paragraph.
obi! Bue:
,
+ Internal CSS PL ecnons Med} 3
Used to change, style, and The CSS rules are
contained direetly within'a document, using the tag, and the entre style sheet is contained
within the opening and closing tags. An internal CSS is defines
HTML page, within a
This heading will not be affected
This paragraph will be red and center-aligned.
the universal selector (+) selects all HTML elements on the page
a”
text-align: center;
color: blue;
}
Hello world!
Every element on the page will be affected by the style.
Me too!
And me!
© scanned with OKEN Scanner1! The CSS Grouping Selector
‘The grouping selector sclects all the HTML elements with the same style definitions,
f i Look at the following CSS code (the h1, h2, and p clements have the same style definitions);
Hello World!
Smaller heading!
This is a paragraph.
nts
“HICSS Commer
ACSS comment is placed inside the
+ background-color
+ background-image
eigen
+ background-attachment
+ background-position
+ background (Shorthand property)
© scanned with OKEN Scanner