Whitespace at the right side of page and remains from positioning [css,html] - html

i am new here and generally i recently started to learn webdev and i am trying to make little "portfolio" website to train practice skills. I have one problem what i can't solve, and i am siting with eyes on screen about few hourse what makes me so confused
First issue is whitespace on right side of the page.
2.Next issue is a lot of whitespace what remaining after relative positioning.
How can with these get rid of these things?
<!DOCTYPE html>
<html lang="pl">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title></title>
<link rel = "stylesheet" href = "style.css">
</head>
<body>
<!--header-->
<header>
</header>
<div class = "container">
<div class="text">
<h1 id = "h1">“The life of a designer...” </h1>
<h2 id = "h2">Is a life of fight. Fight against the ugliness.
Just like a doctor fights against disease. For us,
the visual disease is what we have around, and what we
try to do is cure it somehow with design.</h2>
<h3>– Massimo Vignelli. </h3></div></div>
<div class="txt">
<p id ="one">Hi, i am webdeveloper<id></id></p>
<p id ="two">If you want work with me</p>
<p id ="three">leave a message.</p>
</div>
<div class = "icons">
<img src = "icons/cheap.png" alt = "cheap" id="cheap"/>
<img src = "icons/Trust.png" alt = "trust" id="trust"/>
<img src = "icons/timeliness.png" alt = "timeliness" id="timeliness"/>
<img src ="icons/developing.png" alt ="developing" id="developing"/>
</div>
<div class = "Social">
<img src ="icons/facebook.png" alt ="fb" />
<img src ="icons/instagram.png" alt ="insta" />
<img src ="icons/linkedin.png" alt = "linkedin"/>
</div>
<!--Overview-->
<section>
<article>
Aaaa
</article>
</section>
<!-- Social media icons-->
<aside>
</aside>
<footer>
</footer>
</body>
</html>
CSS:
#font-face {
font-family: myFirstFont;
src: url(/fonts/Graviola_Regular.otf);
}
#font-face {
font-family: czcionka;
src: url(/fonts/czcionka.ttf);
}
body {
margin:0px;
padding:0px;
}
header{
background-image:url(bg1.jpg);
background-repeat:no-repeat;
height:800px;
opacity: 0.8;
background-size:100% 100%;
}
.txt {
position:relative;
right:-50px;
top:-1120px;
border-left:3px solid white;
font-family:czcionka;
}
.txt #one {
position:relative;
color:white;
font-size: 50px;
position:relative;
bottom:-60px
}
.txt #two {
position:relative;
color: white;
font-size: 50px;
}
.txt #three {
position:relative;
color: white;
font-size: 50px;
top:-60px
}
.container .text {
color:white;
text-align: center;
position:relative;
top: -450px;
margin: 50px;
font-family: myFirstFont;
}
.container .text #h1 {
font-size:60px;
border-bottom: 3px solid;
font-family:myFirstFont;
}
.container .text #h2 {
font-size: 25px;
font-style:italic;
}
.container .text #another {
position: relative;
top:-500px;
font-family:myFirstFont;
font-size:40px;
}
.Social {
position: relative;
top:-1460px;
right:-50px;
margin:500px;
}
.icons #cheap {
position: relative;
top:-1139px;
right:-1225px
}
.icons #timeliness {
position:relative;
top:-1140px;
right: -1110px
}
.icons #developing {
position:relative;
top:-1140px;
right:-750px;
}
Here's link to img how this looks. When i scroll down page rest of my site elements are very far down.
Like this looks the white space what i talking about

Related

footer is not at the bottom of the page

