Tuesday, September 13, 2011

04 - CSS Selectors, Properties and Values

   CSS Selectors

  • As we known HTML use pre-define Tags tags to build a Web page.  To style pages CSS use selectors which can  name similar to HTML tags like, h1, p etc. 
  • We can define our selectors  in many different ways through Class or ID.We learn about Classes and ID in next later.
  • Selectors can use in Internal or External style sheet.

   Properties and values:

Properties and values are used with selectors in open and curly braces: Ex. 
  font-size: 12px; color: blue;  
Here "body" is selectors, "font-size" and "color" are property and "12px" and "blue" are values respectively.

   CSS  Units:

em (such as font-size: 2em) is the unit for the calculated 
size of a font. So "2em", for example, is two times the current 
font size.
px (such as font-size: 12px) is the unit for pixels.

pt (such as font-size: 12pt) is the unit for points.

% (such as font-size: 80%) is the unit for... wait for it... percentages.

Other units include pc (picas), cm (centimetres), mm (millimetres) and in (inches).

When a value is zero, you do not need to state a unit. For example, if you wanted to specify no border, it would be border: 0.

Note: Most of the time em and  %  units are safe to use because they are re-sizable units and adjust on page re-sizerather than 'px', which leads to non-resizable text in most browsers.

powered by multimediagyan ©

No comments:

Post a Comment