BootStrap使用

BootStrap简单使用

  《深入理解BootStrap》这本书对BootStrap进行了全面的讲解包括设计思想以及源码解析对没有接触过的很有帮助

  BootStrap可以说是最简单的一类框架了,使用它确实不能给我们带来一些功能上的提升,不过在一些系统开发时可以为我们的开发速度带来很大的提升。有时候会用但是用的不多,时间一长难免会忘,所以写了一些常用插件的基本使用方法,以方便查阅

  BootStrap--响应式布局

  BootStrap--滚动侦测

  BootStrap--选项卡

  BootStrap--提示框

  BootStrap--下拉菜单

  BootStrap--模态弹窗

样式使用

  BootStrap在样式上使用的套路基本上一致的都是从统一到具体,比如按钮元素的使用为<button class="btn btn-success">ok</button>,前面的class定义了一些基本的公用的样式,后面根据我们的需要在使用特定的class

  在使用BootStrap是一般我们经常使用的元素通常就是按钮、导航条、表单元素、面板+表格

  按钮的使用很简单(为了语义化我们通常使用button元素或者a元素)

<button class="btn btn-success">ok</button>

  按钮组

<div class="btn-group">
    <button class="btn btn-success">success</button>
    <button class="btn btn-warning">warning</button>
    <button class="btn btn-default">default</button>
</div>

  导航条

<nav class="navbar navbar-default" role="navigation">
    <div class="navbar-header">
        <a class="navbar-brand" href="#">Brand</a>
    </div>
    <ul class="nav navbar-nav">
        <li class="active"><a href="#">active</a></li>
        <li><a href="#">Link</a></li>
        <li class="disabled"><a href="#">disabled</a></li>
        <li><a href="#">Link</a></li>
    </ul>
</nav>

  表单元素我们经常使用的就是form-group和input-group,折两种元素width都是100%所以通常结合栅格系统使用

  form-group就是提示信息和输入框的结合

<div class="form-group">
    <label>登录账户</label>
    <input type="email" class="form-control" placeholder="请输入你的用户名或Email">
</div>

  

  input-group是在对输入框的改变,一般是在输入框的左边或者右边添加修饰

<div class="input-group">
    <span class="input-group-addon">$</span>
    <input type="text" class="form-control">
    <span class="input-group-addon">.00</span>
</div>

  面板

<div class="panel panel-default">
    <div class="panel-heading">面板header</div>
    <div class="panel-body">
    这里是面板内容
    </div>
    <div class="panel-footer">面板footer</div>
</div>

  表格

<table class="table table-bordered">
    <thead>
        <tr>
            <th>姓名</th>
            <th>年龄</th>
            <th>地址</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>张三</td>
            <td>23</td>
            <td>某屯</td>
        </tr>
        <tr>
            <td>李四</td>
            <td>23</td>
            <td>某庄</td>
        </tr>
    </tbody>
</table>

  通常我们在使用方式为面板+表格,由面板提供表名,由表格提供内容

<div class="panel panel-default">
    <div class="panel-heading center">
        人员信息
    </div>
    <table class="table table-bordered">
    <thead>
        <tr>
            <th>姓名</th>
            <th>年龄</th>
            <th>地址</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>张三</td>
            <td>23</td>
            <td>某屯</td>
        </tr>
        <tr>
            <td>李四</td>
            <td>23</td>
            <td>某庄</td>
        </tr>
    </tbody>
</table>

  

时间: 2024-08-06 03:02:38

BootStrap使用的相关文章

Bootstrap + AngularJS+ Ashx + SQL Server/MySQL

去年年底12月,为适应移动端浏览需求,花了1个月时间学习Bootstrap,并将公司ASP网站重构成ASP.NET. 当时采取的网站架构: Bootstrap + jQuery + Ashx + SQL Server 时间紧,没人带,只能硬着头皮,最后如期完成,但是也遗留了几个问题. 问题: 1.页面查询条件太复杂,太多的checkbox,jQuery操作DOM虽然方便,但是组合成json提交给后端还是比较麻烦,有没有天然支持json的前端框架或者脚本语言? html控件做的任何修改,都自动保存

