Float in CSS

Source: Internet
Author: User

I have a poor foundation for the front-end CSS technology and want to make up for it. Due to the limited time spent in my spare time, I have read some articles. We hope to get acquainted with common CSS type attributes as soon as possible.

 

As follows, I will talk about my understanding of float. I have long heard that float is very difficult and hard-to-understand. I used to treat it as far as possible. I don't need it if I don't need it. I have not been paying close attention to him until I recently met him on the Internet. Although I am afraid it is difficult to see through my current skills, I will first make a preliminary understanding of him.

 

1 floating package

In fact, there is no need to think about how complicated it is. The essence of float is package and destruction. It is actually a display with a orientation: inline-block (such as float: left) is encapsulated to realize the adaptive effect of width, such as the adaptive text size of Button width.

Its CSS code is as follows:

 

The Html code is as follows:

 

 

2. destructive effects of floating

Such as text surround Image Display Effect :;

The reason for this effect is that the image contains the float attribute, which destroys its normal lnlineboxes;

Lnlineboxes does not display the content in blocks. Instead, the content is arranged in a line. Normally, the content is arranged in a line with the text, which is aligned with the text baseline. The height of Lnlineboxes is determined by the highest internal height (if the image height is the highest, the height of the image itself is equal to the height of lnlineboxes). When the image floats, it is separated from linebox, there is no height (relative height. In fact, I do not fully understand this point. I will share it with you later), so that other linebox elements can be re-integrated, arranged by floating elements.

 

 

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.