Detailed explanation of comprehensive analysis of box-sizing

高洛峰
Release: 2017-03-07 11:43:58
Original
2308 people have browsed it

---Restore content starts---

##box-sizing

Attributes allow you to define specific elements that match a certain region in a specific way.

For example, if you need to place two bordered boxes side by side, you can do this by setting box-sizing to "border-box". This causes the browser to render a box with the specified width and height, and put the borders and padding into the box.

Syntax
box-sizing: content-box|border-box|inherit;

content-box: w3c standard (default)


border-box: IE traditional standard

Detailed explanation of comprehensive analysis of box-sizing

content-box:

.test1{ box-sizing:content-box; width:200px; padding:10px; border:15px solid #eee; }

Detailed explanation of comprehensive analysis of box-sizing

The width 200px in test1 refers to the width of the content, the same as So is the physical height.

border-box:

.test2{ box-sizing:border-box; width:200px; padding:10px; border:15px solid #eee; }

Detailed explanation of comprehensive analysis of box-sizing

The width 200px in test2 refers to the width of the border, and the same goes for the height.

You can understand padding-box with the help of the above example

Detailed explanation of comprehensive analysis of box-sizing

The above comprehensive understanding of box-sizing is all the content shared by the editor. , I hope it can give everyone a reference, and I also hope everyone will support the PHP Chinese website.

For more detailed and comprehensive analysis of box-sizing related articles, please pay attention to the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template