css - Questions about width and height in HTML (the title of this question is hard to come up with)
欧阳克
欧阳克 2017-06-21 10:12:42
0
4
895

欧阳克
欧阳克

温故而知新,可以为师矣。 博客:www.ouyangke.com

reply all(4)
学习ing

1. Just a normal block element
2. Set overflow

typecho

The default value of width and height is auto; block-level elements will inherit the width of the parent element, and the height is related to its own content;

为情所困

.box1 has set height and width, but .box1 cannot hold so much text, so it will be exceeded. Because the default value of overflow is visible, it will be displayed normally even if it is exceeded. If you set overflow:hidden; or overflow:auto; or other value, the effect will be different.
.box2 has a width set but no height. The height is determined based on the amount of text.
.box3 sets the height, and the width is inherited from the parent element, which is 100%; this is the same as .box1, except that the width is different

女神的闺蜜爱上我

"Waiting for You" gave a very detailed answer. Properties are inherited. Please read more about W3C

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template