您的位置:首页 > Web前端 > BootStrap

bootstrap注意事项(二)

2015-08-18 23:38 525 查看

1.内联子标题

在标题内还可以包含 <small> 标签或赋予 .small 类的元素,可以用来标记副标题。

<!DOCTYPE html>

<html>

<head>

<title>Bootstrap 实例 - 内联子标题</title>

<link href="/stylesheets/bootstrap.min.css" rel="stylesheet">

</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>

页面主体

Bootstrap 将全局 font-size 设置为 14px,line-height 设置为 1.428。这些属性直接赋予 <body> 元素和所有段落元素。另外,<p> (段落)元素还被设置了等于 1/2 行高(即 10px)的底部外边距(margin)。

中心内容

通过添加 .lead 类可以让段落突出显示。

没加.lead:

这是一个演示引导主体副本用法的实例。这是一个演示引导主体副本用法的实例。这是一个演示引导主体副本用法的实例。这是一个演示引导主体副本用法的实例。这是一个演示引导主体副本用法的实例。这是一个演示引导主体副本用法的实例。这是一个演示引导主体副本用法的实例。这是一个演示引导主体副本用法的实例。

加了lead:

这是一个演示引导主体副本用法的实例。这是一个演示引导主体副本用法的实例。

这是一个演示引导主体副本用法的实例。这是一个演示引导主体副本用法的实例。

这是一个演示引导主体副本用法的实例。这是一个演示引导主体副本用法的实例。

这是一个演示引导主体副本用法的实例。这是一个演示引导主体副本用法的实例。

使用 Less 工具构建

variables.less 文件中定义的两个 Less 变量决定了排版尺寸:@font-size-base 和 @line-height-base。第一个变量定义了全局 font-size 基准,第二个变量是 line-height 基准。我们使用这些变量和一些简单的公式计算出其它所有页面元素的 margin、 padding 和 line-height。自定义这些变量即可改变 Bootstrap 的默认样式。

2.内联文本元素

Marked text

突出运行文本由于在另一个语境的相关性,使用<mark>标记。

You can use the mark tag to <mark>highlight</mark> text.

You can use the mark tag to highlight text. 标记文本

被删除的文本

对于被删除的文本使用 <del> 标签。

<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.被删除的文本

无用文本

对于没用的文本使用 <s> 标签。

<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.无用文本

插入文本

额外插入的文本使用 <ins> 标签。

<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.插入文本

带下划线的文本

为文本添加下划线,使用 <u> 标签。

<u>This line of text will render as underlined</u>

This line of text will render as underlined带下划线的文本

小号文本

对于不需要强调的inline或block类型的文本,使用 <small> 标签包裹,其内的文本将被设置为父容器字体大小的 85%。标题元素中嵌套的 <small>元素被设置不同的 font-size 。

你还可以为行内元素赋予 .small类以代替任何 <small> 元素。

<small>This line of text is meant to be treated as fine print.</small>

This line of text is meant to be treated as fine print.小号文本

着重

通过增加 font-weight 值强调一段文本。

The following snippet of text is<strong>rendered as bold text</strong>

The following snippet of text is rendered as bold text.着重

斜体

用斜体强调一段文本。

The following snippet of text is <em>rendered as italicized text</em>.

The following snippet of text is rendered as italicized text.斜体

Alternate elements

在 HTML5 中可以放心使用 <b> 和 <i> 标签。<b> 用于高亮单词或短语,不带有任何着重的意味;而 <i> 标签主要用于发言、技术词汇等。

3.改变大小写

通过这几个类可以改变文本的大小写。

<p class="text-lowercase">Lowercased text.</p> lowercased text.

<p class="text-uppercase">Uppercased text.</p> UPPERCASED TEXT.

<p class="text-capitalize">Capitalized text.</p> Capitalized Text.

4.缩写

当鼠标悬停在缩写和缩写词上时就会显示完整内容,Bootstrap 实现了对 HTML 的 <abbr> 元素的增强样式。缩略语元素带有 title 属性,外观表现为带有较浅的虚线框,鼠标移至上面时会变成带有“问号”的指针。如想看完整的内容可把鼠标悬停在缩略语上(对使用辅助技术的用户也可见), 但需要包含 title 属性。

基本缩略语

<abbr title="attribute">attr</abbr>

首字母缩略语

为缩略语添加 .initialism 类,可以让 font-size 变得稍微小些。

<abbr title="HyperText Markup Language" class="initialism">HTML</abbr>

<!DOCTYPE HTML>
<html>
<head>
<link rel="stylesheet" href="/stylesheets/bootstrap.min.css">
</head>
<body>
<div class="container">
<p>An abbreviation of the word attribute is <abbr title="attribute">attr</abbr>.</p>
</div>
</body>
</html>

5.地址

让联系信息以最接近日常使用的格式呈现。在每行结尾添加 <br> 可以保留需要的样式。

<!DOCTYPE HTML>
<html>
<head>
<link rel="stylesheet" href="/stylesheets/bootstrap.min.css">
</head>
<body>
<div class="container">
<address>
<strong>Twitter, Inc.</strong><br>
795 Folsom Ave, Suite 600<br>
San Francisco, CA 94107<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>
</div>
</body>
</html>

效果:

Twitter, Inc.
795 Folsom Ave, Suite 600
San Francisco, CA 94107
P: (123) 456-7890 Full Name
first.last@example.com

无样式列表

移除了默认的 list-style 样式和左侧外边距的一组元素(只针对直接子元素)。这是针对直接子元素的,也就是说,你需要对所有嵌套的列表都添加这个类才能具有同样的样式。

<ul class="list-unstyled">

<li>...</li>

</ul>

内联列表

通过设置 display: inline-block; 并添加少量的内补(padding),将所有元素放置于同一行。

<ul class="list-inline">

<li>...</li>

</ul>

描述

带有描述的短语列表。

<dl>

<dt>...</dt>

<dd>...</dd>

</dl>

自动截断

通过 text-overflow 属性,水平排列的描述列表将会截断左侧太长的短语。在较窄的视口(viewport)内,列表将变为默认堆叠排列的布局方式。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: