CSS authoritative guide-floating and positioning

Source: Internet
Author: User

Floating and positioning-floating and positioning

The purpose of floating and positioning is layout. Let's talk about floating.

Floating

CSS1 first mentioned floating. You can make the picture float by declaring it since Netscape1. For example , let the other content around the image. The word floating is derived from the extension of the html2.0.

The align of the picture is actually the floating effect of the picture.

After that, any element in the CSS can float.

Floating is to the left/right as much as possible

Value of float left right none inherit

Floating elements

Whether the float allows the document to be removed from the normal flow or affects the layout.

One element floats, and the other elements wrap around the element.

The margin of a floating element does not merge with the margins of other elements, that is, the margin does not merge.

The floating element must explicitly represent a width, otherwise the default is no width.

Floating in detail

The containing block of the floating element is the nearest ancestor element.

A inline element becomes a block-level element when it floats.

---

The bounds of the floating element do not exceed the inner bounds of the containing block.

The left (right) boundary of a floating element must be the right (left) boundary of the previous element, unless the floating element appears below. (i.e., floating elements in one Direction do not overlap)

Left floating and right floating elements do not overlap.

A floating element is no higher than the parent element. If the floating element is in the margin of a merge, then the floating element will appear to have a block level element with the following element. Lest the floating elements go up to the top. This one is more interesting.

The floating element is no higher than the previous element.

A floating element cannot be higher than the row box that contains it. For example, there is an IMG floating in a paragraph, and the floating img can only be as high as the previous row box.

The floating element cannot exceed the containing element.

Floating elements must be as high as possible.

Left (right) as far as left (right)

CSS authoritative guide-floating and positioning

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.