Bootstrap typography
Bootstrap uses Helvetica Neue, Helvetica, Arial and sans-serif as its default font stack.
Using Bootstrap’s typography features, you can create headings, paragraphs, lists, and other inline elements.
Heading
Bootstrap defines the styles of all HTML headings (h1 to h6). Please look at the following example:
Instance
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Bootstrap 实例 - 标题</title> <link rel="stylesheet" href="http://apps.bdimg.com/libs/bootstrap/3.3.0/css/bootstrap.min.css"> <script src="http://apps.bdimg.com/libs/jquery/2.1.1/jquery.min.js"></script> <script src="http://apps.bdimg.com/libs/bootstrap/3.3.0/js/bootstrap.min.js"></script> </head> <body> <h1>我是标题1 h1</h1> <h2>我是标题2 h2</h2> <h3>我是标题3 h3</h3> <h4>我是标题4 h4</h4> <h5>我是标题5 h5</h5> <h6>我是标题6 h6</h6> </body> </html>
Run Example»
Click the "Run Instance" button to view the online example
Inline subtitle
If you need to add an inline subtitle to any title, simply add <small> around the element, or add . small class, so you get a smaller font size and lighter text, as shown in the following example:
<html> ;
<head>
<title>Bootstrap Example - Inline Subtitle</title>
<link href="/bootstrap/css/bootstrap.min.css" rel=" stylesheet">
<script src="/scripts/jquery.min.js"></script>
<script src="/bootstrap/js/bootstrap.min.js"> ;</script>
</head>
<body>
<h1>I am title 1 h1. <small>I am subtitle 1 h1</small> </h1>
<h2>I am title 2 h2. <small>I am subtitle 2 h2</small></h2>
<h3>I am title 3 h3. < ;small>I am subtitle 3 h3</small></h3>
<h4>I am subtitle 4 h4. <small>I am subtitle 4 h4</small></h4>
<h5>I am title 5 h5. <small>I am subtitle 5 h5</small></h5>
<h6>I am title 6 h6. <small>I am subtitle 6 h6</small></h6>
</body>
</html>
<!DOCTYPE html> <html> <head> <title>Bootstrap 实例 - 内联子标题</title> <link href="http://libs.baidu.com/bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet"> <script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script> <script src="http://libs.baidu.com/bootstrap/3.0.3/js/bootstrap.min.js"></script> </head> <body> <h1>我是标题1 h1. <small>我是副标题1 h1</small></h1> <h2>我是标题2 h2. <small>我是副标题2 h2</small></h2> <h3>我是标题3 h3. <small>我是副标题3 h3</small></h3> <h4>我是标题4 h4. <small>我是副标题4 h4</small></h4> <h5>我是标题5 h5. <small>我是副标题5 h5</small></h5> <h6>我是标题6 h6. <small>我是副标题6 h6</small></h6> </body> </html>
Run Instance»Click the "Run Instance" button to view the online instance
Boot the main copy In order to add emphasis text to a paragraph, you can add class="lead", which will result in larger, thicker, and higher line height text, as shown in the following example:
<!DOCTYPE html> <html> <head> <title>Bootstrap 实例 - 引导主体副本</title> <link rel="stylesheet" href="http://apps.bdimg.com/libs/bootstrap/3.3.0/css/bootstrap.min.css"> <script src="http://apps.bdimg.com/libs/jquery/2.1.1/jquery.min.js"></script> <script src="http://apps.bdimg.com/libs/bootstrap/3.3.0/js/bootstrap.min.js"></script> </head> <body> <hr> <h2>引导主体副本</h2> <p class="lead">这是一个演示引导主体副本用法的实例。这是一个演示引导主体副本用法的实例。这是一个演示引导主体副本用法的实例。这是一个演示引导主体副本用法的实例。这是一个演示引导主体副本用法的实例。这是一个演示引导主体副本用法的实例。这是一个演示引导主体副本用法的实例。这是一个演示引导主体副本用法的实例。</p> </body> </html>
<!DOCTYPE html> <html> <head> <title>Bootstrap 实例 - 引导主体副本</title> <link href="http://libs.baidu.com/bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet"> <script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script> <script src="http://libs.baidu.com/bootstrap/3.0.3/js/bootstrap.min.js"></script> </head> <body> <h2>引导主体副本</h2> <p class="lead">这是一个演示引导主体副本用法的实例。这是一个演示引导主体副本用法的实例。这是一个演示引导主体副本用法的实例。这是一个演示引导主体副本用法的实例。这是一个演示引导主体副本用法的实例。这是一个演示引导主体副本用法的实例。这是一个演示引导主体副本用法的实例。这是一个演示引导主体副本用法的实例。</p> </body> </html>
Emphasis
The default emphasis tag of HTML< small> (sets the text to 85% of the size of the parent text), <strong> (sets the text to be bolder), <em> (sets the text to italics).
Bootstrap provides some classes for emphasizing text, as shown in the following example:
<!DOCTYPE html> <html> <head> <title>Bootstrap 实例 - 强调</title> <link rel="stylesheet" href="http://apps.bdimg.com/libs/bootstrap/3.3.0/css/bootstrap.min.css"> <script src="http://apps.bdimg.com/libs/jquery/2.1.1/jquery.min.js"></script> <script src="http://apps.bdimg.com/libs/bootstrap/3.3.0/js/bootstrap.min.js"></script> </head> <body> <small>本行内容是在标签内</small><br> <strong>本行内容是在标签内</strong><br> <em>本行内容是在标签内,并呈现为斜体</em><br> <p class="text-left">向左对齐文本</p> <p class="text-center">居中对齐文本</p> <p class="text-right">向右对齐文本</p> <p class="text-muted">本行内容是减弱的</p> <p class="text-primary">本行内容带有一个 primary class</p> <p class="text-success">本行内容带有一个 success class</p> <p class="text-info">本行内容带有一个 info class</p> <p class="text-warning">本行内容带有一个 warning class</p> <p class="text-danger">本行内容带有一个 danger class</p> </body> </html>
Example
<!DOCTYPE html> <html> <head> <title>Bootstrap 实例 - 强调</title> <link href="http://libs.baidu.com/bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet"> <script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script> <script src="http://libs.baidu.com/bootstrap/3.0.3/js/bootstrap.min.js"></script> </head> <body> <small>本行内容是在标签内</small><br> <strong>本行内容是在标签内</strong><br> <em>本行内容是在 <em> 标签内,并呈现为斜体</em><br> <p class="text-left">向左对齐文本</p> <p class="text-center">居中对齐文本</p> <p class="text-right">向右对齐文本</p> <p class="text-muted">本行内容是减弱的</p> <p class="text-primary">本行内容带有一个 primary class</p> <p class="text-success">本行内容带有一个 success class</p> <p class="text-info">本行内容带有一个 info class</p> <p class="text-warning">本行内容带有一个 warning class</p> <p class="text-danger">本行内容带有一个 danger class</p> </body> </html>
Run Example»
Click the "Run Example" button to view the online example
Abbreviation
The HTML element provides tags for abbreviations, Such as WWW or HTTP. Bootstrap defines the style of the <abbr> element as a dashed border that appears at the bottom of the text, with the full text appearing when the mouse is hovered over it (as long as you add text for the <abbr> title attribute). To get a smaller font size for text, add .initialism to <abbr>.
<!DOCTYPE html> <html> <head> <title>Bootstrap 实例 - 缩写</title> <link rel="stylesheet" href="http://apps.bdimg.com/libs/bootstrap/3.3.0/css/bootstrap.min.css"> <script src="http://apps.bdimg.com/libs/jquery/2.1.1/jquery.min.js"></script> <script src="http://apps.bdimg.com/libs/bootstrap/3.3.0/js/bootstrap.min.js"></script> </head> <body> <abbr title="World Wide Web">WWW</abbr><br> <abbr title="Real Simple Syndication" class="initialism">RSS</abbr> </body> </html>
Instance
<!DOCTYPE html> <html> <head> <title>Bootstrap 实例 - 缩写</title> <link href="http://libs.baidu.com/bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet"> <script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script> <script src="http://libs.baidu.com/bootstrap/3.0.3/js/bootstrap.min.js"></script> </head> <body> <abbr title="World Wide Web">WWW</abbr><br> <abbr title="Real Simple Syndication" class="initialism">RSS</abbr> </body> </html>
Run Instance»
Click the "Run Instance" button to view the online instance
Address
Using the <address> tag, you can display contact information on a web page. Since <address> defaults to display:block;, you need to use the
tag to add line breaks to the enclosed address text.
<!DOCTYPE html> <html> <head> <title>Bootstrap 实例 - 地址</title> <link rel="stylesheet" href="http://apps.bdimg.com/libs/bootstrap/3.3.0/css/bootstrap.min.css"> <script src="http://apps.bdimg.com/libs/jquery/2.1.1/jquery.min.js"></script> <script src="http://apps.bdimg.com/libs/bootstrap/3.3.0/js/bootstrap.min.js"></script> </head> <body> <address> <strong>Some Company, Inc.</strong><br> 007 street<br> Some City, State XXXXX<br> <abbr title="Phone">P:</abbr> (123) 456-7890 </address> <address> <strong>Full Name</strong><br> <a href="mailto:#">mailto@somedomain.com</a> </address> </body> </html>
Instance
<!DOCTYPE html> <html> <head> <title>Bootstrap 实例 - 地址</title> <link href="http://libs.baidu.com/bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet"> <script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script> <script src="http://libs.baidu.com/bootstrap/3.0.3/js/bootstrap.min.js"></script> </head> <body> <address> <strong>Some Company, Inc.</strong><br> 007 street<br> Some City, State XXXXX<br> <abbr title="Phone">P:</abbr> (123) 456-7890 </address> <address> <strong>Full Name</strong><br> <a href="mailto:#">mailto@somedomain.com</a> </address> </body> </html>
Run Instance»
Click the "Run Instance" button to view the online instance
Blockquote
You can use the default <blockquote> next to any HTML text. Other options include adding a <small> tag to identify the source of the quote and right-aligning the quote using class .pull-right. The following example demonstrates these features:
<html>
<head>
<title>Bootstrap Example - Quote< /title>
<link href="/bootstrap/css/bootstrap.min.css" rel="stylesheet">
<script src="/scripts/jquery.min.js"> </script>
<script src="/bootstrap/js/bootstrap.min.js"></script>
</head>
<body>
<blockquote><p>
This is a default quote instance. This is a default reference instance. This is a default reference instance. This is a default reference instance. This is a default reference instance. This is a default reference instance. This is a default reference instance. This is a default reference instance. </p></blockquote>
<blockquote>This is a quote with a source title. <small>Someone famous in <cite title="Source Title">Source Title</cite></small></blockquote>
<blockquote class="pull-right">This is a right-aligned reference. <small>Someone famous in <cite title="Source Title">Source Title</cite></small></blockquote>
</body>
< /html>
<!DOCTYPE html> <html> <head> <title>Bootstrap 实例 - 引用</title> <link href="http://libs.baidu.com/bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet"> <script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script> <script src="http://libs.baidu.com/bootstrap/3.0.3/js/bootstrap.min.js"></script> </head> <body> <blockquote><p> 这是一个默认的引用实例。这是一个默认的引用实例。这是一个默认的引用实例。这是一个默认的引用实例。这是一个默认的引用实例。这是一个默认的引用实例。这是一个默认的引用实例。这是一个默认的引用实例。</p></blockquote> <blockquote>这是一个带有源标题的引用。<small>Someone famous in <cite title="Source Title">Source Title</cite></small></blockquote> <blockquote class="pull-right">这是一个向右对齐的引用。<small>Someone famous in <cite title="Source Title">Source Title</cite></small></blockquote> </body> </html>
Run instance»Click "Run" Instance" button to view online examples
List
Bootstrap supports ordered lists, unordered lists and definition lists.
Ordered list: An ordered list is a list starting with a number or other ordered character.
Unordered list: An unordered list refers to a list in no specific order and is a list starting with a traditional emphasis. If you don't want these emphasis marks to appear, you can use class .list-unstyled to remove the style. You can also put all list items on the same line by using class .list-inline.
Definition list: In this type of list, each list item can contain <dt> and <dd> elements. <dt> stands for defining term, like a dictionary, to which (or phrase) it is defined. Next, <dd> is the description of <dt>. You can use class dl-horizontal to display attributes and descriptions side by side in <dl> lines.
The following example demonstrates these types of lists:
<!DOCTYPE html> <html> <head> <title>Bootstrap 实例 - 列表</title> <link rel="stylesheet" href="http://apps.bdimg.com/libs/bootstrap/3.3.0/css/bootstrap.min.css"> <script src="http://apps.bdimg.com/libs/jquery/2.1.1/jquery.min.js"></script> <script src="http://apps.bdimg.com/libs/bootstrap/3.3.0/js/bootstrap.min.js"></script> </head> <body> <h4>有序列表</h4> <ol> <li>Item 1</li> <li>Item 2</li> <li>Item 3</li> <li>Item 4</li> </ol> <h4>无序列表</h4> <ul> <li>Item 1</li> <li>Item 2</li> <li>Item 3</li> <li>Item 4</li> </ul> <h4>未定义样式列表</h4> <ul class="list-unstyled"> <li>Item 1</li> <li>Item 2</li> <li>Item 3</li> <li>Item 4</li> </ul> <h4>内联列表</h4> <ul class="list-inline"> <li>Item 1</li> <li>Item 2</li> <li>Item 3</li> <li>Item 4</li> </ul> <h4>定义列表</h4> <dl> <dt>Description 1</dt> <dd>Item 1</dd> <dt>Description 2</dt> <dd>Item 2</dd> </dl> <h4>水平的定义列表</h4> <dl class="dl-horizontal"> <dt>Description 1</dt> <dd>Item 1</dd> <dt>Description 2</dt> <dd>Item 2</dd> </dl> </body> </html>
Example
<!DOCTYPE html> <html> <head> <title>Bootstrap 实例 - 列表</title> <link href="http://libs.baidu.com/bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet"> <script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script> <script src="http://libs.baidu.com/bootstrap/3.0.3/js/bootstrap.min.js"></script> </head> <body> <h4>有序列表</h4> <ol> <li>Item 1</li> <li>Item 2</li> <li>Item 3</li> <li>Item 4</li> </ol> <h4>无序列表</h4> <ul> <li>Item 1</li> <li>Item 2</li> <li>Item 3</li> <li>Item 4</li> </ul> <h4>未定义样式列表</h4> <ul class="list-unstyled"> <li>Item 1</li> <li>Item 2</li> <li>Item 3</li> <li>Item 4</li> </ul> <h4>内联列表</h4> <ul class="list-inline"> <li>Item 1</li> <li>Item 2</li> <li>Item 3</li> <li>Item 4</li> </ul> <h4>定义列表</h4> <dl> <dt>Description 1</dt> <dd>Item 1</dd> <dt>Description 2</dt> <dd>Item 2</dd> </dl> <h4>水平的定义列表</h4> <dl class="dl-horizontal"> <dt>Description 1</dt> <dd>Item 1</dd> <dt>Description 2</dt> <dd>Item 2</dd> </dl> </body> </html>
Run Instance»
Click the "Run Instance" button to view the online instance
More typography classes
The following table provides examples of more Bootstrap typography classes:
Class | Description | Instance |
---|---|---|
.lead | Make paragraph highlight | Try it |
.small | Set small text (set to 85% of the size of the parent text) | Try it |
.text-left | Set text left alignment | Try it |
.text-center | Setting Center-align text | Try it |
.text-right | Set text-right | Try it |
.text-justify | Set text alignment, and the text in the paragraph that exceeds the screen will automatically wrap | Try it |
.text-nowrap | Do not wrap lines in paragraphs that exceed the screen | Try it |
.text-lowercase | Settings Text lowercase | Try it |
.text-uppercase | Set text uppercase | Try it |
.text-capitalize | Set the first letter of a word to be capitalized | Try it |
.initialism | The text displayed in the <abbr> element is displayed in a small font | Try it |
.blockquote-reverse | Set the quote to be right aligned | Try it |
.list-unstyled | Remove the default list style and left-align the list items (<ul> and < ol> in). This class only works with direct child list items (If you need to remove nested list items, you need to use this style in the nested list) | Try it |
.list-inline | Place all list items on the same line | Try it |
.dl-horizontal | This class sets the float and offset, apply In the <dl> element and <dt> element, the specific implementation can be viewed in the example | Try it |
.pre-scrollable | Use <pre> Elements are scrollable | Try it |
##