13.02.2013 Views

WEB STANDARDS CREATIVITY

WEB STANDARDS CREATIVITY

WEB STANDARDS CREATIVITY

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

18<br />

Content highlights<br />

With the backgrounds, masthead, and main navigation sorted out, we can look a little closer at a few interesting happenings<br />

within the main content area. We’ll explore the headings, tables, and definition lists.<br />

Headings<br />

The Dirty Pretty Things website makes great use of level 2 () and 3 () headings. Most notably, level 2 headings are<br />

used at the top of both the main content area and the sidebar on all pages, yet have different appearances. This is achieved<br />

using descendant selectors in the style sheet.<br />

The following markup reflects a simplified sidebar. Note that the element in the main content does not have a unique<br />

ID or class either.<br />

<br />

The Band<br />

Dirty Pretty Things are Carl Barat, Anthony Rossomando, Didz Hammond and Gary Powell.<br />

<br />

Figure 1-9 shows the two background images used for the two elements.<br />

Figure 1-9. Two jagged background images are used for the two differently sized level 2 headings.<br />

The CSS rules for , as used in the main content area, are relatively straightforward. Note that blackhead.gif is specified<br />

as a nonrepeating background image, and that enough padding is used to ensure the whole background is in view.<br />

h2 {<br />

margin:0 0 2px –10px;<br />

padding: 6px 0 5px 13px;<br />

font:14px/165% italic Georgia,Arial,Helvetica,sans-serif;<br />

letter-spacing:0.2em;<br />

color:#FFF;<br />

background: #EAE5D8 url(images/blackhead.gif) left bottom no-repeat<br />

}<br />

Now, we move on to the for the sidebar. The clever part is done with a descendant selector. The selector #sidebar h2<br />

tells the browser to apply these rules instead when the element is inside the sidebar. If a match is found, a different<br />

background image, blackheadside.gif, is used, and the margins and font-size are scaled down.<br />

#sidebar h2 {<br />

margin-top:3px;<br />

font-size:12px;<br />

background: #EAE5D8 url(images/blackheadside.gif) left bottom no-repeat;<br />

}

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!