Forum Moderators: not2easy
(firefox) I'm trying to have 1 header and 1 footer on my page that goes all the way across (width: 100%, right?) and the page scroll up and down if need be. I dont know why but, I'm able to scroll left to right, and I dont want to.
(firefox) Under main I have two columns, sidenav and content. On IE 6 the columns display properly but on firefox the text wraps around over the side nav. I'm guessing firefox isnt detecting the height settings, maybe?
(IE 6) My footer is fine until I add more text. The more text I add, the further the footer is pushed down until eventually out of sight.
Here's my code:
<!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>Untitled</title>
<style type="text/css">
html, body { /* overflow: hidden; */ margin: 0; padding: 0; width: 100%; position: relative; }
#header { height: 160px; position: relative; top: 0; width: 100%; text-align: left; padding: 0 5%; color:#494242; font-size: 11px; line-height: 13px; font-family: arial, verdana, helvetica, sans-serif; font-variant: normal; font-style: normal; background-color: #F4F3F3; } */
#main { bottom: 20px; position: relative; left: 0; right: 0; top: 160px; }
#sidenav { height: 100%; background: #00f; float: left; width: 200px; }
#content { height: 100%; /* overflow: visible; */ }
#footer { height: 160px; position: relative; bottom: -10px; left: 0px; width: 100%; padding: 0px; margin: 0px auto; text-align: left; padding: 0 5%; padding-top: 20px; color:#494242; font-size: 11px; line-height: 13px; font-family: arial, verdana, helvetica, sans-serif; font-variant: normal; font-style: normal; background-image: url(images/footer.gif); background-position: 0px 0; background-repeat:no-repeat; background-color: #F4F3F3; }
</style>
<!--[if lt IE 7]>
<style type="text/css">
html { /* padding: 50px 0 20px; */ }
#main { bottom: auto; left: auto; right: auto; top: auto; height: 100%; position: static; }
</style> <![endif]-->
</head>
<body>
<div id="header">header</div>
<div id="main">
<div id="sidenav">sidenav</div>
<div id="content">
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Integer pretium dui sit amet felis. Integer sit amet diam. Phasellus ultrices viverra velit.</p>
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Integer pretium dui sit amet felis. Integer sit amet diam. Phasellus ultrices viverra velit. Nam mattis, arcu ut bibendum commodo, magna nisi tincidunt tortor, quis accumsan augue ipsum id lorem.</p>
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Integer pretium dui sit amet felis. Integer sit amet diam. Phasellus ultrices viverra velit.</p>
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Integer pretium dui sit amet felis. Integer sit amet diam. Phasellus ultrices viverra velit. Nam mattis, arcu ut bibendum commodo, magna nisi tincidunt tortor, quis accumsan augue ipsum id lorem.</p>
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Integer pretium dui sit amet felis. Integer sit amet diam. Phasellus ultrices viverra velit.</p>
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Integer pretium dui sit amet felis. Integer sit amet diam. Phasellus ultrices viverra velit. Nam mattis, arcu ut bibendum commodo, magna nisi tincidunt tortor, quis accumsan augue ipsum id lorem.</p>
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Integer pretium dui sit amet felis. Integer sit amet diam. Phasellus ultrices viverra velit. Nam mattis, arcu ut bibendum commodo, magna nisi tincidunt tortor, quis accumsan augue ipsum id lorem.</p>
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Integer pretium dui sit amet felis. Integer sit amet diam. Phasellus ultrices viverra velit.</p>
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Integer pretium dui sit amet felis. Integer sit amet diam. Phasellus ultrices viverra velit. Nam mattis, arcu ut bibendum commodo, magna nisi tincidunt tortor, quis accumsan augue ipsum id lorem.</p>
</div>
</div>
<div id="footer">
<a href="web_design_firm_information.htm">corporate info</a> ¦ <a href="design_portfolio.htm" class="subnavOn">portfolio</a> ¦ <a href="agency_solutions.htm">solutions</a> ¦ <a href="contact_web_design_firm.htm">contact us</a> ¦ <a href="index.htm">home</a><br>
All company names, product names logos included here may be registered trademarks or service<br>
marks of their respective owners.<br></br>
123 Main Street Charlotte NC 22222 - Call toll free +1.888.111.2222<br>
Copyright © 2006-<span id="insertYear">2006</span> <a href="web_design_firm_sitemap.htm">My Company Name</a>. All Rights Reserved. <br>
<a href="privacy_policy.htm">Privacy Policy</a>
</div>
</body>
</html>
I said I was working on this for two days, but sadly this has been an ongoing battle for weeks now, I just came back to it recently.
If anyone could point me in the right direction, I'd greatly appreciate it!
tlflow
Using “position: relative” with a zero value is the same as default positioning. Read about position:relative [w3schools.com] here. The following is your original code with some adjustments that now produce the desired effect.
html, body { /* overflow: hidden; */ margin: 0; padding: 0; }
#header { height: 160px; text-align: left; padding: 0 5%; color:#494242; font-size: 11px; line-height: 13px; font-family: arial, verdana, helvetica, sans-serif; font-variant: normal; font-style: normal; background-color: #F4F3F3; } */
#main { bottom: 20px; position: relative; left: 0; right: 0; top: 160px; }
#sidenav { height: 100%; background: #00f; float: left; width: 200px; }
#content { height: 100%; /* overflow: visible; */ }
#footer { height: 160px; bottom: -10px; padding: 0px; margin: 0px auto; text-align: left; padding: 0 5%; padding-top: 20px; color:#494242; font-size: 11px; line-height: 13px; font-family: arial, verdana, helvetica, sans-serif; font-variant: normal; font-style: normal; background-image: url(images/footer.gif); background-position: 0px 0; background-repeat:no-repeat; background-color: #F4F3F3; }
</style>
One point I will make is that you had an XHTML 1.0 STRICT DTD, but your markup was HTML? I noticed your BR tags were <br>, that's HTML. XHTML would be <br />. I've changed the DTD accordingly.
Your padding on footer was quite amusing. You had 'padding: 0;' (no padding), 'padding: 0 5%;' (0 top and bottom, 5% left and right), and 'padding-top: 20px' (padding 20px top). I decided it would be best to do 20px top and bottom, 5% left and right, it seemed like what you were trying to do.
I've also set the #header and #footer to use the same code to save space, and added an extra line for the footer image.
Here's the code, hope you have some good luck filling it in! ;)
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Untitled</title>
<style type="text/css">* { margin: 0; padding: 0; border: 0; }
#header, #footer {
height: 120px; padding: 20px 5%;
font-size: 11px; line-height: 13px;
font-family: arial, verdana, helvetica, sans-serif;
color: #494242;
background: gainsboro;
}#main { width: 100%; overflow: auto; }
#sidenav {
float: left;
width: 200px;
background: #00f;
}#content { margin-left: 200px; }
#footer { background: gainsboro url(images/footer.gif) no-repeat; }</style>
</head>
<body><div id="header">header</div>
<div id="main">
<div id="sidenav">sidenav</div>
<div id="content">
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Integer pretium dui sit amet felis. Integer sit amet diam. Phasellus ultrices viverra velit.</p>
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Integer pretium dui sit amet felis. Integer sit amet diam. Phasellus ultrices viverra velit. Nam mattis, arcu ut bibendum commodo, magna nisi tincidunt tortor, quis accumsan augue ipsum id lorem.</p>
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Integer pretium dui sit amet felis. Integer sit amet diam. Phasellus ultrices viverra velit.</p>
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Integer pretium dui sit amet felis. Integer sit amet diam. Phasellus ultrices viverra velit. Nam mattis, arcu ut bibendum commodo, magna nisi tincidunt tortor, quis accumsan augue ipsum id lorem.</p>
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Integer pretium dui sit amet felis. Integer sit amet diam. Phasellus ultrices viverra velit.</p>
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Integer pretium dui sit amet felis. Integer sit amet diam. Phasellus ultrices viverra velit. Nam mattis, arcu ut bibendum commodo, magna nisi tincidunt tortor, quis accumsan augue ipsum id lorem.</p>
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Integer pretium dui sit amet felis. Integer sit amet diam. Phasellus ultrices viverra velit. Nam mattis, arcu ut bibendum commodo, magna nisi tincidunt tortor, quis accumsan augue ipsum id lorem.</p>
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Integer pretium dui sit amet felis. Integer sit amet diam. Phasellus ultrices viverra velit.</p>
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Integer pretium dui sit amet felis. Integer sit amet diam. Phasellus ultrices viverra velit. Nam mattis, arcu ut bibendum commodo, magna nisi tincidunt tortor, quis accumsan augue ipsum id lorem.</p>
</div>
</div><div id="footer">
<a href="web_design_firm_information.htm">corporate info</a> ¦ <a href="design_portfolio.htm" class="subnavOn">portfolio</a> ¦ <a href="agency_solutions.htm">solutions</a> ¦ <a href="contact_web_design_firm.htm">contact us</a> ¦ <a href="index.htm">home</a><br>
All company names, product names logos included here may be registered trademarks or service<br>
marks of their respective owners.<br>
123 Main Street Charlotte NC 22222 - Call toll free +1.888.111.2222<br>
Copyright © 2006-<span id="insertYear">2006</span> <a href="web_design_firm_sitemap.htm">My Company Name</a>. All Rights Reserved. <br>
<a href="privacy_policy.htm">Privacy Policy</a>
</div></body>
</html>