HTML and CSS Reference
In-Depth Information
Basic style commands
The CSS syntax includes several properties that you can use to define nearly every aspect of
HTML elements: font, colors, measurement, layout, position, shadowing, and more. Here's a quick
summary of the most frequently used properties. If you're seeking a full reference, have a look at .
Setting colors
Changing the colors of some text is often the first thing that developers try to do to exercise control
over a software feature. Let's see the options available to modify colors in a CSS style sheet.
Defining colors
In all the examples so far, you have seen colors referred to by names such as black, red, or white. CSS
allows you to express color in other more powerful ways. The HTML and CSS standards define 147
color names, among which you find black, blue, fuchsia, gray, green, purple, red, silver, white, and
yellow. The full list of predefined colors can be found at .
In general, colors are expressed as a triple of integer values (between 0 and 255) for their Red,
Green and Blue component. You can use any of the following syntaxes to indicate a custom color:
.my-classic-button {
color: #ff0000;
.my-fancy-button {
color: rgb(255, 0, 0);
In the former example, you use a hexadecimal expression for the RGB values. Hexadecimal values
must be prefixed by # . The first two characters refer to the Red, the second two refer to the Green,
and the last two refer to the Blue.
In the latter example, you use the rgb function instead, which accepts decimal values. Also in this
case, the order of color components is Red, Green, Blue.
Search WWH ::

Custom Search