Forum Moderators: not2easy
Here is some html:
<html>
<head>
<style>
.main {
background-image: url(images/design/main_slice.gif);
background-repeat: repeat-y;
padding: 0px;
width: 762px;
margin-right: auto;
margin-left: auto;
text-align: left;
margin-top: 0px;
margin-bottom: 0px;
}
#left {
margin: 0px;
padding: 0px 0px 0px 6px;
<!-- The padding left is to compensate for a shadow in main_slice.gif -->
width: 206px;
float: left;
background-color: #bbb;
}
#right {
margin: 0px 0px 0px 206px;
padding: 0px;
width: 550px;
background-color: #0000FF;
}
</style>
</head>
<body style="text-align: centre">
<div class="main">
<div id="left"> left column content</div>
<div id="right">some text here</div>
</div>
</body>
</html>
Anyone got any idea why this happens?
Thanks very much for your help.
because you have a width on the #right column this width is triggering IE's hasLayout problems and invoking it' quirky float model 3px gap, which is a common cause of floated layouts "breaking". Those 3px can cause lots of problems.
Not sure if this'll work for you but if you remove the width on that column it should help, the overall width of the container (#main) should keep it contained, also then the left margin should work properly. Then if you need a space on the right hand side (for another shadow?) you can use a right margin instead.
#right {
margin: 0px 6px 0px 212px; /* right margin for graphic clearance */
padding: 0px;
/*width: 550px;*/
background-color: #0000FF;
}
Not having a dimension on that column should help cure the 3px problem, but may then cause other internal problems in IE, these should be fixable too.. let us know
Suzy
That didn't work in FF - it just put #right under #left. It works in IE and at a quick glance it did take the 3px gap out as well, but its no good if it doesn't work in other browsers - I didn't think you had to put float right on a right column in a 2 column layout?
I still don't know much about tableless layouts. I think I just made this up as a I went along - maybe I should have a look for some guides - although i thought this 3px gap might be worth mentioning in this forum anyway.
You're right Suzy about the right shadow, but the 3px margin on the right didn't help, and taking the width off didn't take out the 3px gap on the left.
So I'm back to square 1 again, but thanks for your help anyway.
If you're using a "Quirks Mode" one (or not using one at all) this will mean IE is staying in quirks mode (even without width trigger) which will mean it's more difficult to deal with the 3px Jog..
e.g. try this at the very start of the page:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
Using a Doctype to set IE into "Strict" rendering mode will help with IE Box Model issues too..
Thanks for posting this, the 3px Jog is well known but the various fixes are dependant on internal page factors.. so if we can narrow them down we should be able to get this working for you.. :)
Suzy
I put that in at the top.
It made the #right div go into the correct position horizontally but now it is underneath the #left div in IE (although the 3px gap is now gone).
Still looks correct in FF.
I'll give you some more of my CSS, and some that I may have changed, having read some tutorials:
body {
background-image: url(images/design/body.gif);
margin: 0px;
padding: 0px;
text-align: center;
}
.main {
background-image: url(images/design/main_slice.gif);
background-repeat: repeat-y;
padding: 0px;
width: 762px;
margin-right: auto;
margin-left: auto;
text-align: left;
margin-top: 0px;
margin-bottom: 0px;
}
<!-- main_slice.gif is a 762px slice - with 6px shadow on either side -->
#left {
margin: 0px;
padding: 0px 0px 0px 6px;
color: #FFFFFF;
width: 206px;
float: left;
display: inline;
}
#right {
margin: 0px 0px 0px 206px;
padding: 0px;
width: 550px;
background-color: #FF0000;
<!-- i made this red so I could see where the problem was -->
}
hr.cleaner {
clear:both;
height:1px;
margin: -1px 0 0 0; padding:0;
border:none;
visibility: hidden;
}
Thanks for your help.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
But without the url.
I cut and pasted the code from this forum thread and without realising it did not paste in the correct format so i replaced my correct one with one that didn't work. But anyway i've fixed that now and since re-designed my site (for about the 10th time - and it still has never been completed).
I'm still having this problem with the 3px gap. My css might be slightly different now so here it all is again:
body {
background-image: url(images/design/body.gif);
text-align: center;
margin: 0px;
padding: 0px;
}
.main {
background-image: url(images/newdesign/main_slice.gif);
background-repeat: repeat-y;
width: 762px;
margin-right: auto;
margin-left: auto;
text-align: left;
padding: 0px;
}
#left {
float: left;
width: 200px;
padding-left: 6px;
}
#right {
width: 550px;
margin-left: 206px;
}
hr.cleaner {
clear:both;
height:1px;
margin: -1px 0 0 0; padding:0;
border:none;
visibility: hidden;
}
Ayone got any suggestions why this gap is appearing- it is literally a gap - neither #left or #right are displaying larger than they should - there is just a 3px gap between them when viewed in IE.
Here is some html:
<div class="main">
<div id="left">
left content
</div>
<div id="right">right content</div>
<hr class="cleaner"/>
</div>
Thanks in advance for any help.
I read some online tutorials and looked at some examples and i can't see what i'm doing wrong.