Tuesday, 12 August 2014

More about CSS

Selectors, Properties, and Values

Whereas HTML has tags, CSS has selectors. Selectors are the names given to styles in internal and external style sheets. In this CSS Beginner Tutorial we will be concentrating onHTML selectors, which are simply the names of HTML tags and are used to change the style of a specific type of element.
For each selector there are “properties” inside curly brackets, which simply take the form of words such as colorfont-weight or background-color.
value is given to the property following a colon (NOT an “equals” sign) and semi-colonsseparate the properties.

Lengths and Percentages

There are many property-specific units for values used in CSS, but there are some general units that are used by a number of properties and it is worth familiarizing yourself with these before continuing.
  • px (such as font-size: 12px) is the unit for pixels.
  • 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.
  • pt (such as font-size: 12pt) is the unit for points, for measurements typically in printed media.
  • % (such as width: 80%) is the unit for… wait for it… percentages

No comments:

Post a Comment