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

让两个<div>在一个<div>里水平显示

2016-05-07 13:29 459 查看
给左边的<div>添加float属性,float:left;
********************************************************************************

<head>
<style>
body{
width:30em;
height:30em;
}
#bigBox{
background-color: #fffccf;
width:19em;
height: 10em;
margin-left: 3em;
margin-top: 3em;
border:1px solid #5B75B7;
}
#smallBox_1{
background-color:rgb(169,191,93);
width:5em;
height:2em;
padding-left: 1em;
padding-top: 1em;
margin-right: 2em;
margin-left:1em;
margin-top:1em;
border:1px solid #5B75B7;
float:left;
}
#smallBox_2{
background-color:rgb(162,111,93);
width:3em;
height:3em;
margin-left: 8em;
margin-top: 1em;
border:1px solid #5B75B7;
}

</style>
</head>
<body>
<div id="bigBox">

<div id="smallBox_1"></div>
<div id="smallBox_2"></div>

</div>
</body>
*********************************************************************************


内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  CSS