HTML and CSS Reference
In-Depth Information
Figure 14-7. The no-hack layout from Chapter 6 is strictly valid, baby!
Disable Styles in Chunks
Once you've determined that obvious human error is not contributing to your plight (which isn't
to say mistakes aren't hiding in your style sheet—it just means you've caught the blatant ones
with the validator), the next step is to narrow your list of suspects. If your problems involve major
layout or positioning issues, the easiest way to do this is by completely removing large portions
of your style sheet and seeing if the problem still remains. Start by temporarily deleting the part of
your style sheet that logically relates to the problem you are seeing, then save and reload your
page. You can easily tell if the problem still exists, and if it doesn't, it's a fair bet that your culprit
lies elsewhere within your style sheet. Continue narrowing the field by using the same process on
each block of likely suspects until you've found the culprit. If the source of your problem is proving
difficult to track down, you can cast a wider net by deleting half of your style sheet and following
the same process to narrow the list of offending styles.
Though styles and markup can also be commented out, you might run into problems
mass-commenting blocks of your document or style sheet due to existing (X)HTML or CSS
comments you've already used. It's better (and safer) to create a backup of your files and
delete blocks of code rather than comment them out.
Disabling styles isn't a surefire way to determine every possible problem, due in large part to
the cascade (covered in Chapter 3), since rules at one end of a style sheet can affect rules at the other
end. If this method doesn't help, try creating a minimal test case, as shown later in this chapter.
Tip Delete the most likely blocks of styles first—this is where logic comes into play. For instance, if you are
having a problem with an unordered list, then delete the rule(s) that target that ul ; if your problem disappears,
slowly add the deleted styles back one by one until the problem reappears.
Search WWH ::

Custom Search