Width: 100% what is the benchmark test, width reference

Source: Internet
Author: User

Width: 100% what is the benchmark test, width reference

At first, we encountered the following problem: when the box model is set to box-sizing: border-box; (this is often done on mobile terminals ). The sub-box width: 100%. Is the sub-box width equal to the contend length of the parent box or the condend + padding + border length?

Css and html:

Result:

(Width of second) = (length of contend of first)

 

 

 

 

Next, we will summarize the reference of width: 100% under normal conditions (box-sizing: contend-box:

1. Standard stream: the sub-box is in the standard stream, and its width is equal to the width of the parent box at the upper level (whether floating or locating the parent box)

2. Floating Condition: Sub-box floating, same as above

3. Positioning: position: relative or absolute. Its width is equal to the width of the last position not static in the upper box.

When the sub-box is position: fixed, width is based on html.

 

 

 

 

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.