您的位置:首页 > Web前端 > CSS

css2

2016-05-14 14:26 405 查看
CSS 实现div宽度根据内容自适应


<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>脚本之家</title>
<style type="text/css">
.parent{
width:400px;
height:400px;
border:1px solid red;
}
.children{
border:1px solid blue;
height:50px;
display:inline-block;    /*这三行*/
*display:inline;      /*  css hack 兼容ie6      */
*zoom:1;
}
</style>
</head>
<body>
<div class="parent">
<div class="children">CSS 实现div宽度根据内容自适应</div>
</div>
</body>
</html>


clear写法?

.clear { zoom:1; }
.clear:after { content:''; display:block; clear:both; }
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: