...

View Full Version : Content underneath



Decker
08-24-2010, 11:30 PM
Alright, i'm just learning CSS, and i'm making a website. So I ran into a problem. I'm trying to place my content bar to the right of the left nav bar, but it goes under it, then im gonna put a right nav bar. Here is the problem:

http://img340.imageshack.us/img340/3259/27504611.jpg

Heres the codes:

index.html

<html>
<head>
<title>Conquer Website</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>

<div id="container">

<div id="header"> </div>

<br />

<div id="leftbar"> </div>

<div id="content"> </div>

</div>

</body>
</html>

style.css

body {
background-color: #565656;
font-family: Arial;
}

#container {
width: 600px;
padding: 1px;
margin: 43px auto 0;
}

#header {
width: 600;
height: 100;
background-image:url(images/header.jpg);
}

#leftbar {
width: 150;
height: 20;
background-image:url(images/bar.jpg);
}

#content {
width: 275;
height: 20;
background-image:url(images/content.jpg);
}

skywalker2208
08-25-2010, 12:04 AM
Add float: left to #leftbar and #content.

coothead
08-25-2010, 12:22 AM
Hi there Decker,

here is your corrected code...


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="language" content="english">
<meta http-equiv="Content-Style-Type" content="text/css">

<title>corected code</title>

<style type="text/css">
body {
background-color:#565656;
font-family:arial,sans-serif;
font-size:100%;
}
#container {
width:600px;
padding:1px;
margin:43px auto 0;
}
#header {
height:100px;
margin-bottom:19px;
background-image:url(images/header.jpg);
}
#leftbar {
float:left;
width:150px;
height:20px;
background-image:url(images/bar.jpg);
}
#content {
float:left;
width:275px;
height:20px;
background-image:url(images/content.jpg);
}
#rightbar {
float:left;
width:175px;
height:20px;
background-image:url(images/bar.jpg);
}
</style>

</head>
<body>

<div id="container">

<div id="header"></div>

<div id="leftbar"></div>

<div id="content"></div>

<div id="rightbar"></div>

</div><!-- end #container -->

</body>
</html>


Notes:-

1. Always use a full DOCTYPE.

2. Always use a content-type meta tag.

3. Values in CSS must be always be specified except for zero;

coothead

abduraooft
08-25-2010, 10:03 AM
Or take a look at http://bonrouge.com/3c-hf-fixed.php



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum