PDA

View Full Version : Layout help.



Swinkid
14-11-2009, 06:03 PM
Hey guys,

I got this problem with my layout:
http://img689.imageshack.us/img689/5056/layouthelp.png
(the rollovers keep going to next line isnted of lining up by eachother.)

How do i fix it??

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=iso-8859-1" />
<LINK REL=stylesheet HREF="style.css" TYPE="text/css" />
<title>Untitled Document</title>
</head>
<body>
<div id="topbar"></div>
<div id="banner"></div>
<div id="botbar"><a class="link_rollover" href="#">Home</a><a class="link_rollover" href="#">Home</a></div>
<div align="center"><div id="content">text</div></div>
</body>
</html>


CSS:

Body {
margin: 0px;
background: #E0E0E0;
font-family: Verdana, Arial, Helvetica, sans-serif;
}
#topbar {
height: 32px;
width: 100%;
background: #404040;
border-top: 1px solid #B7B7B7;
border-bottom: 1px solid #B7B7B7;
border-left: 1px solid #B7B7B7;
border-right: 1px solid #B7B7B7;
}
#banner {
height: 32px;
width: 100%;
background: #FFFFFF;
border-left: 1px solid #B7B7B7;
border-right: 1px solid #B7B7B7;
}
#botbar {
height: 32px;
width: 100%;
background: #404040;
border-top: 1px solid #B7B7B7;
border-bottom: 1px solid #B7B7B7;
border-left: 1px solid #B7B7B7;
border-right: 1px solid #B7B7B7;
padding-left: 10px;
margin-bottom: 10px;
}
#content {
background: #FFFFFF;
width: 800px;
border: 1px solid #B7B7B7;
}
.link_rollover {
text-align: center;
display: block;
padding-top: 10px;
font-size: 11px;
color: #FFFFFF;
width: 78px;
height: 32px;
background: url("images/blank_nav.png") no-repeat 0 0;
}
.link_rollover:hover {
background: url("images/blank_rollover.png") no-repeat 0 0;
width: 78px;
text-align: center;
display: block;
height: 32px;
font-size: 11px;
color: #FFFFFF;
}

Apox
20-11-2009, 08:29 PM
You want a horizontal menu? Throw this in:


#botbar a {
float: left;
}

This takes the link elements and floats them, in this case to the left. However you're using an inline element ( the anchor tag ) and floats it's independently, you'd be better to wrap those elements in DIVs. So the class '#botbar a' becomes '#botbar div' and the links are <div><a></a></div>.

You will need to clear this float after the list of menu elements by using a cleaner class as such:



.cleaner {
clear: both;
}

With that in your style sheet add <div class="cleaner"></div> after the menu elements, this will stop things going all squiffy.

Swinkid
21-11-2009, 12:41 AM
Thanks, This sorted my problem.

Alex

Want to hide these adverts? Register an account for free!