Go Back   CodingForums.com > :: Client side development > HTML & CSS

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 01-04-2012, 08:38 PM   PM User | #1
kamaro
New Coder

 
Join Date: Jan 2012
Posts: 40
Thanks: 8
Thanked 0 Times in 0 Posts
kamaro is an unknown quantity at this point
Layout issues

Hi, I'm trying to create my very first site. I have the header, nav, body, and footer but when i zoom in and out of the page my nav bar shifts to the top left. Most sites stay centered when zoomed out. Im trying to go for a layout similar to this one except without the content: http://themes.devatic.com/sparky/portfolio-v1/

HERES MY CODE (HTML):

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<link href="style.css" rel="stylesheet" type="text/css" />
</head>

<style>
body{
background:#242424;
}
</style>

<body>

<div id="page-wrap">

<div id="inside">

<div id="header">
<img src="envyLOGO1.jpg" height="115" />
<ul id="list-nav" style="top: -13px; left: 491px; position: absolute;">
<li><a href="#"><font face="Verdana">Home</font></a></li>
<li><a href="#"><font face="Verdana">About</font></a></li>
<li><a href="#"><font face="Verdana">Gallery</font></a></li>
<li><a href="#"><font face="Verdana">Products</font></a></li>
<li><a href="#"><font face="Verdana">Contact</font></a> </li>
</ul>
</div>

<div id="main-content">
<p>
CONTENT<br />CONTENT<br />CONTENT<br />CONTENT<br />CONTENT<br />CONTENT<br />
</p>
</div>

<div id="footer">

</div>


</div>

</div>


</body>
</html>

(CSS):
* {
margin: 0;
padding: 0;
}

body {
font-size: 62.5%;
background: url(images/stripe.png) repeat;
}

p, li {
font: 1.2em/1.8em Tahoma, sans-serif;
margin-bottom: 10px;
}

h2 {
font: 1.8em Tahoma, sans-serif;
color: green;
margin-bottom: 10px;
}

ul {
margin-left: 25px;
}

img {
border: none;
}

#page-wrap {
background: white;
min-width: 780px;
max-width: 1024px;
margin: 10px auto;
}
#page-wrap #inside {
margin: 10px 10px 0px 10px;
padding-top: 10px;
padding-bottom: 10px;
}

#main-content {
padding-top: 20px;
}

#header {
background: #101010;
padding:50px;
padding-bottom:10px;
padding-top:10px;
}

#footer {
background: #101010;
text-align: center;
padding-top: 20px;
padding-bottom: 20px;
color: white;
}

ul#list-nav {
margin:55px;
padding:0;
list-style:none;
width:525px;
}

ul#list-nav li {
display:inline
}
ul#list-nav li a {
text-decoration:none;
padding:7px 0;
width:100px;
color:#4fdc48;
float:left;
}

ul#list-nav li a {
text-align:center;
border-right-width: 1px;
border-right-style: solid;
border-right-color: #232323;
}

ul#list-nav li a:hover {
background:#242424;
color:#4fdc48;
}


Thanks in advance <3
kamaro is offline   Reply With Quote
Old 01-04-2012, 08:50 PM   PM User | #2
Excavator
Master Coder


 
Excavator's Avatar
 
Join Date: Dec 2006
Location: Alaska
Posts: 9,410
Thanks: 22
Thanked 1,765 Times in 1,749 Posts
Excavator has a spectacular aura aboutExcavator has a spectacular aura aboutExcavator has a spectacular aura about
Hello kamaro,
You can keep an absolutely positioned element in position relative to it's container by using position: relative;
Like this
Code:
#header {
    background: none repeat scroll 0 0 #101010;
    padding: 10px 50px;
    position: relative;
}
But is positioning really needed here? Probably not. See the pitfalls of absolute position here.

When posting code in the forum, please use the code tags, [code][/code] - available with the # button in the post edit window.
This will wrap your code in a scroll box which greatly helps the readability of your post.
__________________
Validate often DURING development - Use it like a splelchecker | Debug during Development |Write it for FireFox, ignore IE
Use the right DocType | Validate your markup | Validate your CSS | Why validating is good | Why tables are bad
Excavator is offline   Reply With Quote
Users who have thanked Excavator for this post:
kamaro (01-04-2012)
Old 01-04-2012, 08:55 PM   PM User | #3
kamaro
New Coder

 
Join Date: Jan 2012
Posts: 40
Thanks: 8
Thanked 0 Times in 0 Posts
kamaro is an unknown quantity at this point
wow haaha awesome thank you so much!!
kamaro is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 06:06 PM.


Advertisement
Log in to turn off these ads.