I’m trying to layout a simple three-column header, but something’s not working quite right.
HTML (Ignore the horrible W3C uncompliance):
<html>
<body>
<div id="header">
<span id="left">Page Title</span>
<div id="center">Logged in as</div>
<span id="right"><a href="logout.php">Logout</a></span>
</div>
</body>
</html>
CSS:
#header {
padding: 6px;
background-color: #BBB;
}
#left {
float: left;
}
#center {
text-align: center;
}
#right {
float: right;
}
This almost works, except that #right drops down a line, and breaks the entire thing.
I’m not sure how to fix this, and I haven’t done much layout with floating, so bear with me.
Any thoughts?
Move the order of the elements. Have the floated right SPAN on top of the center DIV
Example here : http://jsfiddle.net/htxFJ/