Reputation: 3172
To make a long story short, the header class should be a black line across the entire screen. In HTML it will be a list. The list's children will be styled as buttons and should begin after the first 20% of the page. Somewhere along the line this is going terribly wrong, because:
The list children aren't styled at all (the margin)
The page stretches itself a lot.
Here is the entire source code:
<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title></title>
<style>
html, body {
padding: 0;
background-color:#FFFCF2;
margin: 0 auto;
}
.header {
list-style:none;
width:100%;
height:65px;
font-size:3%;
background: black;
}
.header:first-child {
margin-left:20%;
}
.headerChild {
margin-left:0;
float:left;
height:65px;
width:10%;
background: white;
}
</style>
</head>
<body>
<ul class="header">
<li class="headerChild"></li>
<li class="headerChild"></li>
<li class="headerChild"></li>
</ul>
</body>
</html>
Upvotes: 0
Views: 52
Reputation: 520
A few issues that I see:
.header:first-child
is applied to the <ul>
, so change it to .header>li:first-child
and that will target the first <li>
and set its left margin.header
and the <li>
inherit that, make sure that is what you wantpadding:0
on .header
as well to prevent the horizontal scrollbars.Here's a Fiddle for you to look at. I've put red borders around the <li>
and text so you can see them.
Upvotes: 0
Reputation: 1122
Replace your CSS with the following:
html, body {
padding: 0;
background-color:#FFFCF2;
margin: 0 auto;
}
.header {
list-style:none;
width:100%;
height:65px;
font-size:3%;
background: black;
padding-left: 20%;
}
.header:first-child {
}
.headerChild {
margin-left:0;
float:left;
height:65px;
width:10%;
background: white;
}
Upvotes: 1