Css float clear floating implementation code

Source: Internet
Author: User

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.

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.