Css Introduction
Css Introduction
INTRODUCTION
What is CSS?
CSS stands for “Cascading Style
sheets”.
CSS is a language that works with
HTML documents to define the
way web pages are presented.
CSS is used to control the
appearance of web pages,
including the positioning of content
and images, the different colours
used, and more.
CSS rules
CSS rules are written with five
different parts: selector,
declaration block, declaration,
property and value
The selector “selects” the
elements on an HTML page that
are affected by the rule.
In the following example, the “p”
selector will select every
paragraph (<p>) on the web page.
/* CSS rule */!
p { }!
!
!
selector
!
!
<!-- HTML markup -->!
<p>This is a paragraph of text</p>!
<p>This is another paragraph of text</p>
The declaration block is a
container that consists of anything
between (and including) the start
brace “{” and end brace “}”.
/* CSS rule */!
p { }!
!
!
declaration block
!
!
<!-- HTML markup -->!
<p>This is a paragraph of text</p>!
<p>This is another paragraph of text</p>
The declaration tells browsers
how to render any element on a
page that is selected.
White space
White space is ignored inside CSS
rules, so declarations can be
written in single or multiple lines.
/* CSS rules */!
h1!
{ !
! color: red;!
multiple lines
! margin: 0;!
}!
!
h1 { color: red; margin: 0; }! single line
CSS comments
You can insert comments in CSS.
CSS comments must begin with a
forward slash and an asterisk “/*”
and end with an asterisk and a
forward slash “*/”.
!
Site: maxdesign.com.au
Twitter: twitter.com/russmaxdesign
Slideshare: slideshare.net/maxdesign
Linkedin: linkedin.com/in/russweakley