i have a problem where my footer element is not at the bottom of the page while i browse the page over mobile this my html
<!DOCTYPE html>
<html>
<head>
<title>Ziad Alian</title>
<meta charset="UTF-8">
<link rel="stylesheet" href="mystyle.css">
</head>
<body>
<h4>Ziad Alian</h4>
<img class="imgz" src="zCmakv5P_400x400.jpg"/></img>
<ul>
<li>ABOUT ME</li>
<li>PROJECTS</li>
<li>CONTACT</li>
</ul>
<hr>
<div>
<p id="hello">Hello World! </p>
<p id="aboutme">I'm Ziad Alian a 26 years old Software Developer. Born in the 331 BC ancient city of Alexandria, Egypt.<br/>
I studied Geomatics but I don't like it cause computer science is my passion.<br/>
I'm a self taught web developer, My goal is to be a fucll stack developer using
HTML5, CSS, JavaScript, React, Python and Django.<br/>
I love programming and everything that has to do with technology, the internet and writing code.
</p>
</div>
<hr>
<div id="contact">
<ul>
<li>GitHub </li>
<li>LinkedIn </li>
<li>Twitter </li>
<li>Instagram </li>
</ul>
</div>
<br>
<footer>© 2020 Ziad Alian</footer>
</body>
</html>
And this is my CSS
this where my footer element been added
footer {
background-color: black;
color: white;
padding: 0.5em;
}
Edit
i added this code
body {
background-color:whitesmoke;
min-height: 100%;
display: flex;
flex-direction: column;
}
h4 {
text-align: center;
font-size: 68px;
font-weight: 80;
color: teal;
}
.imgz {
width: 200px;
border-radius: 50%;
}
#hello {
text-align: center;
font-size: 30px;
color: teal;
}
#aboutme {
font-size: medium;
font-family: 'Franklin Gothic Medium', 'Arial Narrow', Arial, sans-serif;
}
p {
text-align: justify;
}
footer {
position: fixed;
left: 0;
bottom: 0;
width: 100%;
background-color: black;
color:white;
padding: 0.5em;
margin: 0;
margin-top: auto;
}
and it's now fixed like it's just go down and up with me while i scroll the page i just want it to stay at the bottom
mywebsite
You have not integrated some properties into the CSS-file.
You have not integrated the block of the element footer into the HTML-file.
New footer properties
footer {
background-color: black;
color: white;
padding: 0.5em;
position:fixed;
left:0px;
bottom:0px;
height:30px;
width:100%;
}
Old footer properties
footer {
background-color: black;
color: white;
padding: 0.5em;
}
New footer
<footer> © 2020 Ziad Alian</footer>
These properties fix the object for the view of the user visiting the website, which means that the object is dynamic for the view of the user.
You could also try giving the main section a min-height: 100vh so to push the footer down. See if that helps.
Try using position: fixed to keep your footer pinned to the bottom of the viewport.
When using fixed positioning, you'll also want to be sure you set the left: 0 and width: 100% properties to make the footer the same width as the viewport.
footer {
background-color: black;
color: white;
padding: 0.5em;
position:fixed;
bottom:0;
left:0;
width:100%
}
<footer>© 2020 Ziad Alian</footer>
I have developed a website for you with the same structure as your old website, but with only minor changes.
The source code now has a better structure.
Comments have been added to avoid losing track of the source code.
HTML
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-GB"><head>
<title>2020 Ziad Alian</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div id="container">
<div id="header">
<!-- Header start -->
<h1>
<center>2020 Ziad Alian</center>
</h1>
<!-- Header end -->
</div>
<div id="body">
<!-- Body start -->
<center>
<img class="imgz" src="zCmakv5P_400x400.jpg"></img>
<p>
<a href="https://LinkToTheWebsite.com">
<li> ABOUT ME</li></a></p>
<p>
<a href="https://LinkToTheWebsite.com">
<li>PROJECTS</li></a></p>
<p>
<a href="https://LinkToTheWebsite.com">
<li>CONTACT</li></a></p>
</center>
<hr>
<p>
<center style="font-size: 30px"> HELLO WORLD</style></center>
</p>
<center>
<p><strong>I'm Ziad Alian a 26 years old Software Developer. Born in the 331 BC ancient city of Alexandria, Egypt.<br><br>
I studied Geomatics but I don't like it cause computer science is my passion.<br><br>
I'm a self taught web developer, My goal is to be a fucll stack developer using HTML5, CSS, JavaScript, React, Python and Django.<br><br>
I love programming and everything that has to do with technology, the internet and writing code.</strong>
</p>
</center>
<hr>
<center>
<p>
<a href="https://LinkToTheWebsite.com">
<li> GitHub</li></a></p>
<p>
<a href="https://LinkToTheWebsite.com">
<li>LinkedIn</li></a></p>
<p>
<a href="https://LinkToTheWebsite.com">
<li>Twitter</li></a></p>
<p>
<a href="https://LinkToTheWebsite.com">
<li>Instagram</li></a></p>
</center>
<!-- Body end -->
</div>
<div id="footer">
<!-- Footer start -->
<center>
<p><font color="#FFFFFF">© 2020 Ziad Alian</font></p>
</center>
<!-- Footer end -->
</div>
</div>
</body>
</html>
CSS
html,
body {
margin:0;
padding:0;
height:100%;
}
#container {
min-height:100%;
position:relative;
}
#header {
padding:10px;
}
#body {
padding:10px;
padding-bottom:60px;
}
#footer {
position:absolute;
bottom:0;
width:100%;
height:60px;
background:#000000;
}
.imgz {
border-radius: 50%;
}
#header p,
#header h1 {
margin:0;
padding:10px 0 0 10px;
}
#footer p {
margin:0;
padding:10px;
}

