排版&代码&表格

排版

标题

/

到 /

均可使用,另外提供了.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 类的元素可以用来标记副标题

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

页面主体
全局font-size:14px
line-height:1.428
这些属性会赋予属性和所有段落属性
/

设置了等于1/2行高(即 10px)的底部外边距(margin)

<p>...</p>

中心内容
.lead类可以让段落突出显示

<p class="lead">...</p>

variables.less文件中两个less变量决定了排版尺寸@font-size-base 和 @line-height-base
@font-size-base决定了line-height基准,自定义可以改变默认样式

内联文本元素

<!--高亮显示-->
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>
<!--无用-->
<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>
<!--小号-->
<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 中可以放心使用 标签。 用于高亮单词或短语,不带有任何着重的意味;而 标签主要用于发言、技术词汇等

对齐

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

缩略语

<!--鼠标放在上面会出现提示-->
<abbr title="attribute">attr</abbr>
<!--缩略语添加.initialism类,可以让font-size稍微小些-->
<abbr title="HyperText Markup Language" class="initialism">HTML</abbr>

地址
让联系信息以最接近日常使用的格式呈现,结尾的
可以保留需要的样式

<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>
  <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante.</p>
</blockquote>

添加

用于标明引用来源。来源的名称可以包裹进 标签中

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

.blockquote-reverse 类可以让引用呈现内容右对齐的效果

<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-horizontal 可以让

内的短语及其描述排在一行。开始是像
的默认样式堆叠在一起,随着导航条逐渐展开而排列在一行。

<dl class="dl-horizontal">
  <dt>...</dt>
  <dd>...</dd>
</dl>

通过 text-overflow 属性,水平排列的描述列表将会截断左侧太长的短语。在较窄的视口(viewport)内,列表将变为默认堆叠排列的布局方式。

代码

内联代码/

For example, <code>&lt;section&gt;</code> should be wrapped as inline.

代码块
多行代码可以使用 /

 标签。为了正确的展示代码,注意将尖括号做转义处理。

<pre>&lt;p&gt;Sample text here...&lt;/p&gt;</pre>

用户输入:

To switch directories, type <kbd>cd</kbd> followed by the name of the directory.<br>
To edit settings, press <kbd><kbd>ctrl</kbd> + <kbd>,</kbd></kbd>

变量:

<var>y</var> = <var>m</var><var>x</var> + <var>b</var>

程序输出:/

<samp>This text is meant to be treated as sample output from a computer program.</samp>

表格

为任意

标签添加 .table 类可以为其赋予基本的样式 — 少量的内补(padding)和水平方向的分隔线。

<table class="table">
  ...
</table>

条纹状表格
.table-striped类可以给

之内的每一行添加斑马条纹格式

<table class="table table-striped">
  ...
</table>

带边框的表格

<table class="table table-bordered">
  ...
</table>

鼠标悬停:.table-hover类

<table class="table table-hover">
  ...
</table>

紧缩表格
通过添加 .table-condensed 类可以让表格更加紧凑,单元格中的内补(padding)均会减半

<table class="table table-condensed">
  ...
</table>

状态类

.active	    鼠标悬停在行或单元格上时所设置的颜色
.success	标识成功或积极的动作
.info	    标识普通的提示信息或动作
.warning	标识警告或需要用户注意
.danger	    标识危险或潜在的带来负面影响的动作

通过这些状态类可以为行或单元格设置颜色

<!-- On rows -->
<tr class="active">...</tr>
<tr class="success">...</tr>
<tr class="warning">...</tr>
<tr class="danger">...</tr>
<tr class="info">...</tr>

<!-- On cells (`td` or `th`) -->
<tr>
  <td class="active">...</td>
  <td class="success">...</td>
  <td class="warning">...</td>
  <td class="danger">...</td>
  <td class="info">...</td>
</tr>

响应式表格
将任何 .table 元素包裹在 .table-responsive 元素内,即可创建响应式表格,其会在小屏幕设备上(小于768px)水平滚动。当屏幕大于 768px 宽度时,水平滚动条消失。

<div class="table-responsive">
  <table class="table">
    ...
  </table>
</div>

垂直方向内容截断
响应式表格使用了 overflow-y: hidden 属性,这样就能将超出表格底部和顶部的内容截断。特别是,也可以截断下拉菜单和其他第三方组件。
firefox问题https://stackoverflow.com/questions/17408815/fieldset-resizes-wrong-appears-to-have-unremovable-min-width-min-content/17863685#17863685

posted @ 2017-03-10 10:33  zhangshihai1232  阅读(162)  评论(0)    收藏  举报