CSS,bootstrap表格控制当td内容过长时用省略号表示,以及在不使用bootstrap时过长也用省略号表示

首先需要在table中设置table-layout:fixed; <table style="table-layout:fixed"></table> 然后在表头th中设置每列的宽度 <table style="table-layout:fixed"> <th width="10%">Title01</th> <th width="20%">Title02

Bootstrap &amp; Font Awesome 学习笔记

学习网站:http://bootstrap.ninghao.net/index.html https://www.freecodecamp.cn http://www.runoob.com/bootstrap/bootstrap-tutorial.html Bootstrap 为快速简单的实施 Web 开发准备的前端架构. Bootstrap将会根据你的屏幕的大小来调整HTML元素的大小 -- 强调 响应式设计的概念. 通过响应式设计,你无需再为你的网站设计一个手机版的.它在任何尺寸的屏幕上看起

第二百三十八节,Bootstrap输入框和导航组件

Bootstrap输入框和导航组件 学习要点: 1.输入框组件 2.导航组件 3.导航条组件 本节课我们主要学习一下Bootstrap的两个个组件功能:输入框组件和导航导航条组件. 一.输入框组件 文本输入框就是可以在<input>元素前后加上文字或按钮,可以实现对表单控件的扩展. 在左侧添加文字 input-group-addon样式class类,写在input同级的span里,给输入框添加一个左片段(Bootstrap)input-group样式class类,写在input外层div里,将

第二百三十一节,Bootstrap 介绍

Bootstrap 介绍 学习要点: 1.Bootstrap 概述 2.Bootstrap 特点 3.Bootstrap 结构 4.创建第一个页面 5.学习的各项准备 本节课我们主要了解一下 Boostrap 历史.特点.用途,以及为什么选择 Boostrap 来开 发我们的 Web 项目. 一.Bootstrap 概述 Bootstrap 是由 Twitter 公司(全球最大的微博)的两名技术工程师研发的一个基于 HTML.CSS.JavaScript 的开源框架.该框架代码简洁.视觉优美,可

Flask---使用Bootstrap新建第一个demo

Flask---使用Bootstrap新建第一个demo 参考自http://www.jianshu.com/p/417bcbad82fb 还有<Flask web开发> 前端用到Bootstrap开源框架,Bootstrap是客户端框架,后台当然就是Flask了. 服务器需要做的只是提供引用了Bootstrap层叠样式表(CSS)和JS文件的html响应,并且在html.css和js代码中实例化需要的组件,这些操作的最理想的执行环境就是模板 关于模板的介绍及其实现原理:https://kb.

bootstrap中的对话框-dialog

<!DOCTYPE html><html> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0" /> <meta http-

bootstrap中的对话框-dialog-2

<!DOCTYPE html><html> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0" /> <meta http-

关于H5框架之Bootstrap的小知识

浏览器支持 旧的浏览器可能无法很好的支持 Bootstrap 支持 Internet Explorer 8 及更高版本的 IE 浏览器 CSS源码研究 我们不是在head里面引入了下面这些文件么 <!-- 新 Bootstrap 核心 CSS 文件 --> <link rel="stylesheet" href="http://cdn.bootcss.com/bootstrap/3.3.0/css/bootstrap.min.css"> &l

Bootstrap 之 Carousel

Bootstrap 轮播(Carousel)插件是一种灵活的响应式的向站点添加滑块的方式.除此之外,内容也是足够灵活的,可以是图像.内嵌框架.视频或者其他您想要放置的任何类型的内容. 如果您想要单独引用该插件的功能,那么您需要引用 carousel.js.或者,正如 Bootstrap 插件概览 一章中所提到,您可以引用 bootstrap.js 或压缩版的 bootstrap.min.js. 下面是一个简单的幻灯片,使用 Bootstrap 轮播(Carousel)插件显示了一个循环播放元素的