html - 更改字体大小时 Bootstrap 网格行偏移

标签 html css twitter-bootstrap

我正在尝试通过 Bootstrap Grid 系统进行站点导航。 我想用这种布局制作 3 列两行:

|Title   |            |Login|
|Subtitle|Menu buttons|     |

代码工作正常,直到我为标题和副标题设置font-size。有谁能够帮助我?片段:http://www.bootply.com/GLEf6MfmxE

HTML:

  <header> 
    <div class="container">
     <div class="row">
       <div class="col-xs-4" id="title">Foo title</div>
       <div class="col-xs-6"></div>
       <div class="col-xs-2">Login</div>
       <div class="col-xs-2" id="subtitle">Bar subtitle</div>
       <div class="col-xs-1">Menu 1</div>
       <div class="col-xs-1">Menu 2</div>
     </div> 
   </div>
 </header>

自定义 CSS:

#title{
    font-size: 2em;
}

#subtitle {
    font-size: 1.5em;
}

最佳答案

你需要知道,对于不同的行,你必须使用另一个行类,因为你正在处理两行,所以每一列都必须在它们自己的行类上,就像这样检查下面的代码。我相信这段代码会帮助您理解。

  <header> 
   <div class="container">
     <div class="row">
        <div class="col-xs-4" id="title">Foo title</div>
        <div class="col-xs-6"></div>
        <div class="col-xs-2">Login</div>
     </div>
     <div class="row">
       <div class="col-xs-2" id="subtitle">Bar subtitle</div>
          <div class="col-xs-1">Menu 1</div>
          <div class="col-xs-1">Menu 2</div>
      </div> 
   </div>
  </header>

问候

关于html - 更改字体大小时 Bootstrap 网格行偏移,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43413787/

相关文章:

html - 将 Wordpress 更改为 RTL 时出现奇怪的空白

php - X-editable Bootstrap PHP 数据库更新

twitter-bootstrap - 如何在 Vue.js 中添加 Bootstrap 工具提示

javascript - 页面上任意数量视频的 HTML5 视频自定义控件

html - 添加了多个空白链接的 CSS

php - 在 Html Forms 的 sql 表中记录信息时遇到问题

javascript - 使用 Bootstrap 的价格过滤器

javascript - 编辑 contenteditable div 时如何计算光标的 x,y 坐标?

css - 文本在浏览器调整大小时移动

html - 事件导航选项卡不应该有底线