排版
HTML 中的所有标题标签,<h1>
到 <h6>
均可使用。另外,还提供了 .h1
到 .h6
类,为的是给内联(inline)属性的文本赋予标题的样式
在标题内还可以包含 <small>
标签或赋予 .small
类的元素,可以用来标记副标题。
<h1>h1. Bootstrap heading <small>Secondary text</small></h1>
中心内容
lead:让段落突出现实
实例:
Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Duis mollis, est non commodo luctus.
page-header:局部的下划线
着重使用strong 斜体使用em
内联文本元素
Marked text
You can use the mark tag to highlight text.
You can use the mark tag to <mark>highlight</mark> text.
被删除的文本
对于被删除的文本使用 <del>
标签。
This line of text is meant to be treated as deleted text.
<del>This line of text is meant to be treated as deleted text.</del>
无用文本
对于没用的文本使用 <s>
标签。
This line of text is meant to be treated as no longer accurate.
<s>This line of text is meant to be treated as no longer accurate.</s>
插入文本
额外插入的文本使用 <ins>
标签。
This line of text is meant to be treated as an addition to the document.
<ins>This line of text is meant to be treated as an addition to the document.</ins>
带下划线的文本
为文本添加下划线,使用 <u>
标签。
This line of text will render as underlined
<u>This line of text will render as underlined</u>
利用 HTML 自带的表示强调意味的标签来为文本增添少量样式。
着重
通过增加 font-weight 值强调一段文本。
The following snippet of text is rendered as bold text.
<strong>rendered as bold text</strong>
斜体
用斜体强调一段文本。
The following snippet of text is rendered as italicized text.
<em>rendered as italicized text</em>
Alternate elements
在 HTML5 中可以放心使用 <b>
和 <i>
标签。<b>
用于高亮单词或短语,不带有任何着重的意味;而 <i>
标签主要用于发言、技术词汇等。
对齐
通过文本对齐类,可以简单方便的将文字重新对齐。
<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>
改变大小写
通过这几个类可以改变文本的大小写。
<p class="text-lowercase">Lowercased text.</p>
<p class="text-uppercase">Uppercased text.</p>
<p class="text-capitalize">Capitalized text.</p>
文字的颜色
<p class="text-muted">Lowercased text.</p> 注:柔和色
<p class="text-primary">Uppercased text.</p>注:蓝色 <p class="text-success">Capitalized text.</p>注:绿色
<p class="text-info">Lowercased text.</p>注:墨蓝色 <p class="text-warning">Uppercased text.</p>注:暗黄色 <p class="text-danger">Capitalized text.</p>注:红色
缩略语
当鼠标悬停在缩写和缩写词上时就会显示完整内容,Bootstrap 实现了对 HTML 的 <abbr>
元素的增强样式。缩略语元素带有 title
属性,外观表现为带有较浅的虚线框,鼠标移至上面时会变成带有“问号”的指针。如想看完整的内容可把鼠标悬停在缩略语上(对使用辅助技术的用户也可见), 但需要包含 title 属性。
基本缩略语
An abbreviation of the word attribute is attr.
<abbr title="attribute">attr</abbr>
首字母缩略语
为缩略语添加 .initialism
类,可以让 font-size 变得稍微小些。
HTML is the best thing since sliced bread.
<abbr title="HyperText Markup Language" class="initialism">HTML</abbr>
地址
让联系信息以最接近日常使用的格式呈现。在每行结尾添加 <br>
可以保留需要的样式。
1355 Market Street, Suite 900
San Francisco, CA 94103
P: (123) 456-7890 Full Name
first.last@example.com
<address>
<strong>Twitter, Inc.</strong><br>
1355 Market Street, Suite 900<br>
San Francisco, CA 94103<br>
<abbr title="Phone">P:</abbr> (123) 456-7890
</address>
<address>
<strong>Full Name</strong><br>
<a href="mailto:#">first.last@example.com</a>
</address>
多种引用样式
对于标准样式的 <blockquote>
,可以通过几个简单的变体就能改变风格和内容。
命名来源
添加 <footer>
用于标明引用来源。来源的名称可以包裹进 <cite>
标签中
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante.
Someone famous in Source Title
<blockquote>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante.</p>
<footer>Someone famous in <cite title="Source Title">Source Title</cite></footer>
</blockquote>
或者下面直接small
无样式列表
<ul class="list-unstyled">
<li>...</li>
</ul>
菜单栏
<ul class="list-inline"> <li>...</li> </ul
垂直描述
<dl> <dt>...</dt> <dd>...</dd> </dl>
水平描述
<dl class="dl-horizontal"> <dt>...</dt> <dd>...</dd> </dl>