Some things to learn about CSS (bottom)

Source: Internet
Author: User

2. Float (float)

Float (float) Features: 1. The element moves left and right until it touches the container.

2. Set the floating element, still in the standard document flow.

3. When the element does not have a width value set, and the Float property is set, the width of the element changes as the content changes.

4. When an element sets a floating property, it has an effect on the neighboring element, especially adjacent to the next element.

           

Common methods to clear floating: 1.1, clear properties: commonly used claer:both; Clear:left; or clear:right;
1.2, at the same time set width:100% (or fixed width) +overflow:hidden;
Note: 1.1.1, add the above properties for the element that is affected by the float to clear the float.

1.1.2, empty tags <br></br> meaningless, this method is not recommended for clearing floats.

           

Floating Layout Example: Horizontal two-column layout

Related knowledge Points: Float property: The block-level elements arranged vertically, arranged horizontally.

Margin property: Sets the spacing between two columns.

         

3. Absolute positioning layout

3.1, by setting the Position property implementation
3.2, the third kind of positioning mechanism stipulated in CSS
3.3, can realize the horizontal multi-column layout and more complex positioning
Position property
1, has 3 kinds of positioning forms: (1) static positioning (2) relative positioning (3) Absolute positioning
2, can be set 4 property values: Static (stationary positioning) | Relative (relative positioning) | Absolute (absolute positioning) | Fixed (stationary positioning).

3.2.1 Relative positioning features: 1. Offset relative to its original position.

2. Still in the standard document stream.

3. The offset and Z-index properties are immediately

3.2.2 Absolute Positioning features: 1. A unit with a block as its base is established

2. Completely out of standard document flow.

3. The offset and Z-index properties are immediately

3.2.3 No offset feature: regardless of whether a positioned ancestor element exists, it remains at the initial position of the element, but is out of standard document flow.

3.2.4 Setting the Offset

Absolute positioning Layout Examples:

        

Some things to learn about CSS (bottom)

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.