Monday, April 9, 2007

Elements of CSS

A CSS declarative statement looks as :

h1{font-size:24px;}

where:

  • h1: selector
  • font-size: property
  • 24px: value

Types of selectors:

  • Tag
    It is used to redefine a html tag
    p{font-family: Times, serif;}
  • ID
    It is used to name a unique element
    #nav {colour: red;}
  • Class
    Used to address a set of elements
    .post {padding: 10px;}
  • pseudo selectors (classes, elements)

Combining selectors:

  • Contextual
  • Grouping

No comments: