I'm just getting started with HTML / CSS and I'm trying to write an own website. However, I want to have a header, a main content div, and a footer. Inside the main content div, I want to place a left bar and a right bar, but unfortunately, the left bar ALWAYS is out of the div...what am I doing wrong?
Here is my CSS:
body {
background-color: black;
}
p {
color: white;
}
#header {
background-color: grey;
margin-left: 100px;
margin-right: 100px;
border-radius: 5px;
text-align: centaer;
/*change later*/
}
#content {
background-color: green;
margin-top: 20px;
margin-bottom: 20px;
margin-left: 100px;
margin-right: 100px;
border-radius: 5px;
padding: 50px;
}
#leftBar {
background-color: orange;
left: 20px;
right: 20px;
top: 20px;
float: left;
color: white;
width: 20%;
height: 60%;
display: block;
}
#footer {
background-color: gray;
margin-bottom: 20px;
margin-top: 20px;
margin-right: 100px;
margin-left: 100px;
border-radius: 5px;
text-align: center;
/*change later*/
}
Here is my HTML
<html>
<head>
<title>Titel</title>
<link rel="stylesheet" type="text/css" href="FirstpageCSS/mainstyle.css" />
</head>
<body>
<p>Formatierter Inhalt</p>
<div id="header">HEADER</div>
<div id="content">this is going to be the content
<p>lol</p>
</div>
<div id="leftBar">contentntntntntnntnt</div>
<div id="footer">FOOTER</div </body>
</html>
What am I doing wrong? I know its something about positioning but I always get confused with it...
Appreciating any help as a newbie.