/    Sign up×
Community /Pin to ProfileBookmark

IE6 Float problems

So I’ve been working on a layout that is giving me problems displaying correctly in IE6. It works perfectly in Firefox, IE7, and Safari. Basically I have a 3 column layout, with the left column being used for side navigation. However, when I use the “display: block” element, it is moving my left column to below the content level for my other two columns in IE6. The other browsers are perfect. If I remove the “display: block” element, it lines up correctly with the other two, so I’m assuming that’s where the problem is.

I have pasted the code below. Please note that there are styles below that are probably not needed for my example. This code is more of a bare-bones look at a much larger page.

Thank you for any help!

[code=html]
<!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>
<meta http-equiv=”Content-Type” content=”text/html; charset=iso-8859-1″ />
<title>None</title>
<style>

html, body {
margin: 10px;
padding: 0px;
background-color: #046D87;
font-family: Tahoma, Arial, Helvetica, sans-serif;
font-size: 12px;
color: #004185;
}

p {
padding: 0px;
margin: 0px;
color: #004185;
}

h2 {
font-size: 16px;
color: #004185;
margin: 0px 0px 1.0em;
position: relative;
font-weight: bold;
line-height: 2em;
}

/********** Layout **********/

#container {
background-color: #FFFFFF;
width: 970px;
margin-left: auto;
margin-right: auto;
position: relative;
}

#center {
background: #FFFFFF;
background-image: url(../images/content.gif);
background-repeat: no-repeat;
background-position: top;
min-height: 515px;
height: auto !important;
height: 515px;
position: relative;
}

#leftnav ul {
list-style: none;
margin: 0;
padding: 0;
}

#leftnav {
margin: 0 770px 0 10px;
position: relative;
border-style: solid solid none solid;
border-color: #0067EB;
border-size: 1px;
border-width: 1px;
}

#leftnav-top {
border: none;
color: #000000;
background-image: url(../images/navboxtop.gif);
background-position: top;
background-repeat: no-repeat;
height: 8px;
margin-left: 10px;
}

#leftnav-content {
padding: 0 10px 10px 10px;
border: none;
color: #000000;
background-image: url(../images/navboxbottom.gif);
background-position: bottom;
margin-left: 10px;
}

#content {
float: right;
width: 770px;
position: relative;
}

#rightnav {
margin-left: 570px;
position: relative;
}

#rightnav-top {
border: none;
color: #000000;
background-image: url(../images/navboxtop.gif);
background-position: top;
background-repeat: no-repeat;
height: 8px;
margin-right: 10px;
}

#rightmain-top {
border: none;
color: #000000;
background-image: url(../images/features.gif);
background-position: top;
background-repeat: no-repeat;
height: 27px;
margin-right: 10px;
}

#rightnav-content {
padding: 10px;
border: none;
color: #000000;
background-image: url(../images/navboxbottom.gif);
background-position: bottom;
margin-right: 10px;
}

#main {
float: left;
width: 570px;
position: relative;
}

#main-top {
border: none;
background-image: url(../images/mainboxtop.gif);
background-position: top;
background-repeat: no-repeat;
height: 8px;
margin-left: 10px;
margin-right: 10px;
}

#main-content {
padding: 0 20px 20px 20px;
border: none;
background-image: url(../images/mainboxbottom.gif);
background-position: bottom;
color: #000000;
margin-left: 10px;
margin-right: 10px;
min-height: 350px;
height: auto !important;
height: 350px;
}

#main-2col {
float: left;
width: 770px;
position: relative;
}

#main-2col-top {
border: none;
background-image: url(../images/main2coltop.gif);
background-position: top;
background-repeat: no-repeat;
height: 8px;
margin-left: 10px;
margin-right: 10px;
}

#main-2col-content {
padding: 0 10px 10px 10px;
border: none;
background-image: url(../images/main2colbottom.gif);
background-position: bottom;
color: #000000;
margin-left: 10px;
margin-right: 10px;
min-height: 350px;
height: auto !important;
height: 350px;
}

#main-2boxes {
border: none;
margin-left: 10px;
margin-right: 10px;
}

#main-left {
float: left;
border: none;
width: 265px;
}

#main-left-top {
border: none;
background-image: url(../images/main2boxtop.gif);
background-repeat: no-repeat;
background-position: top;
height: 8px;
}

#main-left-bottom {
border: none;
background-image: url(../images/main2boxbottom.gif);
background-position: bottom;
padding: 0 10px 10px 10px;
}

#main-right {
float: right;
border: none;
width: 265px;
}

