XML technologies / CSS / CSS Cookbook / General topics / CSS properties

(Excerpt from “CSS Kochbuch” by Christopher Schmitt)

Problem

You want to learn more about CSS properties.

Solution

This chapter’s recipes use common properties such as color, font-family, font-size and text-decoration. Properties appear between braces. Each property name is followed by a colon and its values, as this general example shows:

Selektor {
  Eigenschaft: Wert;
}

A practical example might look like this:

li {
  list-style-type: square;
}

Whenever the element li appears in the document, its list marker is a square rather than the default circle.

Discussion

Selectors determine which document elements receive the styles. Properties and values determine which parts of an element change and how.

The property color, for example, specifies that an element’s color should change, but does not specify the color itself: that is the value’s job. The following table shows properties, values and their effects.

Table: A short list of CSS properties.

Property

Value

Result

font-weight

bold

Displays bold text.

border-color

Color name or hexadecimal HTML value
(for example, #000000 for black and #ffffff for white)

Sets a border’s color.

border-style

solid dotted dashed double

Displays the border as a solid line.
Displays the border as a dotted line.
Displays the border as a dashed line.
Displays the border as two solid lines.

text-align

left center right justify

Aligns text to the left.
Centers text.
Aligns text to the right.
Justifies text.

See also

  

 

 

 

back to top