Saturday 18th of November 2017 04:52:57 PM

CSS Style Guide

XHTML and CSS Validation

Before publishing any XHTML page on the library’s server, you must be certain that it contains only W3C-approved tags and properly authored Style Sheets. The process of Kosherizing your XHTML and CSS is known as validation.

Free online tools

Free online tools make validation easy. Just follow these steps:

  1. Upload your page to the library’s server but do not yet link to it externally.
  2. Visit the W3C Validator (or the HTML Help Validator maintained by the Web Design Group).
  3. <P STYLE="position: absolute; top: 0; right: 25%; left: 25%; bottom: auto;width: 50%; height: auto; background: silver;">...</P>
    Figure 9-20

    Figure 9-20. An absolutely positioned paragraph

    The paragraph is now positioned at the very beginning of thedocument, half as wide as the document's width and overwritingthe first few elements!

    In addition, if the document is scrolled, the paragraph will scrollright along with it. This is because the element's containingblock is the BODY element's content area,

  4. Type the URL of the web page you just uploaded into the forms at either of these services.
  5. Wait a few seconds while the validator examines your page.
  6. Fix any errors offline, upload the corrected page, and try again.
  7. Be sure to validate your CSS as well and correct errors (if any).
  8. When all documents validate, you may link to your page from the library’s site. (If you are unable to understand or correct your errors, see the Web Coordinator.)

Validation takes getting used to, but soon the process will become second nature. Essentially it is like receiving the consulting services of a world-class HTML and CSS expert for free.

Understanding Validator Error Messages

Note that the Validators’ error-reporting can be confusing. Sometimes an error in one part of the markup gets reported as an error further down.

For instance, if the validator is coughing on a paragraph tag, and the tag appears to be written correctly, check the markup preceding the paragraph tag. Higher up on the page, you may have forgotten to include a closing quotation mark at the end of a link, or you may have neglected to end an IMAGE tag with a a closing forward slash (/). For some reason, the Validator catches these errors, but reports them incorrectly.

One-click validation

If you tire of typing the validation service URLs, you can install free validation "bookmarklets" in your browser’s Favorites bar courtesy of David Lindquist, an independent web developer.

« XHTML Section Index | Cascading Style Sheets »


If a bullet's position is set to outside, it will appear the way list items always have on the Web, as you can see in Figure 7-85:

LI {list-style-position: outside;}
Figure 7-85

Figure 7-85. Placing the bullets outside list items

Should you desire a slightly different appearance, though, you can pull the bullet in toward the content by setting the value to be

However, all of this is true only for the top and bottom sides ofinline elements; the left and right sides are a different storyaltogether. We'll start by considering the simple case of asmall inline element within a single line, as depicted in Figure 7-22.

Figure 7-22

Figure 7-22. A single-line inline element with a left margin

Here, if we set values for the left or right margin, they will bevisible, as Figure 7-23 makes obvious:

B {margin-left: 10px; background: silver;}