CSS Rules

Premium Content - Free Preview

You've seen the following CSS rule:

p {color: red;}

This CSS rule sets every p (paragraph) element to a red color. Every CSS rule must have at least 3 parts:

selector {property: value;}

The selector is the type of items being selected. In this case it's all p items, and it could also be other HTML elements, such as <body> or <b>. On the next page we'll see other kinds of CSS selectors.

Next comes the property to set, such as color, size or font. See the CSS reference for a list of different CSS properties.

End of Free Content Preview. Please Sign in or Sign up to buy premium content.

Contact Us
Sign in or email us at [email protected]