I'm using a "Centred Header/Footer/2 column CSS" layout.
In test1.htm if their is minimal page content and the page footer is fully visible within the browser window then when you click on test2.htm the page content shifts to the left.
If test1.htm has enough content to push the footer off the bottom of the browser window then when you click on test2.htm the page content stays static.
Can anyone help with this css issue?
test1.htm
<!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>
<title></title>
<style type="text/css">
body, html
{
margin:0;
padding:0;
font-size: 1em;
font-family: Verdana, Arial, Helvetica, sans-serif;
}
#wrap
{
width:912px;
margin:0 auto;
background:Green;
}
#header
{
background-color:Gray;
height: 120px;
}
#leftColumn
{
float:left;
width:230px;
padding: 0 10px 10px 10px;
background:Red;
}
#rightColumn
{
float:right;
width:642px;
padding:10px;
background:#fff;
font-size: 0.7em;
color: #828589;
}
#footer
{
clear:both;
padding:5px 10px;
background-color:Gray;
}
</style>
</head>
<body>
<div id="wrap">
<div id="header">
<div id="nav">
<a href="test1.htm">test1</a> <a href="test2.htm">test2</a>
</div>
</div>
<div id="leftColumn">
<p>
left column
</p>
<br /><br /><br /><br /><br /><br />
</div>
<div id="rightColumn">
<div id="PageContent">
<!-- START PAGE CONTENT -->
<h1>Page Title </h1>
<h4>"test 1 "</h4>
<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />
some words...
<!--
<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />
<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />
<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />
-->
<!-- END PAGE CONTENT -->
</div>
</div>
<div id="footer">
the footer
</div>
</div>
</body>
</html>
test2.htm
<!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>
<title></title>
<style type="text/css">
body, html
{
margin:0;
padding:0;
font-size: 1em;
font-family: Verdana, Arial, Helvetica, sans-serif;
}
#wrap
{
width:912px;
margin:0 auto;
background:Green;
}
#header
{
background-color:Gray;
height: 120px;
}
#leftColumn
{
float:left;
width:230px;
padding: 0 10px 10px 10px;
background:Red;
}
#rightColumn
{
float:right;
width:642px;
padding:10px;
background:#fff;
font-size: 0.7em;
color: #828589;
}
#footer
{
clear:both;
padding:5px 10px;
background-color:Gray;
}
* html #footer {
height:1px;
}
</style>
</head>
<body>
<div id="wrap">
<div id="header">
<div id="nav">
<a href="test1.htm">test1</a> <a href="test2.htm">test2</a>
</div>
</div>
<div id="leftColumn">
<p>
left column
</p>
<br /><br /><br /><br /><br /><br />
</div>
<div id="rightColumn">
<div id="PageContent">
<!-- START PAGE CONTENT -->
<h1>Page Title </h1>
<h4>"test 2 "</h4>
<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />
some words...
<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />
some words...
<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />
<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />
<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />
<!-- END PAGE CONTENT -->
</div>
</div>
<div id="footer">
the footer
</div>
</div>
</body>
</html>
It sounds like the first page is short enough to be displayed without scroll bars, while the second page is not.
A scroll bar takes up space, so the canvas is narrower, so the centre of the canvas is further away from the scrollbar.
The solutions are either to use overflow to display a scrollbar all the time (I wouldn't suggest this, it affords scrolling when scrolling can't happen) or use a left aligned design (like the majority of the WWW)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With