Jump to content

Floating problem in IE only


lemmin

Recommended Posts

I am trying to float a div on the left and one on the right with a content div in the middle. Everything works fine until I try to set a height for the content div. Here is the code:

<html>
<head>
<style>
#content
{
   background-color:blue;
   border: 2px solid black;
}
#left
{
   background-color:red;
   width:28px;
   height:420px;
   float:left;
}
#right
{
   background-color:green;
   width:14px;
   height:247px;
   float:right;
}
</style>
</head>
<body>
<div id="left"></div>
<div id="right"></div>
<div id="content">Content in here</div>
</body>
</html>

 

If you paste that code into an html document and view it, you will see it working how I want it. However, place a height:420px into the #content style and that div magically gains margins on the left and right. I've tried killing any inherent margins and padding on everything, but that extra space doesn't seem to exist in the styles anywhere.

 

All I am trying to do is get a "min-height" on the content div and, although IE doesn't support that style, "height" effectively works the same. I am using a work-around where the height only gets sets in IE and all other browsers get a min-height. If there is a different way I can do this, that would help too.

 

Thank you.

Link to comment
Share on other sites

I'm actually using IE8 Beta Version 8.0.6001.18241. MSDN Library shows that min-height and min-width are legal in IE, but they don't work in this version at least.

 

I have tried all the different display types, but none fix this problem.

 

Thanks for the help.

Link to comment
Share on other sites

  • 2 weeks later...

I personally havn't validated them, I wouldn't really know what validation type to use. I used the xhtml validation once but it gave 'problems' with the closer for the </head> and the </body> and stuff like that...

 

I'm not the starter of this topic, I'm using the normal versio of IE8. Yet I get all the problems they had n IE6 and I don't understand why. Anyhow, it's better like this, at least I can 'test' it for IE6. I've still got many problems with the site-layout that work perfect in Chrome, Safari, FF, Opera, but not in IE8.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.