css - div 未正确对齐

标签 css html twitter-bootstrap

我有一个 class = "row"的 div。在那个 div 中,我试图在同一行中对齐两个 div。但不知何故,它不起作用。 enter image description here

这是html代码

<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<div class = "row">
    <div class = "col-md-8 col-sm-8 col-xs-8" style="width: 50%;" class="alert alert-danger" ng-if="offlineRouterCnt!=0">
      <strong>Number of offline Routers : {{offlineRouterCnt}} </strong>
    </div>

    <div class="input-group col-md-4 col-sm-4 col-xs-4" style = "width : 27%">
    <div class="input-group-btn">
      <button type="button" class="btn btn-primary" aria-haspopup="true" aria-expanded="false">ALL</button>
      </div>
    <input ng-model="naviagtion.searchText" class="form-control" focus-dir placeholder="Search Routers here"></input> 
      <span class="input-group-addon" ng-click="clearSearchAndFilters();">
        <span class="fa fa-times fa-1x"></span>
      </span>
    </div>
  </div>

有人可以帮我如何将它们对齐在同一行吗?

最佳答案

为什么要指定 col-md-4、col-sm-4 和 col-xs-4。 Bootstrap 缩放,因此您只需要输入 col-xs-4 和 col-xs-8。

我认为浏览器对声明和堆叠它们而不是缩放感到困惑。

关于css - div 未正确对齐,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46922397/

相关文章:

html - Bootstrap 3 使用小列自动调整内联输入大小

javascript - 如何使用 Bootstrap 横幅验证文本框

twitter-bootstrap - jQuery 数据表在隐藏时初始化时被破坏

html - 响应式网页设计 - 将图像和 Div 放在图像之上的最佳或正确方法是什么?

http - 当 Accept-Ranges 未在 http header 中设置时,浏览器音频播放失败;为什么?

html - 容器不展开

css - Bootstrap 固定底部表单操作

javascript - 用删除图像按钮覆盖缩略图?

jquery - Drupal/jQuery/CSS::Wrap 单选按钮标签在 span 标签中?

html - 在 magento 的 CMS 页面中使用静态 block 时没有 CSS