让两个在一个里水平显示
给左边的<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>
*********************************************************************************
给左边的<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>
*********************************************************************************