getting started with css
you are here
Getting CSS into your XHTML
Okay, you know a little about CSS syntax now. You know how to select an
element and then write a rule with properties and values inside it. But you still
need to get this CSS into some XHTML. First, we need some XHTML to put
it in. In the next few chapters, we’re going to revisit our old friends – Starbuzz,
and Tony and his Segway journal – and make things a little more stylish. But,
who do you think is dying to have their site styled ﬁrst? Of course, the Head
First Lounge guys. So, here’s the XHTML for the Head First Lounge main
page. Remember, in the last chapter we ﬁxed things up a little and made it
strict XHTML (would you have expected any less of us?). Now, we’re adding
some style tags, the easiest way to get style into your pages.
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN”
<html xmlns=”http://www.w3.org/1999/xhtml” lang=”en” xml:lang=”en” >
<meta http-equiv=“Content-Type” content=”text/html; charset=ISO-8859-1” />
<title>Head First Lounge</title>
<h1>Welcome to the Head First Lounge</h1>
<img src=“images/drinks.gif” alt=“Drinks” />
Join us any evening for refreshing
conversation and maybe a game or two
of <em>Dance Dance Revolution</em>.
Wireless access is always provided;
BYOWS (Bring your own web server).
You’ll ﬁnd us right in the center of downtown
Webville. If you need help ﬁnding us, check out our
Come join us!
But not necessarily the best
way. We’ll come back to this
later in the chapter and see
Here’s what we’re interested in: the <style> element.
To add CSS style directly to your XHTML, add
opening and closing style tags in the <head> element.
And a style type of “text/css”.
And your CSS rules are
going to go right in here.