HTML and CSS Reference
In-Depth Information
Another is Adobe Kuler at http://kuler.adobe.com/. It makes it easy to create your own
color schemes and to browse and rate color schemes created by others. It's a great place
to find inspiration if you're thinking about adding color to a site.
Changing Colors Using CSS
There are two key properties when it comes to assigning colors to elements using CSS—
color and background-color . For elements with borders, you can also set the border
color using the border-color property.
To indicate that a paragraph should have white text on a black background, you could
use the following code:
< p style = “color: #fff, background-color: #000” >This paragraph has
white text on a black background.< /p >
You can also use these properties to adjust the colors on the whole page by applying
them to the body tag. Here's an example:
< body style = “color: #fff; background-color: #00f” >
This page will have white text on a blue background. You can also specify colors as part
of the background and border properties, which allow you to set the values for a whole
family of properties at once. The background property will be discussed later in this lesson.
Changing Page Colors in HTML
Before CSS was introduced, page colors were changed using attributes for the <body>
tag. Many web developers still use these attributes, but they have been deprecated since
HTML 4 and were left out of HTML5 entirely. The values of all the color-related HTML
attributes can be specified using hexadecimal notation or with color names.
To set the background color for a page, use the bgcolor attribute. Here's how it is used
with hexadecimal color specifications:
< body bgcolor = “#ffffff”>
< body bgcolor = “#934ce8” >
To use color names, just use the name of the color as the value to bgcolor :
< body bgcolor = “white”>
< body bgcolor = “green” >
There are also attributes of the <body> tag that can be used to set the text colors for the
page. The attributes and their use are as follows:
Controls the color of all the page's body text except for link text,
including headings, body text, text inside tables, and so on.
text
 
Search WWH ::




Custom Search