By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,692 Members | 1,465 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,692 IT Pros & Developers. It's quick & easy.

Firefox Division Extend

P: 145
Okay basicly, I have a division inside a division.
<div id="container">
<div id="header">Main image</div>
and I want the container to grow as the the div's inside it are added. But for some reason it only grows if I add characters into it.(note this happens in FF, works fine in ie)
<div id="container">
<div id="header">Main image</div>
CSS code:
Expand|Select|Wrap|Line Numbers
  1. html{
  2.     margin: 0 auto;
  3.     width:100%;
  4.     overflow: -moz-scrollbars-vertical;
  5. }
  6. body{
  7.     margin: 0 auto;
  8.     width:100%;
  9. }
  10. #container{
  11.     margin: 0 auto;
  12.     padding:0;
  13.     width: 970px;
  14. }
  15. #header{
  16.      float:left;
  17.      height:100px;
  18.     width: 960px;    
  19.     margin:0 5px;
  20. }
It will grow by itself in IE, which is what I want however it wont by itself in FF :(
help please
May 22 '08 #1
Share this Question
Share on Google+
2 Replies

Expert 5K+
P: 7,435
This is a bug in IE. Firefox is performing correctly. Parent elements are never to expand to contain floated elements. To get Firefox to do what IE is mistakenly doing, add overflow:auto to the parent element.

When the two browsers do things differently, always know IE is almost always the one doing something wrong.
May 22 '08 #2

P: 145
yeh I have learnt that it is normally IE doing the wrong thing, but just from my observed point of view IE was doin what I wanted it to, even if it was wrong code-wise.
May 22 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.