#main-right-top {
border: none;
background-image: url(../images/main2boxtop.gif);
background-repeat: no-repeat;
background-position: top;
height: 8px;
}

#main-right-bottom {
border: none;
background-image: url(../images/main2boxbottom.gif);
background-position: bottom;
padding: 0 10px 10px 10px;
}

/********** Fonts **********/

a:link, a:visited, a:active {
color: #004185;
text-decoration: underline;
}

a:hover {
color: #046D87;
text-decoration: none;
}

.leftnavheader {
color: #FFFFFF;
}

a.leftnavheader:link, a.leftnavheader:active, a.leftnavheader:visited {
width: 168px;
display: block;
border-bottom: 1px solid #0067EB;
text-decoration: none;
text-align: center;
color: #FFFFFF;
font-weight: bold;
padding: 10px;
background: #0067EB;
}

a.leftnavheader:hover {
background: #A9EAFD;
color: #FFFFFF;
text-decoration: none;
font-weight: bold;
}

a.leftnavmenu:link, a.leftnavmenu:active, a.leftnavmenu:visited {
width: 168px;
display: block;
border-bottom: 1px solid #0067EB;
text-decoration: none;
color: #046D87;
font-weight: bold;
padding: 10px;
background: #FFFFFF;
}

a.leftnavmenu:hover {
background: #C9E5DA;
color: #046D87;
text-decoration: none;
font-weight: bold;
}

.leftnavactive, a.leftnavactive {
width: 168px;
display: block;
border-bottom: 1px solid #0067EB;
text-decoration: none;
color: #046D87;
font-weight: bold;
padding: 10px;
background: #A9EAFD;
}

a.leftnavindent:link, a.leftnavindent:active, a.leftnavindent:visited {
width: 168px;
display: block;
border-bottom: 1px solid #0067EB;
text-decoration: none;
color: #046D87;
font-weight: bold;
padding: 10px 0 10px 20px;
background: #FFFFFF;
}

a.leftnavindent:hover {
background: #A9EAFD;
color: #046D87;
text-decoration: none;
font-weight: bold;
}

.leftnavindentactive, a.leftnavindentactive {
width: 168px;
display: block;
border-bottom: 1px solid #0067EB;
text-decoration: none;
color: #046D87;
font-weight: bold;
padding: 10px 0 10px 20px;
background: #A9EAFD;
}

#leftnav-top, #rightnav-top, #rightmain-top, #main-top, #main-2col-top, #main-left-top, #main-right-top
{
font-size: 1px;
line-height: 1;
}
</style>
</head>

<body>

<div id=”container”>

<div id=”center”>

<div id=”content”>
<div id=”main-2col”>
<div id=”main-2col-top”></div>
<div id=”main-2col-content”>
<h2>Header</h2>
<p>{Insert Text Here}</p>
<ul>
<li><a href=”#”>Item</a></li>
<li><a href=”#”>Item</a></li>
<li><a href=”#”>Item</a></li>
<li><a href=”#”>Item</a></li>
</ul>
</div>
</div>
</div>

<div id=”leftnav”>
<ul>
<li><a href=”” class=”leftnavheader”>Header</a></li>
<li><a href=”” class=”leftnavmenu”>Item 1</a></li>
<li><a href=”” class=”leftnavmenu”>Item 2</a></li>
<li><a href=”” class=”leftnavmenu”>Item 3</a></li>
<li><a href=”” class=”leftnavmenu”>Item 4</a></li>
<li><a href=”” class=”leftnavindent”>Item 5</a></li>
</ul>
</div>

</div>

</div>

</body>
</html>
[/code]

to post a comment
CSS

2 Comments(s)

Copy linkTweet thisAlerts:
@CentauriNov 01.2007 — Float the #leftnav column (inline display is also required to avoid IE6's doubled float margin bug) :[CODE]#leftnav {
margin: 0 0 0 10px;
border-style: solid solid none solid;
border-color: #0067EB;
border-size: 1px;
border-width: 1px;
float: left;
display: inline;
}
[/CODE]
Copy linkTweet thisAlerts:
@superjoepsuauthorNov 01.2007 — Float the #leftnav column (inline display is also required to avoid IE6's doubled float margin bug) :[CODE]#leftnav {
margin: 0 0 0 10px;
border-style: solid solid none solid;
border-color: #0067EB;
border-size: 1px;
border-width: 1px;
float: left;
display: inline;
}
[/CODE]
[/QUOTE]


Thank you very much! Worked like a charm!
×

Success!

Help @superjoepsu spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...