I know this issue has been answered over and over again, but I can’t find something that works for me. I think it has something to do with a lack of display: attribute in content or sidebar but I’m not sure what. Please take a look at my code and see if you can spot my error.
I apologize for asking this question, that I’m sure has some obvious answer but I havent been able to spot it.
Thanks in advance
Andy
<html>
<head>
<title>Andy's test website</title>
<style type="text/css">
html, body
{
margin:0px;
padding:0px;
}
p
{
margin:0px;
padding:0px;
}
#container
{
margin:0 auto;
background-color:white;
width:760px;
border:1px solid gray;
}
#header
{
line-height:130%;
border-bottom:1px solid gray;
width:760px;
}
#content
{
float: left;
width:500px;
margin-right:260px;
}
#sidebar
{
float: right;
width:260px;
}
#footer
{
clear:both;
width:760px;
}
</style>
</head>
<body>
<div id="container">
<div id="header">
<h1>Hello World</h1>
</div>
<div id="content">
<p>
"Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
</p>
</div>
<div id='sidebar'>
<p>
"Lorem ipsum dolor sit amet, consectetur adipisicing elit,
sed do eiusmod tempor incididunt ut labore et dolore
magna aliqua. Ut enim ad minim veniam,"
</p>
</div>
<div id="footer">
footer
</div>
</div>
</body>
</html>
Use this CSS
Both elements should float left and the first one will have a margin right.