.chat-box{
width:50%;
height:360px;
background:#f2f2f2;
border:1px solid grey;
}
<div class="container-fluid mrgn_cnt">
<div class="row">
<div class="col-sm-4">
</div>
<div class="col-sm-8 chat-box">
<div class="whte_box"><!-- white box start-->
</div>
<!-- end of whitebox-->
</div>
</div>
</div>
我正在使用 Bootstrap 框架。我想要实现的是,类聊天框的宽度为 50%,但宽度属性不起作用,即使我向类聊天框添加另一个属性,如 display:block;
仍然 width 属性是不工作。
我期望将它用作 block 级元素,而不是它,除了背景高度边框外,我没有任何工作。我已经尝试了一切并重新检查。我不知道究竟是什么导致了这个问题?
最佳答案
发生这种情况是因为通过使用此 Bootstrap 类 col-sm-8
,您将其宽度设置为 66.66%,或者使用类 col-sm-6
col-sm-8
。或将您的 .chat-box
放入
<div class="col-sm-8">
<div class="chat-box">
<!-- white box start-->
<div class="white_box">
</div>
<!-- end of whitebox-->
</div>
</div>
然后相应地应用宽度属性
关于twitter-bootstrap - 宽度属性在 css3 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41254956/