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.

First, start by styling the short paragraph of text inside the footer. Transform its content into uppercase letters, and reduce<br />

its type size and contrast to de-emphasize it.<br />

div[id="siteinfo"] p {<br />

padding-top : 40px;<br />

font-size : 82%;<br />

text-transform : uppercase;<br />

color : #999; }<br />

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

display : block; }<br />

Wouldn’t it be fantastic if you could be more specific about the anchors that you target, perhaps by styling<br />

external links differently from those links to other pages on your site? Now, in many circumstances you can.<br />

With the exception of Internet Explorer 7, all the major standards-aware browsers support selectors such<br />

as this:<br />

div[id="siteinfo"] a[href^="http"] {<br />

display : block; }<br />

The selector with the ^ is a type of substring matching attribute selector, a mouthful to say, but one of the<br />

most interesting selector types in CSS. From now on, I’ll refer to it as a substring selector, to save ink and trees.<br />

There are different varieties of this type of selector, many of which could make accomplishing this design<br />

much easier. The example here targets all links contained within the siteinfo division, where the href<br />

begins with http. You will see more substring selectors as you progress through this chapter.<br />

Now it is time to turn your attention to adding the small WorrySome.net logo. A peek into the markup for this page reveals<br />

that there is no in-line logo image present. There is just the link to the top of the page, inside an unordered list. Start by<br />

removing any margins from this list.<br />

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

margin : 0; }<br />

Now you can use a combination of positioning and image replacement to transform this humble link into a shiny logo. First,<br />

set its proportions and position it absolutely: 240px from the left and 50px above its positioned ancestor.<br />

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

position : absolute;<br />

display : block;<br />

top : -50px;<br />

left: 240px;<br />

height : 120px;<br />

width : 230px; }<br />

Apply a background image and slide its text off screen, and you are good to go.<br />

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

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

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

chapter 4 Designing for Outside the Box<br />

99

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

Saved successfully!

Ooh no, something went wrong!