HTML and CSS Reference
In-Depth Information
Note Browsers also allow you to add a level of transparency to colors. This is achieved
by adding a fourth value to the color definition—the alpha channel. In the hexadecimal
format, the alpha value ranges from 0 (completely opaque) to 255 (completely transparent).
In the RGB format, the alpha value can be expressed as a decimal value (that is, 0.5) or as a
percentage (that is, 50%). If you intend to add transparency to colors, you have to use the
rgba function, as shown below:
.my-classic-button-transparent {
color: #88ff0000; /* transparency is first value, 88 in this
case */
.my-fancy-button-transparent {
color: rgba(255, 0, 0, 0.5); /* transparency is fourth value, 0.5 in this
case */
In general, you should be aware that older browsers may not support transparent colors.
However, as a reader of this topic, the presumption is that you're mostly interested in
Windows 8 programming, and in the context of Windows 8, transparent colors are fully
Changing the foreground color
The color of any piece of text around an HTML page is controlled by the color property. By setting
the color property on the BODY element, you give all the text within the page a default color of your
body {
color: black;
You are not limited to just one color per page; you also can set the foreground color of every
single element you have in the page. To select one or more elements, you use ID or class selectors.
For example, the aforementioned red-button custom class renders text in red for all elements where it
is applied.
.red-button {
color: red;
Search WWH ::

Custom Search