我试图将 2 个 div 放在一行中,但是当我设法做到这一点时 - 主容器的高度未正确调整:
<div class="container">
<div class="info">Text</div>
<div class="controls">
<button value="Accept">Accept</button>
<button value="Decline">Decline</button>
</div>
</div>
CSS:
.container{
-webkit-border-radius: 6px;
-moz-border-radius: 6px;
border-radius: 6px;
border:1px solid #800000;
margin: 8px;
height:auto;
}
.info{
display: inline-block;
vertical-align: middle;
text-align: center;
}
.controls{
border-top-right-radius: 3px;
border-bottom-right-radius: 3px;
width: 130px;
padding: 8px;
border-left: 1px solid #000;
background-color: #D4D0C8;
float: right;
}
button{
width:100%; // what ever you want it to be
}
如何固定容器高度?