Float problem of Adaptive layout

when reading the Great God"s tutorial, there is a question about the "self-floating method": the sidebar should be placed in front of the main column.

in my understanding, float is detached from the normal stream (document stream), so why is its order fixed? Just like absolute, should have nothing to do with normal flow.

modify the code (floating sidebars are arranged under main)

CSS Code:

html,body{margin:0;height:100%;}
-sharpmain{height:100%;margin:0 210px;background:-sharpFFE6B8;}
-sharpleft,-sharpright{width:200px;height:100%;background:-sharpA0B3D6;}
-sharpleft{float:left;}
-sharpright{float:right;}

HTML Code:

<div id="main"></div>    
        <div id="left"></div>
        <div id="right"></div>

tutorial links

Css
Mar.25,2021

the document stream is parsed from top to bottom, from left to right.
if you change the order layout, you change the parsing order.

Note: when you use float to detach from the document stream, other boxes will ignore this element, but the text in other boxes will still make room for this element and surround it. For elements that use absolute positioning to get out of the document stream, the text in other boxes and other boxes will ignore it.

HTML normal stream / document stream


Brother, 2009 article, please, take a look at the new technology


Last night, I also had my own understanding when consulting the data:
according to the default flow layout parsing method of ordinary streams, there is no space in the width, line of main first.
then set the "float" element. Here, I did not take into account the rendering order of ordinary streams: width is in front of float;
because width is in front, elements need to take up space, but there is no space in the previous line, so they will move to the next line.

-for more information, please see the link given by the Moon Shadow God-

some people may think, why not put float first?
because float is "wrapping", after setting float, the width of adaptive content will not work, and setting width will not work at this time.

Menu