Dev.Opera - Follow the standards, break the rulesDev.Opera - Follow the standards, break the rules

Login

Lost password?

Forums » Article Discussions

Discuss the articles posted on Dev.Opera.

Note: You need to login to post in the forums. if you don't have an account you first need to sign up.

By AutisticCuckoo anchor Friday, 26. September 2008, 06:37:26

35: Floats and clearing

Floats were originally created to allow you to float text beside images, and clearing serves as a way to get subsequent paragraphs to stop floating, if desired. However, these properties have been hijacked somewhat, and are now often used to create multiple column layouts. All of this is discussed in this article.

( Read the article )

By Oropher8598 anchor Friday, 26. September 2008, 11:43:23

avatar


Containing floats
As you’ve seen above, the parent box doesn’t normally expand to contain floated children.
[...]
Replace the last rule with this, then save and refresh:

#p1 {
overflow: hidden;
}
Note that [this] method doesn’t work in Internet Explorer 6 or older.


Actually this can be made to work in IE5 & IE6 too: all you have to do is declare a width.
#p1 {
overflow: hidden;
width: 100%;
}
I've used 100% as an example, but you can change that to suit your layout.

There's a more detailed explanation on Quirksmode.

By chrismills O anchor Monday, 29. September 2008, 05:50:26

avatar

Originally posted by Oropher8598:

Actually this can be made to work in IE5 & IE6 too: all you have to do is declare a width.



Thanks a lot for the tip!

By AutisticCuckoo anchor Monday, 29. September 2008, 06:14:18

avatarYes, it looks like another hasLayout issue. If the container has layout, then overflow:hidden works even in IE6. Setting a width isn't always possible, but any trick that makes the container have layout, such as zoom:1, will fix the bug.

By AndBre anchor Tuesday, 3. February 2009, 16:07:34

avatar1. "float:inheritis"
2. "clear:bothit"
3. "as sene in Figure 5"
4. "clear:bothon"

Moderators: pepelsbey | dstorey | mcx | operadev | chrismills | shwetankdixit | brucelawson | iheni | andreasbovens | zibin | mollydotcom