Web Development and Design Foundations with XHTML, 5th Edition

(Steven Felgate) #1

FAQ


85

section) and bothof the <h2>XHTML elements applied the h2style. 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:valueconfiguration.
●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
applied.
●Use a program to check your CSS code. The W3C has a free CSS code validator at
http://jigsaw.w3.org/css-validator. 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.

3.4 Configuring Color with Embedded Styles

Figure 3.7
embedded.html with
styles applied


Go to the end of the
book for a full color
version of this figure
Free download pdf