一、代码

  • 内联代码:用<code>包裹,但是需要用<和>表示尖括号。
  • 键盘输入:用<kbd>包裹表示键盘输入的内容。
  • 多行代码:用<pre>包裹多行代码,同样需要对尖括号做转义处理。可以使用 .pre-scrollable 类,其作用是固定代码框大小设置 max-height 为 350px ,并在垂直方向展示滚动条
  • 变量:用<var>表示变量
  • 程序输出:<smp>表示程序输出

二、表格

1、基本表格

  1. <table>
  2. <thead>
  3. <tr>
  4. <th></th>
  5. <th></th>
  6. <th></th>
  7. <th></th>
  8. </tr>
  9. </thead>
  10. <tbody>
  11. <tr >
  12. <td>内容一</td>
  13. <td>内容二</td>
  14. <td>内容三</td>
  15. <td>内容四</td>
  16. </tr>
  17. <tr>
  18. <td>内容一</td>
  19. <td>内容二</td>
  20. <td>内容三</td>
  21. <td>内容四</td>
  22. </tr>
  23. </tbody>
  24. </table>

2、示例:

内容一 内容二 内容三 内容四
内容一 内容二 内容三 内容四

3、Bootsrap表格类

基本表格样式:

  • 定义表格: class="table"表示表格,赋予基本的样式 — 少量的内补(padding)和水平方向的分隔线
  • 斑马条纹:通过 .table-striped 类可以给 表格体之内的每一行增加斑马条纹样式
  • 表格边框:添加 .table-bordered 类为表格和其中的每个单元格增加边框
  • 悬停高亮:通过添加 .table-hover 类可以让每一行对鼠标悬停状态作出高亮响应
  • 表格紧缩:通过添加 .table-condensed 类可以让表格更加紧凑,单元格中的内补(padding)均会减半

特殊状态:

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

三、表单

1、基本表单

  1. <form>
  2. <div class="form-group">
  3. <label for="exampleInputEmail1">Email address</label>
  4. <input type="email" class="form-control" id="exampleInputEmail1" placeholder="Email">
  5. </div>
  6. <div class="form-group">
  7. <label for="exampleInputPassword1">Password</label>
  8. <input type="password" class="form-control" id="exampleInputPassword1" placeholder="Password">
  9. </div>
  10. <div class="form-group">
  11. <label for="exampleInputFile">File input</label>
  12. <input type="file" id="exampleInputFile">
  13. <p class="help-block">Example block-level help text here.</p>
  14. </div>
  15. <div class="checkbox">
  16. <label>
  17. <input type="checkbox"> Check me out
  18. </label>
  19. </div>
  20. <button type="submit" class="btn btn-default">Submit</button>
  21. </form>

2、Bootstrap表单

注意:
1 所有设置了 .form-control 类的输入框,文本框 和多选框 元素都将被默认设置宽度属性为 width: 100%;。 将 label 元素和前面提到的控件包裹在 .form-group 中可以获得最好的排列。
2 为了可读性和更好的添加各种类属性,尽量将每一个表单控件都单独放在一个div中。
3 为每一个input输入框都要添加label标签,这是为了屏幕阅读器识别表单。即使不想显示label元素,也可使用.sr-only 类将其隐藏。
4 做内联表单,并未input输入框添加图标的时候,需要将span和input标签维持在一个div中,并为div添加input-group类
5 多选框组的每一个多选框都要包裹在一个div中,并且在div添加类checkbox或者radio表示,单选则标签的name需要保持一致
6 反馈图标只能作用在具有form-control的input框上,并且需要在div包裹的内联span和input之外,否则会乱版
正确示例

  1. <div class="form-group has-success has-feedback">
  2. <label class="control-label" for="inputGroupSuccess1">Input group with success</label>
  3. <div class="input-group">
  4. <span class="input-group-addon">@</span>
  5. <input type="text" class="form-control" id="inputGroupSuccess1" aria-describedby="inputGroupSuccess1Status">
  6. </div>
  7. <span class="glyphicon glyphicon-ok form-control-feedback" aria-hidden="true"></span>
  8. <span id="inputGroupSuccess1Status" class="sr-only">(success)</span>
  9. </div>
  • 内联表单: .form-inline 类可使其内容左对齐并且表现为 inline-block 级别的控件
  • 水平排列:为表单添加 .form-horizontal 类,并联合使用 Bootstrap 预置的栅格类,可以将 label 标签和控件组水平并排布局。这样做将改变 .form-group 的行为,使其表现为栅格系统中的行(row),因此就无需再额外添加 .row 了
  • 控件尺寸:通过 .input-lg 类似的类可以为控件设置高度,通过 .col-lg-* 类似的类可以为控件设置宽度
  • 校验状态:为包裹表单控件的div添加has-success,has-warning,has-error表示不同的状态

四、按钮

一般可用按钮的元素

  1. <a class="btn btn-default" href="#" role="button">Link</a>
  2. <button class="btn btn-default" type="submit">Button</button>
  3. <input class="btn btn-default" type="button" value="Input">
  4. <input class="btn btn-default" type="submit" value="Submit">

对于a,作为按钮添加了role="button",此时已完全失去了链接的作用,而在导航的时候,只能使用button作为按钮,所以最好使用button用作按钮

  • 不同状态

    • btn-default:默认
    • btn-primary:首选项
    • btn-success:成功
    • btn-info:一般信息
    • btn-warning:警告
    • btn-danger":危险
    • btn-link:链接
  • 不同尺寸:使用 .btn-lg、.btn-sm 或 .btn-xs 就可以获得不同尺寸的按钮
  • 块级按钮:添加btn-block可以使整个按钮占据整个控件

五、练习

简单的登陆页面样式

1、代码

  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>login</title>
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  7. <link rel="stylesheet" href="./css/bootstrap.css">
  8. <style>
  9. body{
  10. padding:0;
  11. margin:0;
  12. }
  13. #bg{width:100%;height:100%;position:absolute;z-index:-1;opacity: 0.8}
  14. #login{position:absolute;left:22.5%;top:40%;margin-left:-150px;margin-top:-100px; }
  15. </style>
  16. </head>
  17. <body>
  18. <div class="container" id="login">
  19. <div class="row">
  20. <div class="text-center"><h3> Please Login</h3></div>
  21. </div>
  22. <div class="row table-bordered">
  23. <div class="col-md-6">
  24. <h3 class="text-center text-capitalize"> my blog </h3>
  25. <p>记录点滴,记录成长,Adobe LiveCycle Document Security Server提供了在PDF表单和文档中支持的文档加密和数字签名服务。Adobe LiveCycle Document
  26. Security Server provides services for document encryption and digital signature support on PDF forms and
  27. documents</p>
  28. <blockquote class="blockquote-reverse">
  29. <p>stay hungry stay foolish<cite title="lincoln">————Ahrabam Lincoln</cite></p>
  30. </blockquote>
  31. </div>
  32. <div class="col-md-6">
  33. <br>
  34. <form role="form" class=" form-horizontal">
  35. <div class="form-group has-feedback">
  36. <label for="Email" class="control-label col-md-2">Email:</label>
  37. <div class="col-md-10">
  38. <div class="input-group">
  39. <span class="input-group-addon" style="BACKGROUND-COLOR: transparent;">@</span>
  40. <input type="email" class="form-control" id="Email" placeholder="Email" style="BACKGROUND-COLOR: transparent;"
  41. aria-describedby="EmailHelp" autofocus required>
  42. </div>
  43. <span class="glyphicon glyphicon-ok form-control-feedback"></span>
  44. <span class="help-block sr-only" id="EmailHelp">Correct Email</span>
  45. </div>
  46. </div>
  47. <div class="form-group has-feedback">
  48. <label for="password4" class="control-label col-md-2">Password:</label>
  49. <div class="col-md-10">
  50. <div class="input-group">
  51. <span class="input-group-addon" style="BACKGROUND-COLOR: transparent;">&nbsp;=&nbsp;</span>
  52. <input type="password" class="form-control" id="password4"
  53. style="BACKGROUND-COLOR: transparent;" placeholder="Password">
  54. </div>
  55. <span class="glyphicon glyphicon-remove form-control-feedback" aria-hidden="true"></span>
  56. </div>
  57. </div>
  58. <div class="col-md-offset-2">
  59. <label class="radio-inline">
  60. <input type="radio" name="role" value="student" checked> 学生
  61. </label>
  62. <label class="radio-inline">
  63. <input type="radio" name="role" value="teacher"> 老师
  64. </label>
  65. <label class="radio-inline">
  66. <input type="radio" name="role" value="admin" disabled> 管理员
  67. </label>
  68. <br>
  69. <br>
  70. <div class="form-inline">
  71. <button class="btn btn-primary" style="BACKGROUND-COLOR: transparent;">登录入口</button>
  72. <button class="btn btn-primary" style="BACKGROUND-COLOR: transparent;" disabled>登录入口2</button>
  73. <button class="btn btn-link">注册</button>
  74. </div>
  75. </div>
  76. </form>
  77. </div>
  78. </div>
  79. </div>
  80. <img id="bg" src="./img/1.jpg" alt="..." class="img-rounded img-responsive">
  81. </body>
  82. </html>

2、示例

