Jump to content

Div layout problem - Example shown


Solarpitch

Recommended Posts

Hey,

 

I am just having a problem trying to get the "content" and "right content" in the below example to sit tidy to the top just like the "left content". I'm not sure what the problem is... CSS is below

 

 

layout806.gif.xs.jpg

 


CSS



html, body {

margin: 			0;
padding: 			0;
}

body {

font-family: 		Arial, Helvetica, Verdana, Sans-serif;
font-size: 			12px;
color: 				#000000;
background: 		#ffffff;
}

#container {

background:			red;
width:				966px;
margin:				auto;
}

#top_nav {

background:			green;
height:				100px;

}

#header {

background:			darkgreen;
height:				50px;
margin: 			0;
padding: 			0;
}

#left_nav {


float:				left;
background:			pink;
width:				270px;
margin: 			0;
padding: 			0;
}

#content{

margin-left: 		270px;
background:			lightblue;
margin-right: 		280px;
margin: 			0;
padding: 			0;
}

#right_content {

float:				right;
background:			orange;
width:				280px;
margin: 			0;
padding: 			0;
}

#bottom_content {

clear:				both;
background:			pink;
height:				200px;
margin: 			0;
padding: 			0;
}

#footer {

clear:				both;
background:			green;
height:				30px;
margin: 			0;
padding: 			0;
}


Link to comment
Share on other sites

Hi,

 

sorry but the page is not live at the min, thats why I had to show the example. Here's the HTML code...

 


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html>
<head>

<meta http-equiv="Content-type" content="text/html; charset=UTF-8" />
<meta http-equiv="Content-Language" content="en-us" />

<meta http-equiv="imagetoolbar" content="no" />
<meta name="MSSmartTagsPreventParsing" content="true" />

<meta name="description" content="Description" />
<meta name="keywords" content="Keywords" />


<style type="text/css" media="all">@import "css/styles.css";</style>

</head>

<body>

<div id="container">
<div id="top_nav">top nav</div>
<div id="header">header</div>
<div id="left_nav">left content </div>
<div id="content"><p>content</div>
<div id="right_content">right content </div>
<div id="bottom_content">bottom content</div>
<div id="header">footer</div>
</div>

</body>
</html>

Link to comment
Share on other sites

Did you float it left? Is it underneath the right div then? If so, the combined widths (plus margins plus borders) of the three content divs is wider than the container div. You need to make these divs a little narrower.

 

If that doesnt work, find some free hosting and put it up there then post a link. Its a lot easier to help when I can see something live.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.