Why does this absolute ul move out of its parent? - html

Why does the ul element get the full width of the wrapper element when the container div is its parent? And how can I change this?
Structure of the HTML:
Wrapper
| container
| label
| input
| ul
| botton
HTML & CSS:
.wrapper{
margin: 20px auto;
}
.container {
position: relative;
display: flex;
flex-direction: column;
height: 200px;
width: 80%;
margin: auto;
}
.country-input {
height: 30px;
margin-bottom: 50px;
}
ul {
height: 200px;
width: 100%;
overflow: hidden;
overflow-y: scroll;
position: absolute;
background-color: #F2F2F2;
top: 20px;
left: 0px;
}
<div class="wrapper">
<div class="container">
<label for="country">State</label>
<input class="input country-input" id="country" type="text" />
<ul id='country-list'>
<li id="US">United States</li>
<li id="AF">Afghanistan</li>
<li id="AX">Åland Islands</li>
<li id="AL">Albania</li>
</ul>
<button>explore</button>
</div>
</div>
Here is a link to the full code
This is how it looks:
here
On the left you can see the negative position the element gets:
here

Its just because your <ul> tag is using padding. Look at snippet and tell me is that what you're looking for?
.wrapper{
margin: 20px auto;
}
.container {
position: relative;
display: flex;
flex-direction: column;
height: 200px;
width: 80%;
margin: auto
}
.country-input {
height: 30px;
margin-bottom: 50px;
}
ul {
height: 200px;
width: 100%;
overflow: hidden;
overflow-y: scroll;
position: absolute;
background-color: #F2F2F2;
top: 20px;
padding: 0;
}
li {
padding-left: 40px;
}
<div class="wrapper">
<div class="container">
<label for="country">State</label>
<input class="input country-input" id="country" type="text" />
<ul id='country-list'>
<li id="US">United States</li>
<li id="AF">Afghanistan</li>
<li id="AX">Åland Islands</li>
<li id="AL">Albania</li>
</ul>
<button>explore</button>
</div>
</div>

You may also consider using select + option tags instead of unordered list.
Example:
<select id='country-list'>
<option id="US">United States</li>
<option id="AF">Afghanistan</li>
<option id="AX">Åland Islands</li>
<option id="AL">Albania</li>
</select>

set in the ul tag - width: unset, left: 0 and right: 0
.wrapper{
margin: 20px auto;
}
.container {
position: relative;
display: flex;
flex-direction: column;
height: 200px;
width: 80%;
margin: auto
}
.country-input {
height: 30px;
margin-bottom: 50px;
}
ul {
height: 200px;
width: unset;
overflow: hidden;
overflow-y: scroll;
position: absolute;
background-color: #F2F2F2;
top: 20px;
left: 0;
right: 0;
}
<div class="wrapper">
<div class="container">
<label for="country">State</label>
<input class="input country-input" id="country" type="text" />
<ul id='country-list'>
<li id="US">United States</li>
<li id="AF">Afghanistan</li>
<li id="AX">Åland Islands</li>
<li id="AL">Albania</li>
</ul>
<button>explore</button>
</div>
</div>

please set the style of ul, padding:0px;

Related

Unable to position the UL with the input

