DIV CSS 佈局教程網

Bootstrap 3 學習筆記(二):排版
編輯:關於JavaScript     

上一篇介紹了網格系統,本篇整理 Bootstrap 3 在文字排版上提供的工具類。

標題與副標題

Bootstrap 已重新調校 h1–h6 的字級與間距,需要副標題時可在標題內使用 <small>:

<h1>h1. Bootstrap heading <small>Secondary text</small></h1>
<h2>h2. Bootstrap heading <small>Secondary text</small></h2>
<h3>h3. Bootstrap heading <small>Secondary text</small></h3>
<h4>h4. Bootstrap heading <small>Secondary text</small></h4>
<h5>h5. Bootstrap heading <small>Secondary text</small></h5>
<h6>h6. Bootstrap heading <small>Secondary text</small></h6>

若某個標題需要在視覺上與其他內容區隔,可包在 .page-header 中,它會加上分隔線:

<div class="page-header">
  <h1>Twitter Bootstrap <small>An intuitive front-end framework</small></h1>
</div>

內文節奏

預設字級 14px、行高 1.428、段落間距 10px。想讓某段特別醒目,可加上 .lead。

對齊方式

<p class="text-left">Left aligned text.</p>
<p class="text-center">Center aligned text.</p>
<p class="text-right">Right aligned text.</p>
<p class="text-justify">Justified text.</p>
<p class="text-nowrap">No wrap text.</p>

文字格式標籤

HTML 原生的行內格式標籤在 Bootstrap 中都可正常使用:

<p><b>粗體</b></p>
<p><code>電腦程式碼</code></p>
<p><em>強調</em></p>
<p><i>斜體</i></p>
<p><mark>醒目標記</mark></p>
<p><small>小字</small></p>
<p><strong>重點強調</strong></p>
<p>This is <sub>subscript</sub> and <sup>superscript</sup></p>
<p><ins>插入的文字</ins></p>
<p><del>刪除的文字</del></p>

大小寫轉換

<p class="text-lowercase">lowercased</p>
<p class="text-uppercase">UPPERCASED</p>
<p class="text-capitalize">Capitalized</p>

語意色彩

用顏色傳達重要性,是 Bootstrap 很實用的一組工具類:

<p class="text-muted">此段文字為灰色,弱化處理</p>
<p class="text-primary">重要:請先詳閱說明</p>
<p class="text-success">成功:訊息已送出</p>
<p class="text-info">注意:需同意條款才能完成註冊</p>
<p class="text-warning">警告:網路連線發生問題</p>
<p class="text-danger">錯誤:資料送出時發生錯誤</p>

引言區塊

<blockquote class="pull-right">
  <p>世界之所以危險,不是因為邪惡的人,而是因為那些對邪惡無動於衷的人。</p>
  <small>by <cite>Albert Einstein</cite></small>
</blockquote>

.pull-right 讓引言靠右對齊;若要區分層級,可搭配 <footer> 標註出處,語意會更完整。另外提醒:這些色彩類只改變樣式,並不會自動補上無障礙所需的替代資訊,重要狀態建議同時以文字說明,避免只依賴顏色傳達。

XML學習教程| jQuery入門知識| AJAX入門| Dreamweaver教程| Fireworks入門知識| SEO技巧| SEO優化集錦|
Copyright © DIV+CSS佈局教程網 All Rights Reserved