Change Text when hovering over image, text is in a different location then image

I have some images in a grid-like area and when one is hovered over I would like it so the text on the left-hand side of the screen changes to a predefined description of that image, for every image it will do this and display the text in the same area. Any help would be much appreciated I've been trying to get it for hours now.
The text needs to be displayed in the same area. so if I hover over a lake, the lakes desc will be displayed in another box (let's call it desc box). then if I hover over a duck the desc of that duck will be displayed in that same desc box.
Is there any way using onmouseover to set to show text depending whats being hovered over. so if A duck image is being hovered over the predefined text lets say var DuckImage="A duck is an animal"; is displayed in HoverOverDesc when that duck image is hovered over.
If I understand your question, you want a grid of images to the right on the screen, where each image has predefined text that is displayed on the left side of the screen if the user hovers that image.
This can be achieved via CSS and HTML, without any JavaScript as shown below. Please see the comments in the snippet for further explanation:
.grid {
/* Put 50% white space to the left of the image grid
which provides the space for descriptions to appear */
padding-left:50%;
/* Specify a basic grid layout for images in the grid */
display: grid;
grid-template-columns: 1fr 1fr;
grid-gap: 10px;
}
.grid img {
/* Cause each image to not exceed the grid cell's width */
max-width:100%;
}
.grid a p {
/* With width of description cannot exceed half page width. If text
description is too long, this causes it to wrap onto multiple lines
at the 50% point */
width:50%;
/* Fixed position ensures the description is placed at top left of
screen (by default) regardless of scroll position */
position:fixed;
top:0;
left:0;
/* Do not show description by default */
display:none;
}
.grid a:hover p {
/* When hovering the a around an image, cause it's description to
be shown */
display:block;
}
<div class="wrapper">
<div class="grid">
<a href="#">
<p>Pre defined text for blue image</p>
<img src="https://via.placeholder.com/350/00f.png" alt="blue" />
</a>
<a href="#">
<p>Pre defined text for red image</p>
<img src="https://via.placeholder.com/350/f00.png" alt="red" />
</a>
<a href="#">
<p>Pre defined text for green image</p>
<img src="https://via.placeholder.com/350/0f0.png" alt="green" />
</a>
<a href="#">
<p>Pre defined text for yellow image. Lots of text can be specified,
which will wrap on to a new line.</p>
<img src="https://via.placeholder.com/350/ff0.png" alt="green" />
</a>
</div>
</div>
one way of get this done could be have the grid and the message container in a parent container and use the general sibling selector, the sample I put bellow do that is not perfect but it work, other way that you could use is with javascript using onmouse over on the grid cells and maybe a dataattribute in order to make it more dynamic.
:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<style>
.grid-area{
width:800px;
height: 600px;/* theses values are only for test define your as you wish*/
position: relative;
top:50px;
left:100px;
background:#444;
display: inline-flex;
justify-content: space-around;
flex-wrap: wrap;
}
.grid-area >.img{
width: 150px;
height:150px;
background:blue;
margin:20px;
border:2px solid rebeccapurple;
}
.text-artifact{
position: absolute;
bottom:10px;
left: -20px;
width: 100%;
height: 100px;
background:#4354FF;
}
.text-artifact *{
display: none;
text-align: center;
color:white;
font-weight: bolder;
text-shadow: 1px 2px 3px #434343;
font-family: 'Trebuchet MS', 'Lucida Sans Unicode', 'Lucida Grande', 'Lucida Sans', Arial, sans-serif;
font-size:2em;
}
.img:hover{
background: yellow;
}
.img:hover ~ .text-artifact{
background: white;
}
.img1:hover ~ .text-artifact .text1{
display:block;
}
.img2:hover ~ .text-artifact .text2{
display:block;
}
.img3:hover ~ .text-artifact .text3{
display:block;
}
.img4:hover ~ .text-artifact .text4{
display:block;
}
.img5:hover ~ .text-artifact .text5{
display:block;
}
</style>
</head>
<body>
<div class="grid-area">
<div class="img1"><img src="https://via.placeholder.com/150"alt=""></div>
<div class="img2"><img src="https://via.placeholder.com/150"alt=""></div>
<div class="img3"><img src="https://via.placeholder.com/150"alt=""></div>
<div class="img4"><img src="https://via.placeholder.com/150"alt=""></div>
<div class="img5"><img src="https://via.placeholder.com/150"alt=""></div>
<div class="text-artifact">
<div class="text1">This should be a description for 1</div>
<div class="text2">This should be a description for 2</div>
<div class="text3">This should be a description for 3</div>
<div class="text4">This should be a description for 4</div>
<div class="text5">This should be a description for 5</div>
</div>
</div>
</body>
</html>
the example bellow contains javascript, this is one of the approach that you could use, I decide to use data attribute that let customize with values and customize, css should work with it and you could query( as in the example and create too with .setAttribute('data', "your attribute name",...; but there are other way.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<style>
*{
margin:0;
padding:0;
box-sizing: border-box;
}
.center{
width:500px;
height: 400px;
position: absolute;
top:50%;
left:50%;
transform: translate(-50%, -50%);
border:3px solid #434343;
}
.nested-box-bottom{
width: 100%;
height: 60px;
position: fixed;
display: inline-block;
bottom:0;
left:0px;
background: #323232;
}
#text-in-nested-box {
margin-top:10px;
width: 90%;
position: relative;
left:5%;
height: 32px;
color:white;
font-weight: bolder;
text-align: center;
}
#outside-box{
margin-top:10px;
width: 100%;
position: absolute;
top:-10px;
left:0%;
height: 49px;
color:white;
font-weight: bolder;
text-align: center;
background:#323232;
margin-bottom:20px;
}
</style>
</head>
<body>
<div class="center">
<img class="img" data-columns="1" src="https://via.placeholder.com/150"alt="">
<img class="img" data-columns="2" src="https://via.placeholder.com/150"alt="">
<img class="img" data-columns="4"src="https://via.placeholder.com/150"alt="">
<div class="nested-box-bottom">
<div id="text-in-nested-box"></div>
</div>
</div>
<div id="outside-box"></div>
<script>
const img = document.querySelectorAll('.img');
const outside = document.getElementById('outside-box');
const inside = document.getElementById('text-in-nested-box');
function display(){
const value = this.dataset.columns;
inside.innerHTML =`you are hover element with ${value}`;
outside.innerHTML =`you are hover element with ${value}`;
}
function out( ){
outside.innerHTML = "";
inside.innerHTML="";
}
for(i=0;i<img.length;i++)
{
///console.log(`setting event src ${img[i].dataset.columns }`);
img[i].addEventListener("mouseover", display, false);
img[i].addEventListener("mouseout", out, false);
}
</script>
</body>
</html>
<img src="Images/duck.png" width="450" height="auto" onmouseover="document.getElementsByName('HoverOverInfo2')[0].innerHTML = 'A Duck'" onmouseout="document.getElementsByName('HoverOverInfo2')[0].innerHTML = ' '" />
<img src="Images/car.png" width="450" height="auto" onmouseover="document.getElementsByName('HoverOverInfo2')[0].innerHTML = 'A Car'" onmouseout="document.getElementsByName('HoverOverInfo2')[0].innerHTML = ' '" />
Some where else
<h4 class="w3-bar-item"><b>Description</b></h4>
<div style="margin-left:8px">
<p id="HoverOverInfo" name=></p>
This worked perfectly for me!

Aligning two images in css on the right with separate lines

I want to align these two images on the right but I want them to be on separate lines. Right now the only method I can think to do that is a very large margin for one of the images but i'm wondering if there's a better way.
I want the paragraphs to appear beside the first image, on the right.
Also the background of the paragraphs changes when scrolled over, but I would like to restrict the colour change to being just around the text.
Use any images you want in this code
This is my code:
<!DOCTYPE HTML>
<html>
<head>
<title> Stack Overflow Question </title>
<link rel="stylesheet" type="text/css" href="./css/q7.css"></link>
</head>
<body>
<h1> Holla lolla lolla la </h1>
<figure id=real>
<img src="images/RealDog.jpg" </img>
<figcaption>Figure 1. Real Dog</figcaption>
</figure>
<p id="Gar"> Gar Gar Gar </p>
<p id="lol"> lol lol lol </p>
<figure id=fake>
<img src="images/FakeDog.jpg"></img>
<figcaption>Figure 2. Fake Dog</figcaption>
</figure>
</body>
</html>
Css file:
body {
font-family: sans-serif;
font-weight: normal;
background-color: #EDEDED;
}
h1 {
color: blue;
font-weight: normal;
}
img {
height: 100px;
/*display: block;*/
}
p:hover {
background-color:white;
}
#Gar {
float: right;
color: blue;
margin-right: 100px;
}
#lol {
float: right;
color: blue;
margin-right: 100px;
}
figure {
float: right;
margin-left: 1000px;
}
First of all it's very important to understand the way that html and css works.You should be more specific with your classes and improve your structure in html code.For css it's wrong to use margin:1000px.It's wrong!I set max-width but you can change it.I tried to correct your code as much as I can...but there are a lot better ways to fix your problem
html code:
<div class = "container">
<h1> Holla lolla lolla la </h1>
<div class="right-part">
<figure id=real>
<img src="images/RealDog.jpg" </img>
<figcaption>Figure 1. Real Dog</figcaption>
</figure>
<div class="two-p">
<p id="Gar"> Gar Gar Gar </p>
<p id="lol"> lol lol lol </p>
</div>
<figure id=fake>
<img src="images/FakeDog.jpg"></img>
<figcaption>Figure 2. Fake Dog</figcaption>
</figure>
</div>
css code
body {
font-family: sans-serif;
font-weight: normal;
background-color: #EDEDED;
}
.container{
position:relative;
max-width:900px;
margin:0 auto;
}
h1 {
color: blue;
font-weight: normal;
display: inline-block;
vertical-align: top;
}
.right-part {
display: inline-block;
}
p:hover {
background-color:white;
}
#Gar {
color: blue;
}
#lol {
color: blue;
}
.two-p {
display: inline-block;
vertical-align: top;
}
figure#real {
display: inline-block;
}