I want to position the list under the input, what is wrong by my css?
See Example
In this example the nested menu is positioned too far to the left and a little too high (it should start vertically where the containing menu ends).
.combobox-wrapper {
position: relative;
width: 20em;
min-height: 1.5em;
display: flex;
align-items: center;
width: 100%;
display: flex;
flex-direction: row;
}
.combobox-label {
width: 50%;
padding-top: 0.5em;
}
.combobox-input {
font-size: 16px;
font-weight: normal;
height: 30px;
padding: 4px 10px;
width: 50%;
}
.combobox-options {
position: absolute;
margin: 0;
padding: 0;
list-style: none;
max-height: 15em;
overflow-y: auto;
left: 0;
top: calc(100% + 0.25em);
z-index: 100;
display: block;
}
.combobox-option {
padding: 0.25em 0.5em;
cursor: pointer;
position: relative;
}
<div class="combobox-wrapper">
<label for="combobox-input" class="combobox-label">
Countries
</label>
<input id="combobox-input" />
<ul id="combobox-listbox" role="listbox" class="combobox-options">
<li tabindex="0" id=":rl:-BZ" role="option" value="BZ" class="combobox-option highlighted"><span>Belize</span></li>
<li tabindex="0" id=":rl:-BJ" role="option" value="BJ" class="combobox-option"><span>Benin</span></li>
</ul>
</div>
```
I don't know if you mean this or not but you can try this:
index.html
<div class="combobox-wrapper">
<div>
<label for="combobox-input" class="combobox-label">
Countries
</label>
<input id="combobox-input" />
</div>
<div>
<ul id="combobox-listbox" role="listbox" class="combobox-options">
<li tabindex="0" id=":rl:-BZ" role="option" value="BZ"
class="combobox-option highlighted"><span>Belize</span></li>
<li tabindex="0" id=":rl:-BJ" role="option" value="BJ"
class="combobox-option"><span>Benin</span></li>
<li tabindex="0" id=":rl:-BM" role="option" value="BM"
class="combobox-option"><span>Bermuda</span></li>
<li tabindex="0" id=":rl:-BT" role="option" value="BT"
class="combobox-option"><span>Bhutan</span></li>
<li tabindex="0" id=":rl:-BO" role="option" value="BO"
class="combobox-option"><span>Bolivia</span></li>
<li tabindex="0" id=":rl:-BA" role="option" value="BA"
class="combobox-option"><span>Bosnia and Herzegovina</span></li>
<li tabindex="0" id=":rl:-BW" role="option" value="BW"
class="combobox-option"><span>Botswana</span></li>
<li tabindex="0" id=":rl:-BV" role="option" value="BV"
class="combobox-option"><span>Bouvet Island</span></li>
<li tabindex="0" id=":rl:-BR" role="option" value="BR"
class="combobox-option"><span>Brazil</span></li>
<li tabindex="0" id=":rl:-IO" role="option" value="IO"
class="combobox-option"><span>British Indian Ocean Territory</span></li>
<li tabindex="0" id=":rl:-BN" role="option" value="BN"
class="combobox-option"><span>Brunei Darussalam</span></li>
<li tabindex="0" id=":rl:-BG" role="option" value="BG"
class="combobox-option"><span>Bulgaria</span></li>
</ul>
</div>
</div>
style.css
.combobox-wrapper {
position: relative;
width: 20em;
min-height: 1.5em;
display: flex;
align-items: center;
border-radius: var(--form-field-border-radius);
outline: none;
background-color: white;
width: 100%;
display: flex;
flex-direction: column;
}
.combobox-label {
color: var(--color-text-dark-gray);
padding-top: 0.5em;
}
.combobox-input {
font-size: 16px;
font-weight: normal;
color: #4d4d4d;
background: #ffffff;
border: 1px solid #828995;
height: 30px;
padding: 4px 10px;
width: 50%;
}
.combobox-options {
list-style: none;
max-height: 15em;
overflow-y: auto;
border: 0.05em solid var(--color-bg-gray);
border-radius: var(--form-field-border-radius);
left: 0;
top: calc(100% + 0.25em);
background-color: var(--color-white);
z-index: 100;
display: block;
}
.combobox-option {
padding: 0.25em 0.5em;
cursor: pointer;
}

Why does the ul element show when input is clicked?

For some reason the ul gets display: none, and is not displayed even when the impute element is clicked.
This is the html
When this is clicked:
<input class="input country" type="text"/>
This html should show (but it doesn't):
<ul id='country-list'>
<li id="US">United States</li>
</ul>
This is the jQuery code:
function handleCountries() {
$('#country-list').hide();
$('#country').click(function () {
$("#country-list").show();
});
};
function handleTestOut() {
handleCountries()
};
$(handleTestOut)
This is the html:
<div class="container">
<input class="input country" type="text"/>
<ul id='country-list'>
<li id="US">United States</li>
</ul>
<button>explore</button>
</div>
This is some css:
.container {
position: relative;
display: flex;
flex-direction: column;
height: 200px;
}
.input {
height: 30px;
margin-bottom: 50px;
}
ul {
height: 200px;
width: 18%;
overflow: hidden;
overflow-y: scroll;
position: absolute;
background-color: blue;
top: 20px
}
Here is the full code
Edit: I removed the invalid html, but am getting the same results
You hide it with: $('#country-list').hide();
And what is with this functions calling each other?
You are using jQuery to call handleTestOut function in witch you call handleCountries function. It does not make much sense.
You will get absolutely same result if you just leave it out of functions:
But your main problem was you don't have #country id you have .country CSS class for click calling (or use input.country or .input class, or all of it input.country.input):
$('#country-list').hide();
$('.country').click(function() {
$("#country-list").show();
});
html {
height: 100%;
}
body {
font-family: 'Nunito', sans-serif;
color: #1b4639;
background: #cbe2e4;
height: 100%;
}
.wrapper {
height: 100%;
margin: 0 auto;
display: flex;
flex-direction: column;
justify-content: center;
}
p {
text-align: center;
margin: 0;
font-size: 24px;
}
.container {
position: relative;
display: flex;
flex-direction: column;
height: 200px;
}
.input {
height: 30px;
margin-bottom: 50px;
}
ul {
height: 200px;
width: 18%;
overflow: hidden;
overflow-y: scroll;
position: absolute;
background-color: blue;
top: 20px
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/8.0.1/normalize.min.css" />
<link href='http://fonts.googleapis.com/css?family=Nunito:400,300' rel='stylesheet' type='text/css'>
<title>Document</title>
</head>
<body>
<div class="wrapper">
<p>Hello World!</p>
<div class="container">
<input class="input country" type="text" />
<ul id='country-list'>
<li id="US">United States</li>
<li id="AF">Afghanistan</li>
<li id="AX">Åland Islands</li>
<li id="AL">Albania</li>
<li id="DZ">Algeria</li>
<li id="AS">American Samoa</li>
<li id="AD">Andorra</li>
<li id="AO">Angola</li>
<li id="AI">Anguilla</li>
<li id="AQ">Antarctica</li>
<li id="AG">Antigua and Barbuda</li>
<li id="AR">Argentina</li>
<li id="AM">Armenia</li>
<li id="AW">Aruba</li>
<li id="AU">Australia</li>
<li id="AT">Austria</li>
<li id="AZ">Azerbaijan</li>
<li id="BS">Bahamas</li>
<li id="BH">Bahrain</li>
<li id="BD">Bangladesh</li>
<li id="BB">Barbados</li>
<li id="BY">Belarus</li>
<li id="BE">Belgium</li>
<li id="BZ">Belize</li>
<li id="BJ">Benin</li>
<li id="BM">Bermuda</li>
<li id="BT">Bhutan</li>
<li id="BO">Bolivia, Plurinational State of</li>
<li id="BQ">Bonaire, Sint Eustatius and Saba</li>
<li id="BA">Bosnia and Herzegovina</li>
</ul>
<button>explore</button>
</div>
</div>
</body>
</html>

How do I make two divs in the same "row" float in different directions?

Here is a JSFiddle of what I have so far:
JSFiddle Link
html
<div class="results">
<h2>Some data</h2>
<ul style="margin:0;padding:0;">
<li class="resultsListItem" style="list-style-type: none;">
<div class="answerDiv"> text </div>
<div class="histogramBar"> </div>
<div class="resultDiv"> 7 </div>
</li>
<br>
<li class="resultsListItem" style="list-style-type: none;">
<div class="answerDiv"> text </div>
<div class="histogramBar"> </div>
<div class="resultDiv"> 1 </div>
</li>
<br>
<li class="resultsListItem" style="list-style-type: none;">
<div class="answerDiv"> text </div>
<div class="histogramBar"> </div>
<div class="resultDiv"> 4 </div>
</li>
<br>
<li class="resultsListItem" style="list-style-type: none;">
<div class="answerDiv"> text </div>
<div class="histogramBar"> </div>
<div class="resultDiv"> 4 </div>
</li>
<br>
</ul>
</div>
css
.answerDiv, .resultDiv, .histogramBar {
display: inline-block;
}
.answerDiv, .histogramBar {
float: left;
}
.answerDiv {
margin-right: 10px;
width: 100px;
}
.histogramBar {
height: 6px;
width: 100px;
background-color: #66dd66;
margin-top: 9px;
border-radius: 5px;
transition: width 1s;
}
.histogramBar:hover {
width: 150px;
}
/*text*/
h2 {
font-size: 40px;
color: black;
}
/*alignment*/
.results {
width: 400px;
height: 400px;
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
margin: auto;
}
I'm having some trouble, however, getting all the alignment stuff right. My goal is to have the text inside the .answerDiv's all float left. If the text was longer, at a certain point it would wrap to a second line. Then, the histogramBar would also float left and sit just to the right of the text. Then, the results number would float right to the opposite side of the containing div. Additionally, I can't figure out how to make the number on the right stay still when the histogramBar's width changes.
Unfortunately, I cannot figure out how to get this to work properly. I'm relatively new to styling so I'm well aware that my code might be really ugly.
How do I accomplish this?
Recap - text floats left, histogram bar floats left (just right of text) numbers float right. when you hover over the bar and it's size changes, the number on the right should not be affected.
For the text to be right-aligned, in you configuration positioning it absolutely based on <li> is the easiest way:
.resultDiv {
text-align: right;
position: absolute;
right: 0;
}
For that to work, you have to add position: relative; to your .resultsListItems.
I changed your example a bit with regard to styling to showcase the elements better.
.answerDiv,
.resultDiv,
.histogramBar {
display: inline-block;
font-size: 14px;
vertical-align: top;
}
.answerDiv {
margin-right: 10px;
width: 100px;
}
.histogramBar {
height: 6px;
width: 100px;
background-color: red;
margin-top: 9px;
border-radius: 5px;
transition: all 1s;
}
.histogramBar:hover {
width: 150px;
}
/*text*/
h2 {
font-size: 40px;
color: black;
}
/*alignment*/
.results {
width: 400px;
height: 400px;
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
margin: auto;
font-size: 0;
}
.resultsListItem {
list-style-type: none;
position: relative;
}
.resultsListItem:nth-of-type(even) {
background-color: #f8f8ff;
}
.results ul {
margin: 0;
padding: 0;
}
.resultDiv {
text-align: right;
position: absolute;
right: 0;
}
<div class="results">
<h2>Some data</h2>
<ul style="">
<li class="resultsListItem">
<div class="answerDiv">text</div>
<div class="histogramBar"></div>
<div class="resultDiv">7</div>
</li>
<li class="resultsListItem">
<div class="answerDiv">text that will wrap to a new line</div>
<div class="histogramBar"></div>
<div class="resultDiv">821</div>
</li>
<li class="resultsListItem">
<div class="answerDiv">text</div>
<div class="histogramBar"></div>
<div class="resultDiv">4</div>
</li>
<li class="resultsListItem">
<div class="answerDiv">text</div>
<div class="histogramBar"></div>
<div class="resultDiv">14</div>
</li>
</ul>
</div>
May this help you.
wrap the class="histogramBar div inside another div. and set the width.
HTML
<div class="results">
<h2>Some data</h2>
<ul style="margin:0;padding:0;">
<li class="resultsListItem" style="list-style-type: none;">
<div class="answerDiv">text</div>
<div class="x">
<div class="histogramBar"></div>
</div>
<div class="resultDiv"> 4</div>
</li>
<br>
<li class="resultsListItem" style="list-style-type: none;">
<div class="answerDiv">text</div>
<div class="x">
<div class="histogramBar"></div>
</div>
<div class="resultDiv"> 4</div>
</li>
<br>
</ul>
Sass
$mainColor: #66dd66;
.answerDiv, .resultDiv, .x
{
display: inline-block;
}
.answerDiv, .histogramBar
{
float: left;
}
li div{border:1px solid red}
.answerDiv
{
margin-right: 10px;
width: 100px;
}
.x{width:160px} /*Now .histogramBar is inside .x*/
.histogramBar
{
height: 6px;
width: 100px;
background-color: $mainColor;
margin-top: 9px;
border-radius: 5px;
transition: width 1s;
&:hover
{
width: 150px;
}
}
/*text*/
h2
{
font-size: 40px;
color: black;
}
/*alignment*/
.results
{
width: 400px;
height: 400px;
position: absolute;
top:0;
bottom: 0;
left: 0;
right: 0;
margin: auto;
}
Remove borders and and put the hover on .x
This will fix your numeric text on right and also when you hover on .x it will not affect numeric values.
Do come back if you get any issues.
If it were me, I would do something like this:
$mainColor: #66dd66;
.answerDiv, .resultDiv, .histogramBar
{
display: inline-block;
border:1px solid red;
}
.results
{
border:1px solid red;
}
.answerDiv, .histogramBar
{
float: left;
}
.answerDiv
{
margin-right: 10px;
width: 100px;
}
.histogramBar
{
height: 6px;
width: 100px;
background-color: $mainColor;
margin-top: 9px;
border-radius: 5px;
transition: width 1s;
&:hover
{
width: 150px;
}
}
.resultDiv
{
}
.resultsListItem
{
}
/*text*/
h2
{
font-size: 40px;
color: black;
}
/*alignment*/
.results
{
width: 400px;
height: 400px;
position: absolute;
top:0;
bottom: 0;
left: 0;
right: 0;
margin: auto;
}
.answersListItem
{
position:relative;
top:30px;
left:20px;
width:100px;
border:1px solid red;
float:left;
}
.histogramListItem
{
position:relative;
top:10px;
left:50px;
width:100px;
height:72px;
border:1px solid red;
float:left;
}
.resultListItem
{
position:relative;
top:-10px;
float:right;
border:1px solid red;
width:10px;
margin-right:50px;
}
<html>
<body>
<div class="results">
<h2>Some data</h2>
<ul style="margin:0;padding:0;">
<li class="answersListItem" style="list-style-type: none;">
<div class="answerDiv"> text </div>
<div class="answerDiv"> text </div>
<div class="answerDiv"> text </div>
<div class="answerDiv"> text </div>
</li>
<br>
<li class="histogramListItem" style="list-style-type: none;">
<div class="histogramBar"> </div>
<div class="histogramBar"> </div>
<div class="histogramBar"> </div>
<div class="histogramBar"> </div>
</li>
<br>
<li class="resultListItem" style="list-style-type: none;">
<div class="resultDiv"> 7 </div>
<div class="resultDiv"> 1 </div>
<div class="resultDiv"> 4 </div>
<div class="resultDiv"> 4 </div>
</li>
<br>
</ul>
</div>
</body>
</html>
check the Updated fiddle. https://jsfiddle.net/e1xrwyLv/4/
If I clearly understood your problem then following css should resolve your problem.
CSS
$mainColor: #66dd66;
.resultsListItem{
margin-bottom:5px;
&:after{
clear:both;
content:'';
display:block;
}
}
.answerDiv, .resultDiv, .histogramBar
{
display: inline-block;
}
.answerDiv, .histogramBar
{
float: left;
}
.answerDiv
{
margin-right: 10px;
width: auto;
max-width:200px
}
.histogramBar
{
height: 6px;
width: 100px;
background-color: $mainColor;
margin-top: 9px;
border-radius: 5px;
transition: width 1s;
&:hover
{
width: 150px;
}
}
.resultDiv
{
float:right;
}
.resultsListItem
{
}
/*text*/
h2
{
font-size: 40px;
color: black;
}
/*alignment*/
.results
{
width: 400px;
height: 400px;
position: absolute;
top:0;
bottom: 0;
left: 0;
right: 0;
margin: auto;
}

<ul> element does not re-size height to fit children <li> elements

I have an <ul> with a height:100%, that doesn't resize itself to fit all of its children <li> elements.
What is happening:
Scrolling through questions, you can see the background color for the <ul> does not fill to the bottom of the last <li>.
What I would like to see happen:
A scrollable unordered list <ul> that surrounds and encloses all <li> elements.
Additional Info:
There is a general wrapper <div> that encloses an unordered list <ul> of <li>, made up of a label <label> and an input <input>. All of this sits between and header and footer, <header> and <footer> respectively.
You can check this CodePen here.
* {
border: 0;
font-family: "Lucida Console", Monaco, monospace
}
body {
min-width: 1440px;
height: 100%;
//background: #bbb
}
header {
width: 100%;
height: 60px;
background: #bada55;
margin: 0;
position: fixed;
top: 0;
left: 0;
z-index: 100;
//opacity: .4;
}
footer {
width: 100%;
height: 100px;
background: #bada55;
margin: 0;
position: fixed;
bottom: 0;
left: 0;
z-index: 100;
//opacity: .4;
}
ul,
li {
list-style-type: none;
color: #444;
display: block;
}
label,
input {
display: block;
position: relative;
}
#wrap {
background: #000;
width: 40%;
height: 100%;
position: absolute;
margin: 0;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
#question_list {
width: 100%;
min-width: 452px;
height: 100%;
background: #bada55;
padding: 0;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
margin: 0;
}
.question {
background: #ddd;
width: 90%;
height: 120px;
position: relative;
left: 50%;
transform: translateX(-50%);
margin: 0
}
.question label {
font-size: 24px;
text-align: center;
}
.question input {
width: 284px;
left: 50%;
transform: translateX(-50%);
border-radius: 4px;
font-size: 24px;
margin-top: 44px;
margin-bottom: 24px
}
.space {
width: 100%;
height: 120px;
background: #badff5
}
<header></header>
<div id="wrap">
<ul id="question_list">
<li id="space_0" class="space"></li>
<li id="one" class="question">
<label for="f_name">First Name</label>
<input name="f_name" id="f_name" />
</li>
<li id="space_1" class="space"></li>
<li id="two" class="question">
<label for="l_name">Last Name</label>
<input name="l_name" id="l_name" />
</li>
<li id="space_2" class="space"></li>
<li id="three" class="question">
<label for="age">Age</label>
<input name="age" id="age" />
</li>
<li id="space_3" class="space"></li>
<li id="four" class="question">
<label for="address">Address</label>
<input name="address" id="address" />
</li>
<li id="space_4" class="space"></li>
<li id="five" class="question">
<label for="degree">Degree</label>
<input name="degree" id="degree" />
</li>
<li id="space_5" class="space"></li>
<li id="six" class="question">
<label for="exp">Years of Experience</label>
<input name="exp" id="exp" />
</li>
<li id="space_6" class="space"></li>
</ul>
</div>
<footer></footer>
In order to achieve the intended result you need to add a simple css rule:
ul {
overflow: auto;
}
You can learn more about the overflow css property here
Check codePen demo

Can someone help me keep the footer at the bottom of the page?

I've looked up how to stick the footer to the bottom of the page but i'm having trouble making it actually work! If i post my code can you look at it and change it to make it work, but also explain how you did it?
HTML:
<!DOCTYPE html>
<html>
<head>
<title>Aaron Kelsey - Home</title>`enter code here`
<link rel="stylesheet" type="text/css" href="style.css" media="screen" />
</head>
<body>
<div id="wrapper">
<div class="header_wrapper">
<ul id="navigation">
<li>HOME</li>
<li>ABOUT</li>
<li>WORK</li>
<li>CONTACT</li>
</ul>
</div>
<div id="line-1"></div>
<div id="line-2"></div>
<div class="content">
<img class="header" src="images/header.png">
</div>
<div class="footer">
</div>
</div>
</body>
</html>
CSS
* {
margin: 0px;
padding: 0px;
}
body{
margin: 0 auto;
padding:0;
margin: 0;
height: 100%;
background-color: #F5F5F5;
}
img.header{
display: table;
margin: 0 auto;
}
#wrapper{
min-height: 100%;
position: relative;
}
.header_wrapper{
display: table;
margin: 0 auto;
width: 1000px;
height: 50px;
position: relative;
padding:10px;
}
.content{
position: relative;
margin: 0 auto;
width: 1000px;
height: 100%;
min-height: 100%;
padding:10px;
padding-bottom:150px;
}
.footer{
position: absolute;
margin: 0 auto;
bottom: 0px;
width: 100%;
height: 150px;
background-color: #E0E0E0;
}
#line-1{
position: absolute;
margin: 0 auto;
width: 100%;
height: 1px;
background-color: #E0E0E0;
top: 10px;
}
#line-2{
position: absolute;
margin: 0 auto;
width: 100%;
height: 1px;
background-color: #E0E0E0;
top: 50px;
}
#navigation {
position: relative;
width: 1000px;
height: 10px;
font-size: 18px;
font-family: Arial;
font-weight: bold;
top: 20px;
text-align: center;
}
#navigation li {
display: inline;
padding: 50px;
}
#navigation a {
text-decoration: none;
color: #A9A9A9;
}
#navigation a:hover {
color: #1e1e1e;
}
You have your footer inside of the wrapper. It is fixed at the bottom of that div but not the body.
take the footer div outside of your wrapper and it is good to go.
<div id="wrapper">
<div class="header_wrapper">
<ul id="navigation">
<li>HOME
</li>
<li>ABOUT
</li>
<li>WORK
</li>
<li>CONTACT
</li>
</ul>
</div>
<div id="line-1"></div>
<div id="line-2"></div>
<div class="content">
<img class="header" src="images/header.png" />
</div>
</div>
<div class="footer"></div>
JSFIDDLE
Also in your footer you don't need to have margin: 0 auto; since it is 100%. The next thing is close your image tags like so, <img src="" alt="" />.