copyright © CSSPG, lud October 18 2000


 for practical use of CSS

Tips

this document is located at...
<URI:http://css.nu/pointers/tip-3.html>

* Color Considerations *

Colors in HTML

Generally, it is best to let each reader choose those text and background colors that look best to his eyes on his computer screen and to his personal tastes and customs. If, however, you as the author wish to use certain colors for certain purposes, then you should consider the following practical hints:

Here is an example how you should combine the old standard tags <em> and <strong> with the new standard tags <font> and <body> and with style sheets such that you will achieve the desired effect on the highest number of browsers.

Let us assume that you want your company's name to appear in blue and boldface, strongly emphasized, and that as contrasting colors you choose white for the background, black for normal text, and dark red for hypertext links.

In your HTML file "enzian.html", you use the following combinations of tags:


      <html>
      <head>
      <title>Big Enzian</title>
      <link rev=made href="webmaster@www.enzian.com">
      <link rel=stylesheet href="enzian.css" type="text/css">
      </head>
      <body text="#000000" bgcolor="#FFFFFF"
            link="#990000" vlink="#660000" alink="#FF0000">
      <h1 class=enzian><font color="#0000FF">Big Enzian</font></h1>
      <p>
      The company
      <strong class=enzian><font color="#0000FF">Big Enzian</font></strong>
      is the best ...
      </body>
      </html>

 

The corresponding style sheet file "enzian.css" contains the following specifications:


      BODY { color: black; background: white }
      A:link    { color: #990000 }
      A:visited { color: #660000 }
      A:active  { color: #FF0000 }
      .enzian { color: #0000FF; font-weight: bold }

 

Note that it is better to use an external style sheet file, referenced in the <link> tag, rather than using <style> and </style> tags within the HTML file itself, since the embedded style specifications might erreanously be rendered on the screen by some non-standard-conforming browser versions like Netscape 1.x.

  -- 
  Hubert Partl        partl@mail.boku.ac.at
  ZID BOKU Wien       http://www.boku.ac.at/

CSS Pointers Navigation
Index · Browser Bugs · Books · Tools · DHTML · XSL & DSSSL
Main Site Navigation
Index · Articles · Examples · Experiments · FAQ · Markup · Styles · Who is?
CSSPG ~ Sue ~ Roland
Validate markup Check CSS