Parsing the box-sizing attribute in CSS3

Source: Internet
Author: User
Tags end
When you refactor the mobile end page, we often encounter two frames side-by-side situation, and need to be wide adaptive, equal width, have a border such a situation, my usual method is to use the positioning to deal with, and then use a negative positioning to solve, but later found that you can use the Box-sizing attribute in CSS3 to be done. All right, let's recommend it to everyone.

Grammar:

Box-sizing:content-boxborder-boxinherit;

Defined:

The Box-sizing property allows you to define specific elements that match a range in a particular way. For example, if you need to place two border-bordered boxes side-by, you can set box-sizing to "Border-box". This allows the browser to render a box with the specified width and height, and to place the border and inner margins in the box.

That is to say, if we used border and padding, the width of our elements should be reduced correspondingly, and the widths of border and padding could be kept in the same width. But after using the box-sizing, you don't have to lose it.

The code is as follows:

  1. This div occupies the left half.
  2. this div occupies the right half.

This is only practical for mobile end and PC high handsome browser, PC end cock Silk browser does not support, see the situation using it!



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.