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.

As another elegant piece of insurance that my readers will be immediately drawn to what #main has to say, a drop cap will<br />

suit this page well.<br />

Here are the properties I want my drop cap to include:<br />

The body text should wrap around it.<br />

It should be about six times the size of the text.<br />

The top should be flush with the top of the first line of text.<br />

The left side should remain flush with the text’s left side, but the right and bottom sides should have a small<br />

margin to avoid butting up against the text.<br />

Pseudo-elements in an imperfect world<br />

Since I’m dealing directly with the first letter in my first paragraph (which already has a class of first), using the CSS<br />

:first-letter pseudo-element selector is a logical place to begin. Thus, rules for my drop cap will be addressed to<br />

p.first:first-line, and are easily translated line-for-line from my list of desired properties.<br />

p.first:first-letter {<br />

float: left;<br />

font-size: 6em;<br />

line-height: .75em;<br />

margin-right: .1em;<br />

margin-bottom: .1em;<br />

}<br />

In a rare twist, this code renders with reasonable consistency in all of my tested browsers, except for Firefox for Mac, which<br />

mysteriously inserts extra space at the top and bottom of my drop cap (Figure 7-14). No amount of fiddling with lineheight,<br />

padding, or margin will make it behave consistently across browsers, and if the paragraph begins with an inline<br />

element like an em or strong (or a span, which I’ll be adding later), the results are even more disparate. Sadly, I’ll have to try<br />

a different solution.<br />

Figure 7-14. The Firefox :first-letter bug<br />

chapter 7 Bridging the Type Divide: Classic Typography with CSS<br />

171

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

Saved successfully!

Ooh no, something went wrong!