This link has been bookmarked by 55 people . It was first bookmarked on 02 Mar 2006, by someone privately.
-
20 Dec 11
-
09 Nov 11
-
18 Oct 11
-
05 Oct 11
-
31 May 11
-
So when in the name of all that's good and right would authors want floats to stick out of their containing elements? Simple: in what is historically the most common case for float use. Consider Figure 2, and the basic markup structure that produced it.
Figure 2. Floating an image, flowing the text. <p> ...text... <img src="jul31-03-sm.jpg" height="200" border="0" class="picture"> ...text... </p> <p> ...text... </p>
-
We need only insert a block-level element just before the end of the container, and clear it. Consider:
<div class="item"> <img src="w6144.gif"> Widget 6144 <br>$39.95 <hr> </div> <div class="item"> <img src="w6145.gif"> Widget 6145 <br>$44.95 <hr> </div>
Now we apply the following rules to the preceding markup, and get the result shown in Figure 5.
div.item hr {display: block; clear: left; margin: -0.66em 0; visibility: hidden;} -
By ensuring that the
hrelements are block-level, part of the normal flow, and cleared, we force thedivs to "stretch around" the left-floated images.The negative top and bottom margins have the general effect of closing up the space that the
hroccupies. However, this effect is not precise, and not necessarily identical across browsers. -
where a precise clearing effect is needed, authors can use a
divinstead of anhr -
div.clearer {clear: left; line-height: 0; height: 0;} <div class="item"> <img src="w6144.gif"> Widget 6144 <br>$39.95 <div class="clearer"> </div> </div>
-
-
28 Apr 11
-
29 Mar 11
-
20 Mar 11
-
13 Mar 11
-
11 Mar 11
-
11 Dec 10
-
18 Nov 10
-
21 Oct 10
-
07 Sep 10
-
30 Apr 09
-
16 Apr 09
-
30 Jan 09
-
22 Jan 09
-
09 Jan 09
-
05 May 08
-
29 Apr 08
-
14 Oct 07
-
24 Sep 07
-
25 Apr 07
-
31 May 06
-
27 Mar 06
-
01 Jan 06
-
28 Oct 05
-
25 Sep 05
-
01 Sep 05
-
18 Jul 05
-
28 Nov 04
-
23 Nov 04
Would you like to comment?
Join Diigo for a free account, or sign in if you are already a member.