Definition and usage
If the floating non-replacement element is used, a specific width should be specified; otherwise, they will be as narrow as possible.
Note: If there is only a small amount of space on top of a row for floating elements, this element will jump to the next row, and this process will continue until a row has enough space.
Default value: |
None |
Inheritance: |
No |
Version: |
Css1 |
Webpage special effect syntax: |
Object.Style.css float = "left" |
Instance
Float the image to the right:
Img {Float: right;
}
Tiy
Browser support
All mainstream browsers support the float attribute.
Note: Any version of internet explorer (including ie8) does not support the attribute value "inherit ".
Possible value
Value |
Description |
Left |
The element floats to the left. |
Right |
The elements float to the right. |
None |
Default value. The element does not float and is displayed in the position where it appears in the text. |
Inherit |
Specifies that the value of the float attribute should be inherited from the parent element. |
The code is as follows: |
Copy code |
Clearfix: after { Content :"."; Display: block; Height: 0; Clear: both; Visibility: hidden; } * Html. clearfix { Height: 1%; } * + Html. clearfix { Height: 1%; } . Clearfix { Display: inline-block; } . Clearfix {display: block ;} |
In addition to floating, new friends often do not quite understand. If float is not cleared and float is closed, errors may occur in ff. A large number of articles have been introduced in 111cn.net. We recommend an instance today, which is very simple and easy to use.