My CSS wont show up past my index page

I'm creating a website for my school programming class and my css won't show up past my homepage, my pattern of creating css doesn't change, and so far 5 people in my class have checked and none know the reason
Homepage
<head>
<link rel= "stylesheet" href="css1.css">
<meta charset = "utf-8">
<meta name= "keywords" content= "photo">
<title> "trash" </title>
</head>
<body bgcolor="#F5F6E9">
<div class="header">
<div class="container">
<div class="logo">
<h1><a href="index.html">LEGALIZE RANCH</h1>
</div>
<div class= "nav">
<ul>
<li>RANCH!</li>
<li>WHY?????</li>
<li>BROTENDO NATION</li>
</ul>
</div>
</div>
</div>
<div class= "mainpart">
<div class="statement">
<p>
WHATS UP BROTENDOS
</p>
</div>
<div class= "god">
<center> <img src= "god.png" alt="ranch dude"> </center>
</div>
<div class= "statement2">
<p>
RANCH IS THE #1 MOST RARE RESOURCE EVER!!!! THAT MEANS OUR GOVERNMENT IS LIMITING IT FOR DUDES LIKE THIS!!!!!
</p>
<p>
THIS NEEDS TO BE ADDRESSED AT THE NINTENDO CONVENTION!!!!!
</p>
</div>
<div class= birdup>
<center><img src= "birdup.jpg" alt= "bir ddup"></center>
</div>
</body>
CSS
body {
width: 100%;
margin : auto;
}
.container {
width: 960px:
margin: 0 auto:
}
.header {
background: #94DD6E;
height: 100px;
width: 100%;
top: 0;
position: fixed;
}
.logo {
float: left;
font-family: "Helvetica";
font-size: 15px;
margin-left:15px;
padding-top:10px;
}
a {
text-decoration: none;
color: #fff
}
li {
list-style: none;
float: left;
margin-left: 15px;
padding-top: 15px;
font-family: Arial, Helvetica, sans-serif;
margin-right: 15px;
}
.nav {
float: right;
padding-top: 10px;
}
.content {
background: #e7e8e1;
}
.statement {
padding-top: 100px;
text-align: center;
font-family: "Helvetica";
font-size: 25px;
}
.statement2 {
text-align: center;
.god {
text-align: center;
}
.pimplepete {
margin-top: 50%;
text-align: center;
color: orange;
}
.mainpart {
background-color: #F5F6E9;
}
.video {
padding-top: 25px;
}
.donation {
text-align: center;
font-family: "Papyrus";
font-size: 50px;
}
Page that the CSS isn't working on
<!doctype html>
<head>
<link rel= "stylesheet" href="css1.css">
<meta charset = "utf-8">
<meta name= "keywords" content= "photo">
<title> "trash" </title>
</head>
<body bgcolor="#F5F6E9">
<div class="header">
<div class="container">
<div class="logo">
<h1><a href="index.html">LEGALIZE RANCH</h1>
</div>
<div class= "nav">
<ul>
<li>RANCH!</li>
<li>WHY?????</li>
<li>BROTENDO NATION</li>
</ul>
</div>
</div>
</div>
<div class= "video">
<center>
<iframe width="640" height="360" src="https://www.youtube.com/embed/0V7FGCtnoJo" frameborder="0" allowfullscreen></iframe>
</center>
</div>
<div class= "donation">
<p>
OUR MOVEMENT IS GROWING!!! SPORT SOME <i>RANCHY</i> MERCH
</p>
<p>
LEGAL RANCH MERCH
</p>
</div>
</body>
Don't worry I know that the formatting isn't good.
Your CSS is linked relatively.
<link rel= "stylesheet" href="css1.css">
If your other pages are perhaps in different folders - folders that don't also have a css1.css alongside the html files inside them, it won't understand the reference to css1.css.
Try adding a leading slash /css1.css if you're accessing the site via a URL, rather than the filesystem, and the css is in the web root.
If you're loading the pages via the filesystem, adjust the reference to the css based on the file calling it. You might traverse up a level by referring to it as ../css1.css, instead.
To illustrate further, given a filesystem like:
public_html/
- index.html
- css1.css
- about/
- index.html
public_html/index.html knows about css1.css because they live in the same directory.
However, in public_html/about/index.html, if the <link> tag references css1.css, the browser will look for a file called public_html/about/css1.css, which I imagine doesn't exist.

Image not working

When I put the image inside nav it works but when I put it in body or header it doesn't. I have the image tag right because when I put it in nav it works. I know this code is unscientific but I'm new to html. Thanks for the help in advanced.
<!DOCTYPE html>
<html>
<head>
<title> Random Site </title>
<style type = 'text/css'>
header nav {
float: right;
background-color: gray;
width: 100%;
position:absolute;
top:0px;
left:0px;
right:0px;
height: 60px;
}
header nav a {
font-size: 120%;
float: right;
padding: 1%;
font-family: 'Helvetica';
text-decoration: none;
color: black;
position: relative;
top: 5px
}
header nav a:hover {
color: white;
}
</style>
</head>
<body>
<img src = 'image.jpg' alt= 'image' width= '100px' height= '70px'/>
<header>
<nav>
<a href = 'www.google.com'> games </a>
<a href = 'www.google.com'> about </a>
<a href = 'www.google.com'> contact </a>
</nav>
</header>
</body>
</html>
I think it is working but you just aren't seeing it because you have the nav positioned absolute so I think it's just overlapping your image. Try giving your image a class then do something like this:
.myimage { position: relative; z-index: 2; }
I figured it out I forgot to put the ; after top 5px. Sorry about that.