3 回答
TA贡献1865条经验 获得超7个赞
<div id="outer"> <div id="inner"> <p>Where is pancakes house?</p> </div></div>
#inner#outer#inner.
<html>width: 50%
height: 50%
TA贡献1848条经验 获得超2个赞
heightwidthheight
height财产:
height:
该百分比是根据生成的框的高度计算的。 含块..如果未显式指定包含块的高度(即它取决于内容高度),且该元素不是绝对定位的,则该值将计算为“AUTO”。根元素上的百分比高度相对于 初始包含块..注意:对于绝对定位元素,其包含块的元素是基于块级元素的,该百分比是根据该元素的填充框的高度计算的。
该百分比是根据生成的框的高度计算的。 含块.
static
最近的块容器祖先框
fixedabsolute
<div id="a" style="width: 100px; height: 200px; background-color: orange">
<div id="aa" style="width: 100px; height: 50%; background-color: blue"></div>
</div>
<div id="b" style="width: 100px; background-color: orange">
<div id="bb" style="width: 100px; height: 50%; background-color: blue"></div>
</div>
#aa#a#b#bb
height
如果包含块的高度 未显式指定。(也就是说,它取决于内容高度),并且这个元素不是绝对定位的, 该值计算为“自动”.
50% height:200px的情况下,为100 px。 #aa但是50%的 height:auto是 auto的情况下为0px。 #bb因为没有任何内容 auto扩展到
width.
width财产:
width
该百分比是根据生成的框的包含块的宽度计算的。
widthheight:
<div id="c" style="width: 200px; height: 100px; background-color: orange">
<div id="cc" style="width: 50%; height: 100px; background-color: blue"></div>
</div>
<div id="d" style=" height: 100px; background-color: orange">
<div id="dd" style="width: 50%; height: 100px; background-color: blue"></div>
</div>
50% width:200px的情况下,为100 px。 #cc50% width:auto是任何东西的50% width:auto不像 height,没有特殊的规则来区别对待这一案件。
autowidthheightheightwidth, auto
宽度取决于其他属性的值。见以下章节。
下列约束必须包含在其他属性的使用值中:
“边距-左”+“左-宽”+“左”+“宽”+“右”+“边框-右-宽”+“边-右”=包含块的宽度。
widthheight
如果“宽度”设置为“AUTO”,则任何其他“AUTO”值都将变为“0”,而“宽度”则遵循由此产生的相等。
width:auto
- 3 回答
- 0 关注
- 363 浏览
相关问题推荐
添加回答
举报
