Bootstrap标题样式进行了以下显著的优化重置:

1、重新设置了margin-topmargin-bottom的值,  h1~h3重置后的值都是20pxh4~h6重置后的值都是10px。
2、所有标题的行高都是1.1(也就是font-size的1.1倍),而且文本颜色和字体都继承父元素的颜色和字体。
3、固定不同级别标题字体大小,h1=36px,h2=30px,h3=24px,h4=18px,h5=14pxh6=12px。

标题的具体运用非常简单,和我们平时运用是一样的,使用<h1>~<h6>标签,分别表示标题一至标题六,h 后面的数字越大,表示级别越小,文本也越小。来看一个简单的效果:右侧代码编辑器中的10-16行的代码。

在Bootstrap中为了让非标题元素和标题使用相同的样式,还特意定义了.h1~.h6六个类名。如右侧代码编辑器中   18-23行代码所示:

对比两个示例的效果图,可以说他们的效果是一模一样的。

<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>标题(一)</title>
<link rel="stylesheet" href="http://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css">
</head> <body>
<!--Bootstrap中的标题-->
<h1>Bootstrap标题一</h1>
<h2>Bootstrap标题二</h2>
<h3>Bootstrap标题三</h3>
<h4>Bootstrap标题四</h4>
<h5>Bootstrap标题五</h5>
<h6>Bootstrap标题六</h6> <!--Bootstrap中让非标题元素和标题使用相同的样式-->
<div class="h1">Bootstrap标题一</div>
<div class="h2">Bootstrap标题二</div>
<div class="h3">Bootstrap标题三</div>
<div class="h4">Bootstrap标题四</div>
<div class="h5">Bootstrap标题五</div>
<div class="h6">Bootstrap标题六</div> <!--任务填写下方-->
<h1>我的第一个bootstrap标题</h1>
</body>
</html>

常常会碰到在一个标题后面紧跟着一行小的副标题。在Bootstrap中他也考虑了这种排版效果,使用了<small>标签来制作副标题。这个副标题具有其自己的一些独特样式:

1、行高都是1,而且font-weight设置了normal变成了常规效果(不加粗),同时颜色被设置为灰色(#999)。
2、由于<small>内的文本字体在h1~h3内,其大小都设置为当前字号的65%;而在h4~h6内的字号都设置为当前字号的75%;
详细代码请参阅bootstrap.css文件中第407行~第443行。

h1 small,
.h1 small,
h2 small,
.h2 small,
h3 small,
.h3 small,
h1 .small,
.h1 .small,
h2 .small,
.h2 .small,
h3 .small,
.h3 .small {
font-size: 65%;
}
h4,
.h4,
h5,
.h5,
h6,
.h6 {
margin-top: 10px;
margin-bottom: 10px;
}
h4 small,
.h4 small,
h5 small,
.h5 small,
h6 small,
.h6 small,
h4 .small,
.h4 .small,
h5 .small,
.h5 .small,
h6 .small,
.h6 .small {
font-size: 75%;
}

来简单看其使用方法与最终效果:如右侧代码编辑器中12-17行代码所示。

<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>标题(二)</title>
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css">
</head> <body> <!--Bootstrap中使用了<small>标签来制作副标题-->
<h1>Bootstrap标题一<small>我是副标题</small></h1>
<h2>Bootstrap标题二<small>我是副标题</small></h2>
<h3>Bootstrap标题三<small>我是副标题</small></h3>
<h4>Bootstrap标题四<small>我是副标题</small></h4>
<h5>Bootstrap标题五<small>我是副标题</small></h5>
<h6>Bootstrap标题六<small>我是副标题</small></h6> <!--任务填写处-->
<h1>孤儿院无私奉献30年<small>一曲人性的赞歌</small></h1> </body>
</html>

最新文章

  1. u3d_shader_surface_shader_4
  2. 快乐的JS正则表达式(三)
  3. Struts2 学习笔记 11 Result part2
  4. spring框架中一个跟String的trim方法一样的方法
  5. UITabBar - 深度解剖
  6. INFORMATION_SCHEMA.COLUMNS 查询表字段语句
  7. Python自动化测试、性能测试成长路线图
  8. Matplotlib学习---用matplotlib画阶梯图(step plot)
  9. PythonStudy——赋值运算符 Assignment operator
  10. 深入浅出 JVM GC(1)
  11. 【windows核心编程】双机调试操作
  12. QString和char*互转
  13. Maven install报MojoFailureException
  14. Kafka auto.offset.reset
  15. ANSI C 常见宏的使用
  16. 微信公众号平台开发(二)信息的分类.md
  17. 记换换回收一个js逆向分析
  18. VCL 中的 Windows API 函数(6): BeginDeferWindowPos
  19. 《全民无双》锁链刀光程序生成算法,即U3D——刀光轨迹插件的改进
  20. Wilcoxon符号秩+秩和检验学习[转载]

热门文章

  1. Stockbroker Grapevine - poj 1125 (Floyd算法)
  2. python 基础 9.11 更改数据
  3. EasyNVR无插件H5/HLS/m3u8直播解决方案中Windows系统服务启动错误问题的修复:EasyNVR_Service 服务因 函数不正确。 服务特定错误而停止。
  4. 新升级!EasyNVR3.0功能概述--直播与录像
  5. java Filter的简单使用
  6. The hidden layers are either convolutional, pooling or fully connected.
  7. 20179209《Linux内核原理与分析》第十一周作业
  8. POJ3094 Sky Code(莫比乌斯反演)
  9. Netbeans8.0设置Consola字体并解决中文乱码问题
  10. apche安装教程