Home >Web Front-end >CSS Tutorial >Detailed explanation of comprehensive analysis of box-sizing
---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;
border-box: IE traditional standard
content-box:
.test1{ box-sizing:content-box; width:200px; padding:10px; border:15px solid #eee; }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; }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 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!