根据 HTML 规范,以下代码中,外层容器 .outer 的宽高分别是:

236 阅读1分钟

根据 HTML 规范,以下代码中,外层容器 .outer 的宽高分别是:B

<style>
.outer {
height: 50px;
}
.inner {
width: 120px;
height: 100px;
}
</style>

<div class="outer">
<span class="inner">content</span>
</div>
A.高 50px,宽 120px
B.高 50px,宽 100%
C.高 100px,宽 120px
D.高 100px,宽 100%

 

解析

span是display:inline 设置宽高是不起作用的,宽高是由自身的撑起的,div是display:block,宽高若有设置就是设置的,没有设置,取默认值。高为自身撑起的,宽为100%