MathewHood
05-25-2010, 03:18 PM
Hey everyone,
I just got referred to your site today by a friend from University, it has so much information!
Glad that I finally have a resource to view sample code and get ideas.
Anyway, my issue is in the alignment on a design I am starting to do. I will post the HTML and CSS code for the website and a screenshot.
CSS CODE
body {
background-color: #5b5a5c;
font-family: Century Gothic, Tahoma, Verdana, Arial;
}
#whiteContainer {
width: 1000px;
margin-left: auto;
margin-right: auto;
}
#whiteBox {
background-color: #FFFFFF;
width: 1000px;
height:2000px;
}
.nav ul{
color:#FFF;
height: 40px;
width:940px;
background-color:#333;
margin-left: auto;
margin-right: auto;
}
.nav ul li{
list-style: none;
display:inline;
width:188px;
height:40px;
text-align:center;
}
.nav ul li a{
text-decoration: none;
float: left;
color: #FFFFFF;
background-color: #333333;
width:188px;
height:40px;
}
.nav ul li a:hover{
background-color: #000000;
width:188px;
height:40px;
}
#navContainer{
width: 940px;
}
HTML CODE
<!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>Taranix Pty Ltd - 2010</title>
<link href="styles/styles.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="whiteContainer">
<div id="whiteBox">
<div id="navContainer">
<div class="nav">
<ul>
<li><a href="#">Home</a></li>
<li><a href="#">Services</a></li>
<li><a href="#">Blog</a></li>
<li><a href="#">Partners</a></li>
<li><a href="#">Contact</a></li>
</ul>
</div>
</div>
<div id="imageContainer">
asad
</div>
</div>
</div>
</body>
</html>
Here is a picture of my issue.
http://img176.imageshack.us/img176/9760/navigationalignmentissu.jpg
As you can see, the left of the navigation bar seems to almost have a padding of 20px or so (the black background behind home is the rollover).
Somehow it has that grey area on and left and a small white space on the right (which i presume is just numbers not matching up).
If anyone has any ideas on what I did wrong your help would be greatly appreciated.
Regards,
Mathew Hood
I just got referred to your site today by a friend from University, it has so much information!
Glad that I finally have a resource to view sample code and get ideas.
Anyway, my issue is in the alignment on a design I am starting to do. I will post the HTML and CSS code for the website and a screenshot.
CSS CODE
body {
background-color: #5b5a5c;
font-family: Century Gothic, Tahoma, Verdana, Arial;
}
#whiteContainer {
width: 1000px;
margin-left: auto;
margin-right: auto;
}
#whiteBox {
background-color: #FFFFFF;
width: 1000px;
height:2000px;
}
.nav ul{
color:#FFF;
height: 40px;
width:940px;
background-color:#333;
margin-left: auto;
margin-right: auto;
}
.nav ul li{
list-style: none;
display:inline;
width:188px;
height:40px;
text-align:center;
}
.nav ul li a{
text-decoration: none;
float: left;
color: #FFFFFF;
background-color: #333333;
width:188px;
height:40px;
}
.nav ul li a:hover{
background-color: #000000;
width:188px;
height:40px;
}
#navContainer{
width: 940px;
}
HTML CODE
<!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>Taranix Pty Ltd - 2010</title>
<link href="styles/styles.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="whiteContainer">
<div id="whiteBox">
<div id="navContainer">
<div class="nav">
<ul>
<li><a href="#">Home</a></li>
<li><a href="#">Services</a></li>
<li><a href="#">Blog</a></li>
<li><a href="#">Partners</a></li>
<li><a href="#">Contact</a></li>
</ul>
</div>
</div>
<div id="imageContainer">
asad
</div>
</div>
</div>
</body>
</html>
Here is a picture of my issue.
http://img176.imageshack.us/img176/9760/navigationalignmentissu.jpg
As you can see, the left of the navigation bar seems to almost have a padding of 20px or so (the black background behind home is the rollover).
Somehow it has that grey area on and left and a small white space on the right (which i presume is just numbers not matching up).
If anyone has any ideas on what I did wrong your help would be greatly appreciated.
Regards,
Mathew Hood