前端学习 之 Bootstrap(二)的更多相关文章

  1. 前端学习之Bootstrap学习

    一,Bootstrap简介 在前端世界,有个叫Bootstrap的家伙,,是twitter 开源出来的一套前端框架,利用Ta可以快速开发网站界面,它的特点就是比自己从头写简单,直观,方便,快捷,省劲. ...

  2. 前端学习(十二):CSS排版

    进击のpython ***** 前端学习--CSS排版 本节主要介绍网页排版中主要格式化元素属性 帮助开发者把css技术与网页排版紧密联系到一起,来更好的实现网页设计效果 字体属性 字体 在日常工作中 ...

  3. 【repost】前端学习总结(二十三)——前端框架天下三分:Angular React 和 Vue的比较

    目录(?)[+]   前端这几年的技术发展很快,细分下来,主要可以分成四个方面: 1.开发语言技术,主要是ES6&7,coffeescript,typescript等: 2.开发框架,如Ang ...

  4. 前端学习 之 Bootstrap (一)

    中文文档 一.前言 1.简介 Bootsrtap作为一个前端框架,开箱即用,封装了前段开发的大量底层细节,开放灵活,对响应式设计网页很好支持,组件丰富,社区活跃. 特点: 可重用性 一致性 灵活的栅栏 ...

  5. web前端学习笔记(二)---Django

    [前言]前面(一)学习了web的基础知识,介绍到了MVC,项目使用一个Django框架. Django book:https://code.ziqiangxuetang.com/django/djan ...

  6. bootstrap基础学习小记(二)排版、列表、代码风格、表格

    排版——标题.副标题.段落(正文文本).强调内容.粗体.斜体.强调相关的类.文本对齐 <!DOCTYPE HTML> <html> <head> <meta ...

  7. Yii框架学习笔记(二)将html前端模板整合到框架中

    选择Yii 2.0版本框架的7个理由 http://blog.chedushi.com/archives/8988 刚接触Yii谈一下对Yii框架的看法和感受 http://bbs.csdn.net/ ...

  8. web前端学习python之第一章_基础语法(二)

    web前端学习python之第一章_基础语法(二) 前言:最近新做了一个管理系统,前端已经基本完成, 但是后端人手不足没人给我写接口,自力更生丰衣足食, 所以决定自学python自己给自己写接口哈哈哈 ...

  9. 前端学习(四):body标签(二)

    进击のpython ***** 前端学习--body标签 接着上一节,我们看一下还有没有什么网址 果不其然,在看到新闻类的网址的时候 我们发现还有许多的不一样的东西! 使用ul,添加新闻信息列表 这个 ...

随机推荐

  1. Python - 使用pycallgraph生成函数关系图

    1- pycallgraph简介 可用于创建python函数关系图,依赖于dot命令,需要先安装 graphviz: HomePage:http://pycallgraph.slowchop.com/ ...

  2. Kubernetes 新时代的宠儿

    本文首发于我的公众号 Linux云计算网络(id: cloud_dev),专注于干货分享,号内有 10T 书籍和视频资源,后台回复「1024」即可领取,欢迎大家关注,二维码文末可以扫. Kuberne ...

  3. 设置build.gradle打包时自动加时间

    在build.gradle中添加以下函数: def releaseTime() { return new Date().format("yyyyMMddHHmm", TimeZon ...

  4. 剑指offer例题分享--4

    前言:搁置许久的更新要继续开始了!前一段时间一直在忙项目和C++的学习,所以搁置了!要改变注意了,要用C++进行编写了,因为要不断练习C++! 面试题15: 书中要求只能遍历链表一次,所以代码如下: ...

  5. HDU 1006 Digital Roots

    Problem Description The digital root of a positive integer is found by summing the digits of the int ...

  6. java--uploadify3.1多文件上传

    使用uploadify时,建议下载uploadify3.1文档.边做边看. 这是页面端: <label style="color:#15428B;font-weight:bold;&q ...

  7. C#系列之聊聊.Net Core的InMemoryCache

    作者:暴王 个人博客:http://www.boydwang.com/2017/12/net-core-in-memory-cache/ 这两天在看.net core的in memory cache, ...

  8. 非业务 Oracle SQL 语句备份

    1.创建一个将 Oracle 生成的 GUID 格式化为标准的 GUID 的函数 2.在 PLSQL 中测试并输出语句异常的语句块 3.在查询语句中日期的一种特殊表示方法 4.利用 ROWNUM 做分 ...

  9. python练习四—简单的聊天软件

    python最强大的是什么?库支持!!有了强大的库支持,一个简单的聊天软件实现就更简单了,本项目思路如下 # 项目思路 1. 服务器的工作 * 初始化服务器 * 新建一个聊天房间 * 维护一个已链接用 ...

  10. 【杂谈】tocmat是何时写回响应数据报的

    疑问的产生 这个疑问是我在写文件下载的时候产生的,我是用HttpServletResponse获取到Outputstream,然后利用OutputStream直接写数据的.当时我就想这个OutputS ...