twitter-bootstrap - 宽度属性在 css3 中不起作用

标签 twitter-bootstrap css

.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/

相关文章:

css - :hover element change::after style another component

javascript - 使用 Content-Security-Policy 和 JavaScript 避免 `script-src ' unsafe-inline'`

html - Bootstrap data-affix/position-fixed col 与其他 col 重叠

html - 如何在 HTML 元素上方创建间距,但仅在第一个元素之后?

javascript - jQuery 不是同时动画 div

jQuery 移动显示加载器用于自定义加载过程?

javascript - 控制台功能未定义错误?

javascript - Bootstrap 折叠滚动到底部问题

html - 页面加载时事件列表组元素颜色错误

html - 使用 bootstrap 水平/垂直对齐