O'reilly - Head First - Html With Css And Xhtml.pdf

(3342 KB) Pobierz
ch08.pdf
"#SBJO'SJFOEMZ(VJEFUP)5.-$44
)5.- XJUI$44
&MJTBCFUI'SFFNBO&SJD'SFFNBO
9)5.-
8 getting started with CSS
Adding a Little Style
Don’t get me wrong, the
hair, the hat, it all looks great.
But don’t you think he’d like it
if you spent a little more time
adding some style to your
XHTML?
I was told there’d be CSS in this book. So far you’ve been
concentrating on learning XHTML to create the structure of your Web pages. But as
you can see, the browser’s idea of style leaves a lot to be desired. Sure, we could
call the fashion police, but we don’t need to. With CSS, you’re going to completely
control the presentation of your pages, often without even changing your XHTML.
Could it really be so easy? Well, you are going to have to learn a new language; after
all, Webville is a bilingual town. After reading this chapter’s guide to learning the
language of CSS, you’re going to be able to stand on either side of Main Street and
hold a conversation.
this is a new chapter
285
Excerpted from the book, "Head First HTML with CSS & XHTML", by Elisabeth and Eric Freeman,
published by O'Reilly Media Inc. ISBN 0-596-10197-X. Copyright 2005. Used by permission.
Rememb er the Wi zard of O z? Well, t his
is the p art of th e book wh ere things go
from bl ack & whit e to color .
AW]¼ZMVW\QV3IV[I[IVaUWZM
You’ve been a good sport learning about markup
and structure and validation and proper syntax and
nesting and compliance, but now you get to really
start having some fun by styling your pages. But no
worries, all those XHTML pushups you’ve been
doing aren’t going to waste. In fact, you’re going to
see that a solid understanding of XHTML is crucial
to learning (and using) CSS. And, learning CSS is
just what we’re going to do over the next several
chapters.
Just to tease you a bit, on these two pages we’ve
sprinkled a few of the designs you’re going to work
with in the rest of the book. Quite a difference from
the pages you’ve been creating so far, isn’t it? So,
what do you need to do to create them? Learn the
language of CSS of course.
Let’s get started...
286
Chapter 8
Excerpted from the book, "Head First HTML with CSS & XHTML", by Elisabeth and Eric Freeman,
published by O'Reilly Media Inc. ISBN 0-596-10197-X. Copyright 2005. Used by permission.
getting started with css
you are here 287
Excerpted from the book, "Head First HTML with CSS & XHTML", by Elisabeth and Eric Freeman,
published by O'Reilly Media Inc. ISBN 0-596-10197-X. Copyright 2005. Used by permission.
the css language
7^MZPMIZLWV?MJ^QTTM¼[¹<ZILQVO;XIKM[º
Not up on the latest reality TV? No problem, here’s a recap: take two
neighbors, two homes, and $1,000. The two neighbors switch homes, and
using the $1,000, totally redesign a room or two in 48 hours. Let’s listen in...
...and this bathroom needs
some serious help!
Okay, let’s get some design in this place...
bedroom {
drapes: blue;
carpet: wool shag;
}
bathroom {
tile: 1in white;
drapes: pink;
}
Of course, in the Webville edition of the show, everyone talks about
design in CSS. If you’re having trouble understanding them, here’s a little
translation tip: each statement in CSS consists of a location (like bedroom),
a property in that location (like drapes, or carpet), and a style to apply to
that property (like the color blue, or 1 inch tiles).
288
Chapter 8
Excerpted from the book, "Head First HTML with CSS & XHTML", by Elisabeth and Eric Freeman,
published by O'Reilly Media Inc. ISBN 0-596-10197-X. Copyright 2005. Used by permission.
Zgłoś jeśli naruszono regulamin