Home > Article > Web Front-end > What attribute does css3 use to indicate left floating
In CSS, you can use "float:left" to indicate left floating. The float attribute is used to define which direction the element floats. When the attribute value is right, it means the element floats right. When the attribute value is none, Indicates that the element is not floating.
The operating environment of this tutorial: Windows 10 system, CSS3&&HTML5 version, Dell G3 computer.
What attribute does css3 use to indicate left floating?
The float attribute defines in which direction the element floats. Historically this property has always been applied to images, causing the text to wrap around the image, but in CSS, any element can be floated. A floated element creates a block-level box, regardless of what type of element it is.
If floating non-replaced elements, specify an explicit width; otherwise, they are made as narrow as possible.
Note: If there is very little space for a floating element on a row, the element will jump to the next row, and this process will continue until a certain row has enough space.
left The element floats to the left.
#right The element floats to the right.
#none Default value. The element is not floated and appears where it appears in the text.
#inherit Specifies that the value of the float attribute should be inherited from the parent element.
The example is as follows:
<html> <head> <style type="text/css"> img { float:left } </style> </head> <body> <p>在下面的段落中,我们添加了一个样式为 <b>float:left</b> 的图像。结果是这个图像会浮动到段落的右侧。</p> <p> <img src="/i/eg_cute.gif" / alt="What attribute does css3 use to indicate left floating" > This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. </p> </body> </html>
Output result:
(Learning video sharing: css video tutorial)
The above is the detailed content of What attribute does css3 use to indicate left floating. For more information, please follow other related articles on the PHP Chinese website!