The problem that the CSS element does not set the width?

< H1 > box1 {< / H1 >
height:100px;
padding:100px;
background-color:black;

}

< H1 > box2 {< / H1 >
height:100px;
margin: 0 -100px;
background-color:black;

}

what is the principle that neither of the above box sets the width, but can be stretched to the width of the entire browser?

Jun.21,2022

Block element does not set width, which defaults to 100% of parent element width


Block element width occupies full parent element width by default in standard document stream


Block element default width

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-1e53ee4-4d60a.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-1e53ee4-4d60a.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?