How 2 Create A Website | HTML 4 Tutorials - CSS Introduction
Working with CSS Colors
If you apply colors in html 4 then it is important to have the color number in hexadecimal and a preceding "#" character e.g.
color="#FF00FF"
The six number hex value represents, red-green-blue (RGB) that form the color.
Color names are represented in either hexadecimal numbers or color names. You can specify any color by its hex value or choose from 16 color names.
16 HTML Named Colors And Hex Values
| Name | Hexadecimal Value |
Color |
| aqua | #00FFFF | |
| black | #000000 | |
| blue | #0000FF | |
| fuchsia | #FF00FF | |
| gray | #808080 | |
| green | #008000 | |
| lime | #00FF00 | |
| maroon | #800000 | |
| navy | #000080 | |
| olive | #808000 | |
| purple | #800080 | |
| red | #FF0000 | |
| silver | #C0C0C0 | |
| teal | #008080 | |
| white | #FFFFFF | |
| yellow | #FFFF00 |
An example of a styling tags in the head section.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <head><title> CSS Styling </title> <style type="text/css"> body .body </style> </head> <h1 class="body">This an example of CSS</h1> </body> </html> |
The result will be as follows:
You can also use the color name in the hexadecimal value place which will give the same result:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <head><title> CSS Styling </title> <style type="text/css"> body .body </style> </head> <h1 class="body">This an example of CSS</h1> </body> </html> |
next | working with css continued

