Bootstrap -- 表格样式、表单布局

1. 表格的一些样式

举例:

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>My Test bootstrap</title>
<link rel="stylesheet" href="./css/bootstrap.min.css">
<script type="text/javascript" src="./js/bootstrap.min.js"></script>
</head>
<body>
<table class="table table-striped">
<caption>这是一个测试表格</caption>
<thead>
<tr>
<th>姓名</th>
<th>年龄</th>
<th>地区</th>
</tr>
</thead>
<tbody>
<tr>
<td>小胡子</td>
<td>26</td>
<td>陕西</td>
</tr>
<tr>
<td>大胡子</td>
<td>26</td>
<td>北京</td>
</tr>
</tbody>
</table>
</body>
</html>

页面效果:

2. 表格行或单元格的样式

举例:

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>My Test bootstrap</title>
<link rel="stylesheet" href="./css/bootstrap.min.css">
<script type="text/javascript" src="./js/bootstrap.min.js"></script>
</head>
<body>
<table class="table table-striped">
<caption>这是一个测试表格</caption>
<thead>
<tr>
<th>姓名</th>
<th>年龄</th>
<th>地区</th>
</tr>
</thead>
<tbody>
<tr class="info">
<td>小胡子</td>
<td>26</td>
<td>陕西</td>
</tr>
<tr class="warning">
<td>大胡子</td>
<td>26</td>
<td>北京</td>
</tr>
</tbody>
</table>
</body>
</html>

页面效果:

3. 表单布局

(1)垂直表单:

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>My Test bootstrap</title>
<link rel="stylesheet" href="./css/bootstrap.min.css">
<script type="text/javascript" src="./js/bootstrap.min.js"></script>
</head>
<body>
<form role="form">
<div class="form-group">
<label for="name">姓名</label>
<input type="text" class="form-control" id="name" placeholder="请输入姓名">
</div>
<div class="form-group">
<label for="inputfile">选择文件</label>
<input type="file" id="inputfile">
</div>
<button type="submit" class="btn btn-default">提交</button>
</form>
</body>
</html>

效果:

(2)内联表单:它的所有元素是内联的,向左对齐的,标签是并排的

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>My Test bootstrap</title>
<link rel="stylesheet" href="./css/bootstrap.min.css">
<script type="text/javascript" src="./js/bootstrap.min.js"></script>
</head>
<body>
<form role="form" class="form-inline">
<div class="form-group">
<label for="name">姓名</label>
<input type="text" class="form-control" id="name" placeholder="请输入姓名">
</div>
<div class="form-group">
<label for="inputfile">选择文件</label>
<input type="file" id="inputfile">
</div>
<button type="submit" class="btn btn-default">提交</button>
</form>
</body>
</html>

效果:

(3)水平表单:水平表单与其他表单不仅标记的数量上不同,而且表单的呈现形式也不同

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>My Test bootstrap</title>
<link rel="stylesheet" href="./css/bootstrap.min.css">
<script type="text/javascript" src="./js/bootstrap.min.js"></script>
</head>
<body>
<form role="form" class="form-horizontal">
<div class="form-group">
<label for="name" class="col-sm-2 control-label">姓名</label>
<div class="col-sm-10">
<input type="text" class="form-control" id="name" placeholder="请输入姓名">
</div>
</div>
<div class="form-group">
<label for="inputfile" class="col-sm-2 control-label">选择文件</label>
<div class="col-sm-10">
<input type="file" id="inputfile">
<div>
</div>
<div class="form-group">
<div class="col-sm-12">
<button type="submit" class="btn btn-default">提交</button>
</div>
</div>
</form>
</body>
</html>

效果:

