Consider the following HTML code:
<div id="footer1">
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
</div>
<div id="footer2">
Lorem ipsum dolor sit amet, consectetur adipisicing elit
</div>
<div id="footer3">
Lorem ipsum dolor sit amet, consectetur
</div>
and its responding CSS:
body{
padding: 30px;
font-size: 0.9em;
line-height: 1.6em;
font-family: "Lucida Sans Unicode", "Lucida Grande", sans-serif;
background-color:#222;
}
#footer1{
float: left;
width: auto;
margin-top: 0;
margin-bottom: 50px;
margin-right: 10%;
margin-left: 10%;
color: #FFF;
text-align: justify;
border: thin dashed #DDDDDD;
}
#footer2{
float: none;
width: auto;
margin-top: 0;
margin-bottom: 50px;
margin-left: 2%;
margin-right: 2%;
color: #FFF;
}
#footer3{
float: none;
width: auto;
margin-bottom: 10px;
margin-left:12%;
margin-right:12%;
color: #FFF;
}
You may see the corresponding fiddle at http://jsfiddle.net/KnUfY/; however it is not illustrative enough as far as my question is concerned.
So, which is my question?
I've used Mozilla Firebug as to highlight the browser area which is occupied by each div. I found that #footer2
area(content with its margins) begins at the same place as if #footer1
did not exist. So far so good since #footer1
is considered to be out of flow.
My problem is: I thought #footer3
would behave like #footer2
, namely its area to begin not after #footer2
but to "include" #footer1
and #footer2
areas. In other words, #footer3
behaves like floating has been cleared; however how this clearance took place?
This was always one of my queries! When does floating 's influence end if we do not clear it with the classic methods(overflow:auto, clear, after,...)? Is it the case only the first div after float is influenced? The second automatically clears floating?
Thank you