--- floating text wrapping

<style type="text/css">
    .article {
        width: 500px;
        margin: 20px auto;
    }
    .article img:nth-of-type(odd){
        float: left;
        margin-right: 10px;
    }
     
    .article img:nth-of-type(even){
        float: right;
        margin-left: 10px;
    }
</style>

<body>
    <div class = "article" > 
        < img src = "http://img.ujian.cc/nice/35.jpg" alt = ""  /> 
        < p > Sed residents diseases of old age is sad and ugly netus et malesuada hunger and poverty . Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. I always want free football until the carrots. Aenean ultricies mi vitae est. Japan's largest real estate lion. </ P > 
        < img src = "http://img.ujian.cc/nice/36.jpg" alt = ""  /> 
        < p >Nutrition residents soccer sad old and ugly netus et malesuada hunger and poverty. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. I always want free football until the carrots. Aenean ultricies mi vitae est. Japan's largest real estate lion. </ P > 
        < img src = "http://img.ujian.cc/nice/38.jpg" alt = ""  /> 
        < p > Sed residents diseases of old age is sad and ugly netus et malesuada hunger and poverty. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. I always want free football until the carrots. Aenean ultricies mi vitae est. Japan's largest real estate lion. <
        </div>
</body>

The effect is as:

Then puzzling, since the block itself img element row, both massive elements and inner row elements "qualities", but the p element immediately behind the block-shaped element will be disengaged when the standard document floating img flow, then the p element moves up, according to the text of the experience and will be a part of img overlap (imagine the elements after the float is floating above the document flow), but did not overlap.
 
Text reasons may surround the picture as follows:
From the document flow, that is, away from the common elements of layout and typography, the other boxes in the positioning of the time, and will be positioned as an element from the document flow does not exist. Note that when using float out of the document flow, the box will ignore the other elements, but in other text box will still make a position for this element surrounds. For use absolute positioning of elements from the document flow, the other in the other box with text boxes will ignore it.

 

Original: https://www.cnblogs.com/zm-2010/p/5656063.html

Guess you like

Origin www.cnblogs.com/xjy20170907/p/11579848.html