Home > front end >  Floating about CSS in the clear
Floating about CSS in the clear

Time:10-25

Want to ask you, the clear: both say it's clear on both sides of the floating element influence on the current element, then how to judge its biggest influence which element???????

CodePudding user response:

I'm a newbie experience, floating is not easy to control, layui don't have to float the more professional, there are many ways to achieve the effect, such as absolute positioning, add window size change events absolute positioning adjustment value; Packed in div, sets the div to inline blocks, it can automatic left aligned arrangement; If there is right aligned with form can also be solved, the width of the 100%, left on the left side of form, form on the right side to align right, the window size changes, will form the adaptive adjustment

CodePudding user response:

Don't have to struggle so much, to remove the floating only when you take off the elements need placeholder would consider

//no placeholder, take off the
The floating element & lt;/div>

//placeholder, but still out of standard flow
The floating element & lt;/div>

Can also be removed by pseudo elements floating implementation

CodePudding user response:

Overflow: hidden
The back of the floating new added a label. The clear {clear: both}
Using pseudo variable such as: clearfix: before, clearfix: after {content: '; Display: table; }. Clearfix: after clear: both. Attach clearfix {* zoom: 1;/* here is for ie6, 7 the means of processing/}

CodePudding user response:

Add a clearfix to float the parent element
Clearfix: after {
content:""; (this is to set up a pseudo element is empty)
Height; 0;
display:block; (set the pseudo elements for block-level elements)
clear:both; (remove the element at the front of the floating)
}
Clearfix {
Zoom: 1; (compatible with ie6)
}
Another is to float the parent element set overflow: hidden; But it will be suspected of cheating, not recommended to use

CodePudding user response:

Know the Flex layout so that no longer floating, won't have the weird layout techniques,

CodePudding user response:

floating it really can be put into the dustbin of history, before the flex, no necessary to use float

CodePudding user response:

After a flex, float is not working

CodePudding user response:

Give points to points

CodePudding user response:

11 references HongJin_zhu response:
give points to points

How to send the

CodePudding user response:

Clear: both said encounter left floating and floating right labels newline
Which influence, which the label is actually refers to highly value is large, highly value the float will encounter the current TAB
  • Related