How to use the div box model
Xiaobian to share with you how to use div box model, I believe most people still do not know how to use, so share this article for your reference, I hope you have a lot of harvest after reading this article, let's go to understand it together!
Calculation of Box Model
margin + border + padding + content
Width and height in CSS are just height and width settings for the content area. Not the height and width settings for the whole and model.
The code is as follows:
demo
*{margin:0; padding:0;}
dl { background:red;border:10px solid #000; width:100px; height:100px;}
dt { background:yellow;}
dd { background:green;}
test of dt
test of dd
Setting margins and padding does not affect the height or width of the content area, only the height and width of the area of the subbox model.
In case of nested box models, the inner box model affects the outer box model.
The above is "div box model how to use" all the content of this article, thank you for reading! I believe that everyone has a certain understanding, hope to share the content to help everyone, if you still want to learn more knowledge, welcome to pay attention to the industry information channel!