>> English << | Português | По-русскиZVON > Tutorials > CSS tutorial
>> Example 4 << | Prev | Next | Contents

Description

One of the most common task is specification of colors and so we will start with them. We will use them to introduce several important concepts. The color of text is specified with "color" property, the color of the background with "background-color". If a property is not defined for given element, its value is usualy inherited from elements inside which the element occurs. If even these elements does not specify any value, then browser default is used.

>> Case 1 <<
HTML SourceCSS stylesheet

<dl>
<dt>A list:</dt>
<dd>
     <ul>
          <li>item 1</li>
          <li>item 2</li>
     </ul>
</dd>
</dl>
<div> And another one:
<ol>
     <li>ordered item 1</li>
     <li>ordered item 2</li>
     <li>ordered item 3</li>
</ol>
</div>
body {background-color: white; 
      color: black}

dl    {background-color: black; 
      color: white}

li   {background-color: yellow; 
      color:red}

Browser output