Forum Moderators: not2easy

Message Too Old, No Replies

CSS doesn't seem to work as it should

Weird problem

         

vidya

1:55 am on Oct 30, 2003 (gmt 0)

10+ Year Member



OK. Let me start by admitting I'm completely new to CSS although I'm proficient at HTML and PHP.

I bought the SitePoint book, Designing Without Tables, and typed in their sample CSS for a 3-column layout with a header -- and it just didn't do what it said it would. Very frustrating!

Here's the CSS:

<STYLE TYPE="text/css">

#header {
background-color: #8080FF;
color: white;
height: 100px;
margin: 20px;
padding: 10px;
}

#center {
margin-left: 220px;
margin-right: 220px;
background-color: #D0D0E2;
color: black;
}

#left {
position: absolute;
left: 10px;
top: 10px;
width: 200px;
background-color: gray;
color: white;
}

#right {
position: absolute;
right: 10px;
top: 10px;
width: 200px;
background-color: gray;
color: white;
}

#footer {
clear: both;
background-color: #8080FF;
color: white;
}

</STYLE>

and here's the HTML:

<html>

<head>
<title></title>
<link rel="stylesheet" href="demo.css" type="text/css" >
</head>
<body>

<div id="header">
<p>Contents of Header</p>
</div>

<div id="left">
<p>Contents of Left</p>
</div>

<div id="center">
<p>Contents of Center</p>
</div>

<div id="right">
<p>Contents of Right</p>
</div>

</body>
</html>

What's up with this? Why doesn't it do a 3 column layout with a header like it does in the book?

Thanks

....Vidya

choster

2:07 am on Oct 30, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



What DOCTYPE are you using on the document, and what browser are you using to view the page?

vidya

3:58 am on Oct 30, 2003 (gmt 0)

10+ Year Member



No DOCTYPE and IE 5.5 on a PC

aevea

5:12 am on Oct 30, 2003 (gmt 0)

10+ Year Member



I think you left the footer out of the html. Since heights aren't declared on the 3-column divs, you might need to add some more content to make them expand downwards. Also you might want to drop the two absolutely positioned divs down another hundred px, so they aren't underneath the header.

What specifically is it doing wrong?

Adam