星空网 > 软件开发 > 网页设计

高度塌陷问题

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<!--The viewport meta tag is used to improve the presentation and behavior of the samples
on iOS devices-->
<meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no"/>
<title></title>

<style>
html, body { height: 100%; width: 100%; margin: 0; padding: 0; }
.first{
margin:20px;
background:lightgreen;
border: 2px solid lightgreen;
/*display:inline-block;*/
/*overflow:hidden;*/
/*float: left;*/如果选择这种方法,一定要在该元素的下个元素添加clear:both,
/*position: absolute;*/

}
ul{
overflow:hidden;
margin:10px;
background:lightblue;
width:100px;
height:200px;
float: left;
}
li{
margin:25px;
}
</style>


</head>

<body >
<div >
<ul>
<li>1</li>
<li>2</li>
<li>3</li>
</ul>

<!--<div ></div>-->
</div>

</body>

</html>

父元素未设置高度和宽度的时候。那么它的高度就会塌缩为零,前提是它只包含浮动元素,解决高度塌陷的问题很简单,可以浮动父级元素、清除法等等,均可实现




原标题:高度塌陷问题

关键词:

*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: admin#shaoqun.com (#换成@)。

速看!亚马逊新加坡站11.11首秀拉动流量暴涨!:https://www.kjdsnews.com/a/707250.html
舱位继续收紧、运费不断上涨,新的危机出现!:https://www.kjdsnews.com/a/707251.html
速卖通俄罗斯宣布与 PIM Solutions 开始合作:https://www.kjdsnews.com/a/707252.html
最前沿的wayfair运营难题QA(连载36):https://www.kjdsnews.com/a/707253.html
亚马逊向卖家道歉!账号关联被封实属误伤:https://www.kjdsnews.com/a/707254.html
三大独立站卖家的“核心玩法”曝光,同品类卖家该如何拿下?:https://www.kjdsnews.com/a/707255.html
长治婚庆女司仪和主持人:https://www.vstour.cn/a/366176.html
北京丰台区水上乐园哪家好玩?:https://www.vstour.cn/a/366177.html
相关文章
我的浏览记录
最新相关资讯
海外公司注册 | 跨境电商服务平台 | 深圳旅行社 | 东南亚物流