CSS
CSS
CSS
Motivation
HTML markup can be used to represent
CSS Introduction
A styled HTML document
CSS Introduction
CSS Introduction
CSS Introduction
CSS Introduction
CSS Introduction
CSS Introduction
CSS Introduction
A styled HTML document
CSS Introduction
Note that alternate, user selectable style is
not widely supported: firefox 3 and IE 8 do,
but IE 6, IE 7 and Chrome dont.
CSS Introduction
Single document can be displayed on multiple
media platforms by tailoring style sheets:
CSS Syntax
Parts of a style rule (or statement)
CSS Syntax:
Selector Strings
Single element type:
Multiple element types:
All element types:
Specific elements by id:
Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey
CSS Syntax:
Selector Strings
CSS Syntax:
Selector Strings
Elements belonging to a style class:
class selector: begins with a period .
CSS Syntax:
Selector Strings
Elements belonging to a style class:
CSS Syntax:
Selector Strings
Elements belonging to a style class:
CSS Syntax:
Selector Strings
Source anchor elements:
pseudo-classes
CSS Syntax:
Selector Strings
Source anchor elements:
CSS Syntax:
Selector Strings
Source anchor elements:
CSS Syntax:
Selector Strings
Source anchor elements:
CSS Syntax
Style rules covered thus far follow ruleset
syntax
At-rule is a second type of rule
CSS Inheritance
What if no style declaration applies to a
property of an element?
Generally, the property value is inherited from
the nearest ancestor element that has a value for the
property
If no ancestor has a value (or the property does
not inherit) then CSS defines an initial value that is
used
Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey
CSS Inheritance
CSS Inheritance
Property values:
CSS Inheritance
Most properties inherit computed value
character cell
(content area)
Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey
generic
fonts are
systemspecific
Inheritance of line-height:
Backgrounds
background-color
background-image
Backgrounds
<body style="background-image:url('CucumberFlowerPot.png')">
Block
elements
only
Heights
based on
content
Character cells aligned by baseline
Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey
initial
value of
verticalalign
Relative positioning
Float positioning
Absolute positioning
only
Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey
<span style="background-color:red">
</span><span class="right">Red</span>
span
containing
text moves
left
Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey
<span style="background-color:red">
</span><span class="right">Red</span>
same
effect as
before
Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey
margin area
padding area
containing
block
padding top
edge
padding left
edge
8em
Second absolutely
positioned box
obscures first