13.02.2013 Views

WEB STANDARDS CREATIVITY

WEB STANDARDS CREATIVITY

WEB STANDARDS CREATIVITY

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Styling the main navigation<br />

Understanding the power and flexibility of substring selectors is important, as you are about to put them to even greater use<br />

in styling the main navigation for this page. Once again, you will use a range of different techniques, including positioning<br />

and image replacement. The main navigation will look as shown in Figure 4-10.<br />

Figure 4-10. The finished look of the main navigation<br />

But how do you achieve this? Your first, simple task is to remove the heading from view, this time by positioning it off the<br />

top edge of the browser window.<br />

div[id="nav_main"] h4 {<br />

position : absolute; top : -9999px; }<br />

With the heading now banished, except for people browsing the page without styles, you can set the proportions of the<br />

unordered navigation list and add a background image that contains all three of the button graphics.<br />

div[id="nav_main"] ul {<br />

width : 310px;<br />

height : 38px;<br />

margin-left : 200px;<br />

padding : 0;<br />

background : url(../images/li_nav_main.png) no-repeat; }<br />

The navigation links in this list will be accomplished by positioning the three anchors. Next, establish this unordered list as a<br />

positioning context and set all list items to display as inline, rather than block-level elements.<br />

div[id="nav_main"] ul {<br />

position : relative; }<br />

div[id="nav_main"] li {<br />

display : inline; }<br />

With position : relative; applied to the list to establish a positioning context, now set a general rule for all three<br />

anchors.<br />

div[id="nav_main"] a {<br />

position : absolute;<br />

top : 0;<br />

display : block;<br />

height : 38px;<br />

width : 104px;<br />

text-indent : -9999px; }<br />

chapter 4 Designing for Outside the Box<br />

101

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

Saved successfully!

Ooh no, something went wrong!