HTML and CSS Reference
In-Depth Information
Figure 3.7
embedded.html with
styles applied
Go to the end of the
book for a full color
version of this figure
section) and both of the <h2> XHTML elements applied the h2 style. This is more effi-
cient than coding the same inline style on each <h2> element.
My CSS doesn't work, what can I do?
Coding CSS is a detail-oriented process. There are several common errors that can cause the
browser not to apply CSS correctly to a Web page. With a careful review of your code and the
following tips, you should get your CSS working:
Verify that you are using the : and ; symbols in the right spots—they are easy to confuse.
The : should separate the properties from their values, the ; should be placed between
each property : value configuration.
Check that you are not using = signs instead of : between each property and its value.
Verify that the { and } symbols are properly placed around the style rules for each selector.
Check the syntax of your selectors, their properties, and property values for correct usage.
If part of your CSS works, and part doesn't—read through the CSS and check to deter-
mine the first rule that is not applied. Often the error is in the rule above the rule that is not
Use a program to check your CSS code. The W3C has a free CSS code validator at The W3C's CSS validator can help you find syntax
errors. See Section 3.9 for an overview of how to use this tool to validate your CSS.
Search WWH ::

Custom Search