Bootstrap -- 表格样式、表单布局的更多相关文章

  1. 推荐的bootstrap之 formgroup表单布局样式

    一直没能找到比较好的Form Group样式,直到找到如下样式 转自 https://www.cnblogs.com/jokerjason/p/5721349.html <form class= ...

  2. bootstrap之 formgroup表单布局样式

    <form class="form-horizontal" role="form"> <fieldset> <legend> ...

  3. BootStrap入门教程 (二) :BASE CSS(排版(Typography),表格(Table),表单(Forms),按钮(Buttons))

    上讲回顾:Bootstrap的手脚架(Scaffolding)提供了固定(fixed)和流式(fluid)两种布局,它同时建立了一个宽达940px和12列的格网系统. 基于手脚架(Scaffoldin ...

  4. 一步一步学习Bootstrap系列--表单布局

    前言:Bootstrap 属于前端 ui 库,通过现成的ui组件能够迅速搭建前端页面,简直是我们后端开发的福音,通过几个项目的锻炼有必要总结些常用的知识,本篇把常用的Bootstrap表单布局进行归纳 ...

  5. Bootstrap<基础六> 表单

    Bootstrap 通过一些简单的 HTML 标签和扩展的类即可创建出不同样式的表单. 表单布局 Bootstrap 提供了下列类型的表单布局: 垂直表单(默认) 内联表单 水平表单 垂直或基本表单 ...

  6. bootstrap+jQuery.validate表单校验

    谈谈表单校验 这大概是一种惯例,学习前台后台最开始接触的业务都是用户注册和登录.现在社会坚持以人为本的理念,在网站开发过程同样如此.User是我们面对较多的对象,也是较核心的对象.最开始的用户注册和登 ...

  7. HTML&CSS精选笔记_表格与表单

    表格与表单 表格标记 创建表格 要想创建表格,就需要使用表格相关的标记 <table>     <tr>     <td>单元格内的文字</td>   ...

  8. 基于表单布局:分析过时的table结构与当下的div结构

    一些话在前面 最近做了百度前端学院一个小任务,其中涉及到表单布局的问题, 它要处理的布局问题:左边的标签要右对齐,右边的输入框.单选按钮等要实现左对齐. 从开始入门就被告知table布局已经过时了,当 ...

  9. css011 表格和表单的格式化

    css011 表格和表单的格式化 一.    让表格专司其职    Html中创建一个三行三列的表格 <table> <caption align="bottom" ...

随机推荐

  1. 祝雷(依乐祝):一份来自29岁.NET老程序员的自白

    潘老师的文笔果然了得,经过潘老师的妙笔生花后,文章的阅读体验果然好了很多!这里再次感谢潘老师的支持! 祝雷(合肥.NET 俱乐部发起人) [个人介绍] 博客园知名博主(依乐祝).6年以上.NET技术栈 ...

  2. 强如 Disruptor 也发生内存溢出?

    前言 OutOfMemoryError 问题相信很多朋友都遇到过,相对于常见的业务异常(数组越界.空指针等)来说这类问题是很难定位和解决的. 本文以最近碰到的一次线上内存溢出的定位.解决问题的方式展开 ...

  3. Python接口自动化

    1.unittest单元测试框架&接口介绍 2.接口测试框架设计 3.接口的安全机制 4.Mock服务介绍&实现原理 5.Jenkins使用和配置 6 .发送邮箱设置

  4. IntelliJ IDEA 导入新项目

    在现有的idea中close project 关闭当前项目, 然后import project

  5. leetcode — remove-duplicates-from-sorted-list

    /** * Source : https://oj.leetcode.com/problems/remove-duplicates-from-sorted-list/ * * * Given a so ...

  6. 用javaweb连接数据库用javabean、severlet实现增删改查

    样 很重要的一点是建立数据库的连接 数据库是一切操作的前提 不管是增加 删除 修改 查询 都需要调用数据库连接程序 再就是java的类的编写  写完类后需要对其进行增删改查方法的 编写 这是dao层的 ...

  7. BootStrap之 提示工具(Tooltip)插件

    <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title> ...

  8. 查看Windows电脑上.NET Framework版本的方法(找了好久的方法)

    照网上大多数人的方法,在路径 C:\Windows\Microsoft.NET\Framework 下可以查看到.NET Framework的版本,不过无论Win7还是Win10,显示都是这样的: 那 ...

  9. Php中的goto用法

    我们先举个简单示例: <?php goto LABEL; //这个标签自定义 echo '乔峰'; LABEL: echo '鸠摩智'; 以上例程会输出:鸠摩智 解释:goto 操作符可以用来跳 ...

  10. Spring笔记01_下载_概述_监听器

    目录 Spring笔记01 1.Spring介绍 1.1 Spring概述 1.2 Spring好处 1.3 Spring结构体系 1.4 在项目中的架构 1.5 程序的耦合和解耦 2. Spring ...