Home > Web Front-end > HTML Tutorial > Regarding float generation block-level boxes. _html/css_WEB-ITnose

Regarding float generation block-level boxes. _html/css_WEB-ITnose

WBOY
Release: 2016-06-24 12:22:06
Original
1491 people have browsed it

CSS HTML W3C

It is defined in w3c that elements using float will generate block-level boxes. Isn’t the block level just a line break?
Then why does the div after a div set with float:left follow directly without wrapping? What exactly does this mean?




God, look at this picture.

  #side        {            height: 192px;            float:left;        }        #main        {            height:200px;            background-color: Aqua;             width:600px;                     }
Copy after login

----------------------------------------- --------------------------------------------------

 <div id="side">        <img src="../images/dl.gif" width="192" height="142" alt="" /></div>    <div id="main">        </div>
Copy after login






Why is the blue part filled to the left. Who is it aligned to? I know that the height of main is greater than side. . .

Please give me some advice.

Reply to discussion (solution)

You can refer to this link http://paranimage.com/css-float-attribute/

Block level is not Is it just a line change?
Wrong! Block level means no line breaks

Well, the correct answer upstairs is that float will make the tags break away from the normal flow
If it is good, it is good, but if it is not good, it is not recommended...


You can refer to this link http://paranimage.com/css-float-attribute/

Isn’t the block level just a line break?
Wrong! Block level means no line breaks
Could you please tell me, do block-level boxes and block-level elements have different properties?

For block level, if the sum of the width of the subsequent div and the width of the current div is greater than 100%
it will automatically wrap. Look at your width

I read an article , it is explained that float means that the height of the element does not stretch the parent element, that is, it is ignored when calculating the row height. If all the elements inside the parent element are float, the parent element will collapse to a height of 0. But on the horizontal line, for floats with left and right, they will be floated left and right, but they will not completely break away from the document flow. The occupied position is still there, unlike absolute, which is completely separated from the document flow.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template