floating div tag problem! |
floating div tag problem! |
kyle246 |
Apr 22 2011, 07:58 PM
Post
#1
|
Member Group: Members Posts: 57 Joined: 29-January 11 Member No.: 13,738 |
Hello. I do not know why it is not working.
I have two floating div tags ("#maincontent #insidemaincontent #floatleft" and "#maincontent #insidemaincontent #floatright") that are inside another div tag (#maincontent #insidemaincontent) When I set the heights or put anything in the floating div tags, they do not expand the div tag that they are in (#maincontent #insidemaincontent) I can't understand why it is not working. Here is the link http://thundertutorials.com/tutorials.html thx, kyle |
pandy |
Apr 22 2011, 08:39 PM
Post
#2
|
🌟Computer says no🌟 Group: WDG Moderators Posts: 20,732 Joined: 9-August 06 Member No.: 6 |
Because floats aren't in the normal flow they don't add to the width or height of their parent element. If there isn't room for them they stick out. Give the parent div a background color or a border and you can see this. If you want the parent div to contain the floats you need to clear them.
http://css-discuss.incutio.com/wiki/Clearing_Space |
kyle246 |
Apr 22 2011, 08:48 PM
Post
#3
|
Member Group: Members Posts: 57 Joined: 29-January 11 Member No.: 13,738 |
Because floats aren't in the normal flow they don't add to the width or height of their parent element. If there isn't room for them they stick out. Give the parent div a background color or a border and you can see this. If you want the parent div to contain the floats you need to clear them. http://css-discuss.incutio.com/wiki/Clearing_Space okay thanks |
Mobilize Studios |
Apr 22 2011, 09:29 PM
Post
#4
|
Group: Members Posts: 1 Joined: 22-April 11 Member No.: 14,389 |
I would recommend a tool called ClearFix ( found here ). It works a lot better than clearing elements that traditional way. To use it, simply apply a class of
CODE .clearfix to the container element. In your case, this would be #insidemaincontent. Hope this helps! |
pandy |
Apr 22 2011, 09:57 PM
Post
#5
|
🌟Computer says no🌟 Group: WDG Moderators Posts: 20,732 Joined: 9-August 06 Member No.: 6 |
It's Option 2 at the page I linked to.
|
Lo-Fi Version | Time is now: 26th April 2024 - 07:54 PM |