After the width of the block element is set, it still occupies a whole line. Is the rest margin?

after the width of the block element is set, it still occupies a whole line, and the rest is margin

.
Css
Mar.06,2021

Yes.
margin , padding , content and border .
clipboard.png

"" :


margin




first of all, the guy upstairs, you really only see a little. Do you see the definition of display above?
first of all, this display determines a lot of default styles, so it's important to make it clear that
@ xsf_1991 box model is right, but more you need to know whether it handles


according to the browser's default style. The

block-level element must be filled with its parent element. A block-level element is made up of margin, border-box, padding-box, and content-box.

if you set the box-sizing attribute of the block-level element to content-box, then your width refers to content-box, and all the other parts except content-box may fill the gap between the content-box and the parent element, depending on your width setting for the rest of the elements, the default is margin.

if you set the box-sizing attribute of the block-level element to border-box, then your width means that border-box, removes border-box and contains content-box and padding-box, leaving only margin, so in this case the rest must be margin.

The

box-sizing attribute sometimes has different default values.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b40e35-2c566.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b40e35-2c566.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?