AgentRiot
08-23-2007, 10:27 AM
I've been trying to layout a header section of a website, trying to duplicate the original look, but in CSS rather than tables.
I want to have a logo image in the left hand corner (spanning the height of the header), and to the right of the image (horizontally centred in the remaining width of the header) a bar of links that remains at the bottom of the header and the title of the site centred vertically in what remains above the link bar.
Here's what I've come up with so far:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Header Test</title>
<link rel="stylesheet" type="text/css" href="css/HeaderStyle.css" />
</head>
<body>
<div id="header">
<img class="logo" src="images/logo.jpg" alt="logo" />
<h2>Website Title Goes Here</h2>
<ul id="topNav">
<li>link 1</li>
<li>link 2</li>
<li>link 3</li>
<li>link 4</li>
<li>link 5</li>
</ul>
</div>
</body>
</html>
html, body
{
height: 100%;
width: 100%;
padding: 0;
margin: 0;
}
#header
{
height: 84px;
margin: 0 10%;
background-color: #BFA17F;
}
#header h2
{
padding: 0;
margin: 0;
text-align: center;
}
img.logo
{
float: left;
}
#topNav
{
background-color: yellow;
text-align: center;
padding: 0;
}
#topNav li
{
list-style: none;
display: inline;
}
The image's dimensions are 159px X 84px.
Attached below is a screenshot of what it looks like to me now in Firefox. So, basically, I would like to move that yellow link section down to the bottom of the header and have the "Website title goes here" section to be vertically centred in the brown area above the links.
I've tried playing around with this, but can't quite pull off the desired effect (at least not without using code which feels sloppy to me). I'm not sure if I need more divs or less divs. Can anyone suggest what I should do, or suggest a better way to go about this?
I want to have a logo image in the left hand corner (spanning the height of the header), and to the right of the image (horizontally centred in the remaining width of the header) a bar of links that remains at the bottom of the header and the title of the site centred vertically in what remains above the link bar.
Here's what I've come up with so far:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Header Test</title>
<link rel="stylesheet" type="text/css" href="css/HeaderStyle.css" />
</head>
<body>
<div id="header">
<img class="logo" src="images/logo.jpg" alt="logo" />
<h2>Website Title Goes Here</h2>
<ul id="topNav">
<li>link 1</li>
<li>link 2</li>
<li>link 3</li>
<li>link 4</li>
<li>link 5</li>
</ul>
</div>
</body>
</html>
html, body
{
height: 100%;
width: 100%;
padding: 0;
margin: 0;
}
#header
{
height: 84px;
margin: 0 10%;
background-color: #BFA17F;
}
#header h2
{
padding: 0;
margin: 0;
text-align: center;
}
img.logo
{
float: left;
}
#topNav
{
background-color: yellow;
text-align: center;
padding: 0;
}
#topNav li
{
list-style: none;
display: inline;
}
The image's dimensions are 159px X 84px.
Attached below is a screenshot of what it looks like to me now in Firefox. So, basically, I would like to move that yellow link section down to the bottom of the header and have the "Website title goes here" section to be vertically centred in the brown area above the links.
I've tried playing around with this, but can't quite pull off the desired effect (at least not without using code which feels sloppy to me). I'm not sure if I need more divs or less divs. Can anyone suggest what I should do, or suggest a better way to go about this?