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

Bootstrap学习笔记之排版

2014-08-24 17:53 447 查看
标题

  HTML 中的所有标题标签,
<h1>
<h6>
均可使用。另外,还提供了
.h1
.h6
类,为的是给内联(inline)属性的文本赋予标题的样式。

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


    效果图为:

  


  在标题内还可以包含
<small>
标签或赋予
.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>


  效果图为:

  


页面主体

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

<div class="container">
<p>Nullam quis risus eget urna mollis ornare vel eu leo. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nullam id dolor id nibh ultricies vehicula.</p>
<p>Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec ullamcorper nulla non metus auctor fringilla. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Donec ullamcorper nulla non metus auctor fringilla.</p>
</div>


  效果图为:

  


中心内容

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

<p class="lead">Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Duis mollis, est non commodo luctus.</p>


  效果图为:

  


内联文本元素

  高亮文本

<mark>highlight</mark>


  被删除的文本(标记已经被删除的)

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


  插入文本(额外插入的文本)

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


  小号文本

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


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

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


  着重

<strong>rendered as bold text</strong>


  斜体

<em>rendered as italicized text</em>


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


对齐

  通过bootstrap中预定文本对齐类,可以简单方便的将文字重新对齐。

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


缩略语

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

  基本缩略语

  如想看完整的内容可把鼠标悬停在缩略语上, 但需要为
<abbr>
元素设置
title
属性。

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


  首字母缩略语

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

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


地址

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

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


引用

  在你的文档中引用其他来源的内容

  默认样式的引用

  将任何HTML裹在
<blockquote>
之中即可表现为引用。对于直接引用,我们建议用
<p>
标签。

<blockquote>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante.</p>
</blockquote>


  选项引用

  对于标准样式的
<blockquote>
,可以通过几个简单的变体就能改变风格和内容。

    命名空间

    添加
<small>
标签来注明引用来源。来源名称可以放在
<cite>
标签里面。

<blockquote>
<small>Someone famous in <cite title="Source Title">Source Title</cite></small>
</blockquote>


    另外一种展现形式

    使用
.pull-right
可以让引用展现出向右侧移动、对齐的效果。

<blockquote class="blockquote-reverse">
...
</blockquote>


列表

  无序列表

<ul>
<li>...</li>
</ul>


  有序列表

<ol>
<li>...</li>
</ol>


  无样式列表

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


自动截断

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