I’m using a three column layout that is created by nesting three divs (leftcolumn, right column, centre) in a container div. The left/right columns only provide a decorative border using a background image, but in IE the right column disappears - presumably floating right off into the ether. Any ideas on how to bring it back?
I’ve tried all sorts of recommendations to sort this out but I’m really fumbling in the dark as this is my first build, so, any help would be great! Thanks in advance
I’d do what Erik said above and also do way with the container div as you don’t seem to be using it for anything important. I would also change the name of those other divs because they aren’t really left or right elements.
<!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" dir="ltr" lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Joseph Peter Singh - Portrait and Wedding Photography</title>
<link rel="stylesheet" href="testcss2.css" type="text/css" media="screen" />
<style type="text/css">
body {
margin: 0;
padding: 0;
}
.banner {
width: 100%;
min-width:800px;
}
#header {
width:100%;
height:auto;
margin:0px;
}
#container {
width:100%;
background:url('http://samcampsall.chrisfulton.co.uk/JoeSingh/leftcolumn.png') repeat-y;
}
#inner {
width:100%;
background:url('http://samcampsall.chrisfulton.co.uk/JoeSingh/rightcolumn.png') repeat-y right 50%;
}
#main {
text-align:left;
font-family:Arial, Helvetica, sans-serif;
font-size:medium;
font-style:normal;
color:#603913;
padding:0 93px;
min-width:589px;
min-height:457px;
}
#footer {
bottom:0px;
width:100%;
height:auto;
margin:0px;
clear:both;
}
.imageSlideshowHolder {
margin:5px; /* "Air" */
width:151px; /* Image width */
height:100px; /* Image height */
position:relative; /* Don't remove this line */
}
.imageSlideshowHolder img {
position:absolute;
left:0px;
top:0px;
}
</style>
</head>
<body>
<div id="header"><img class="banner" src="http://samcampsall.chrisfulton.co.uk/JoeSingh/header.png"/><img class="banner" src="http://samcampsall.chrisfulton.co.uk/JoeSingh/menubar.png"/></div>
<div id="container">
<div id="inner">
<div id="main">
<p>This is Lorem ipsum text This is Lorem ipsum textThis is Lorem ipsum textThis is Lorem ipsum textThis is Lorem ipsum textThis is Lorem ipsum textThis is Lorem ipsum textThis is Lorem ipsum textThis is Lorem ipsum textThis is Lorem ipsum textThis is Lorem ipsum textThis is Lorem ipsum textThis is Lorem ipsum textThis is Lorem ipsum textThis is Lorem ipsum textThis is Lorem ipsum textThis is Lorem ipsum textThis is Lorem ipsum textThis is Lorem ipsum textThis is Lorem ipsum textThis is Lorem ipsum textThis is Lorem ipsum textThis is Lorem ipsum textThis is Lorem ipsum text</p>
<p>This is Lorem ipsum text This is Lorem ipsum textThis is Lorem ipsum textThis is Lorem ipsum textThis is Lorem ipsum textThis is Lorem ipsum textThis is Lorem ipsum textThis is Lorem ipsum textThis is Lorem ipsum textThis is Lorem ipsum textThis is Lorem ipsum textThis is Lorem ipsum textThis is Lorem ipsum textThis is Lorem ipsum textThis is Lorem ipsum textThis is Lorem ipsum textThis is Lorem ipsum textThis is Lorem ipsum textThis is Lorem ipsum textThis is Lorem ipsum textThis is Lorem ipsum textThis is Lorem ipsum textThis is Lorem ipsum textThis is Lorem ipsum text</p>
<p>This is Lorem ipsum text This is Lorem ipsum textThis is Lorem ipsum textThis is Lorem ipsum textThis is Lorem ipsum textThis is Lorem ipsum textThis is Lorem ipsum textThis is Lorem ipsum textThis is Lorem ipsum textThis is Lorem ipsum textThis is Lorem ipsum textThis is Lorem ipsum textThis is Lorem ipsum textThis is Lorem ipsum textThis is Lorem ipsum textThis is Lorem ipsum textThis is Lorem ipsum textThis is Lorem ipsum textThis is Lorem ipsum textThis is Lorem ipsum textThis is Lorem ipsum textThis is Lorem ipsum textThis is Lorem ipsum textThis is Lorem ipsum text</p>
<p>This is Lorem ipsum text This is Lorem ipsum textThis is Lorem ipsum textThis is Lorem ipsum textThis is Lorem ipsum textThis is Lorem ipsum textThis is Lorem ipsum textThis is Lorem ipsum textThis is Lorem ipsum textThis is Lorem ipsum textThis is Lorem ipsum textThis is Lorem ipsum textThis is Lorem ipsum textThis is Lorem ipsum textThis is Lorem ipsum textThis is Lorem ipsum textThis is Lorem ipsum textThis is Lorem ipsum textThis is Lorem ipsum textThis is Lorem ipsum textThis is Lorem ipsum textThis is Lorem ipsum textThis is Lorem ipsum textThis is Lorem ipsum text</p>
<p>This is Lorem ipsum text This is Lorem ipsum textThis is Lorem ipsum textThis is Lorem ipsum textThis is Lorem ipsum textThis is Lorem ipsum textThis is Lorem ipsum textThis is Lorem ipsum textThis is Lorem ipsum textThis is Lorem ipsum textThis is Lorem ipsum textThis is Lorem ipsum textThis is Lorem ipsum textThis is Lorem ipsum textThis is Lorem ipsum textThis is Lorem ipsum textThis is Lorem ipsum textThis is Lorem ipsum textThis is Lorem ipsum textThis is Lorem ipsum textThis is Lorem ipsum textThis is Lorem ipsum textThis is Lorem ipsum textThis is Lorem ipsum text</p>
</div>
</div>
</div>
<div id="footer"><img class="banner" src="http://samcampsall.chrisfulton.co.uk/JoeSingh/contactfooter.png"/></div>
</body>
</html>
Note that you have a BOM (byte order mark) saved in your css file:
[B][/B]body {
margin: 0;
padding: 0;
}
That could upset some browsers and indeed does break firefox when viewed locally. Set you editor not to output the BOM for css files.
Should have mentioned that IE6 doesn’t know min-width or min-height and given a work around.
Taking Paul’s code as example. A work around for this could be to place a width keeper in the center/main div and set a height for IE6 only that will work the same as min-height in IE6 if the overflow is not set or set to visible.
E.g.:
#ie6minwidth{
width:589px; /* margin/padding also counts */
height:0;
overflow:hidden; /* = IE6 keeps the height as set */
}
* html #main{
height:457px;
overflow:visible; /* = in IE6 content will expand the set height */
}
First thanks all for your replies
CSU-Bill - I’m not sure that would fix my issue and it would undo the stretching of my ‘borders’ down each side of the page, but thank you!
Erik and Paul - Thanks a bunch for your suggestions -I’ve implemented most of them and they have certainly lightened my CSS markup (most of which had been thrown in trying to make the stretchy borders).
This is what I’ve got now:
CSS
body {
margin: 0;
padding: 0;
}
.banner {
width: 100%;
min-width:775px;
}
#header {
width:100%;
height:auto;
margin:0px;
}
#ie6minwidth{
width:589px; /* margin/padding also counts */
height:0;
overflow:hidden; /* = IE6 keeps the height as set */
}
* html #center{
height:457px;
overflow:visible; /* = in IE6 content will expand the set height */
}
#leftcolumn{
width:100%;
background:url url('../images/leftcolumn.png') repeat-y;
}
#rightcolumn {
width:100%;
background:url url('../images/rightcolumn.png') repeat-y right 50%;
}
#center {
text-align:left;
font-family:Arial, Helvetica, sans-serif;
font-size:medium;
font-style:normal;
color:#603913;
padding:0 93px;
min-width:589px;
min-height:457px;
}
#footer {
bottom:0px;
width:100%;
margin:0px;
height: auto;
clear:both;
}
With the HTML thus (Paul - I’ve chucked the ‘Container’ DIV - it was a relic of the past few weeks on and off tinkering. I’ve kept the names so I didn’t get too confused):
It looks good in FF, Chrome and Opera but in IE the right column image is floating off to the right of the page and I have to scroll over to find it, which is definitely a step up from it not existing at all!
I really appreciate your time and your thoughts, but have I not implemented or understood your suggestions properly?
Thanks for any further pointers
I wouldn’t actually bother with the ie6 minwidth div though as it doesn’t really create a min-width but just holds the middle open. All the content inside the middle will still shrink down and so will the header and footer leaving everything adrift.
If you really want minwidth in ie6 then steal the Js routine from here and apply it to the main wrapper.
I’ve got it working now using your (numerous and somewhat humbling!) alterations to my (crippled and clearly rubbish!) code.
Thank you both so so much!
I’l try and post a link later on. As you can probably tell I’m very new at this, so a feel a bit of a cheat that you’ve essentially re-written all my code! It’s quite a learning curve as to just how broken IE is though, I’m kindof amazed.
One last question (for this thread at least) - with my IE stylesheet as it is if I shrink the browser window the header shrinks right along with it (the main div stops at 775px ;)).
How should I make the header stop there too? I thought that adding the IE min width div inside the header div would work, but it doesn’t
This is stupid but I’ve actually answered my own question already!
I know it looks very soon after my post, but I actually typed up my last message, didn’t post it, then spent ages looking for a fix, didn’t find one, posted the message and then found the fix!
OK - so using this method http://www.cssplay.co.uk/boxes/width2.html c/o Stu Nicholls.
I’ve implemented a slightly different min-width fix. It uses a tad more markup (adding phantom div’s) but I’m happier with the results. Using the initial fix from Erik my content was still getting squished, whereas this prevents that. I can’t say I’m entirely sure why!
Looks ok I think. The border min-width method you now have is the oldest, the margin method the newest afaik.
Why not wrap the whole page including header and footer in 1 min-width setup instead of one for each division?
But, if you want a “sticky footer” page of course the footer need its own set.
Paul had a quiz here that covers that. Scroll down to Quiz 24 and read how min-width can be done in IE6. … In another quiz you will find a solution for IE6 max-width too.
EDIT/
The initial fix I suggested was rubbish! The next I gave is the best working there is.
You’re not going to bill me once this thread is locked are you?!
I really really appreciate you sharing your expertise, so a massive heartfelt thank you!
Trust me to use the oldest method and add pointless markup. I’ve again taken on your suggestions implementing the margin method and adding just the one min width div - kinda obvious really
I think I should bow out gracefully at this point - stupid questions will no doubt abound in my next thread as I start adding a photo gallery etc (it’s a photography site after all!)
Now, any CSS ‘workarounds’ for the enormous tax bill I received this morning?..