Bootstrap入门与布局教程
- 格式:pptx
- 大小:3.64 MB
- 文档页数:36
一、概述Bootstrap是一个用于快速开发响应式网页的前端框架,其具有易用性和功能丰富的特点,广泛应用于各种网页开发中。
本文将介绍Bootstrap的基础教程以及相关案例代码,帮助读者快速掌握Bootstrap的使用方法。
二、Bootstrap基础教程1. 栅格系统Bootstrap基于12列的栅格系统,可以轻松实现页面布局。
以下是一个简单的例子:```html<div class="cont本人ner"><div class="row"><div class="col-md-4">.col-md-4</div><div class="col-md-4">.col-md-4</div><div class="col-md-4">.col-md-4</div></div></div>```在这个例子中,页面被分成了三列,每一列占据了页面宽度的1/3。
2. 响应式工具类Bootstrap提供了一系列的响应式工具类,可以根据不同的屏幕尺寸来显示或隐藏元素。
要在小屏幕设备上隐藏一个元素,可以使用`d-none d-sm-block`类:```html<div class="d-none d-sm-block">在小屏幕设备上隐藏该元素</div>```3. 按钮Bootstrap提供了丰富的按钮样式,可以轻松地创建不同风格的按钮。
以下是一个简单的例子:```html<button type="button" class="btn btn-primary">Primary按钮</button><button type="button" class="btn btn-secondary">Secondary按钮</button>```4. 表格使用Bootstrap可以轻松创建各种样式的表格。
BootStrap⼊门教程(⼀)之可视化布局HTML模板:<!DOCTYPE html><html><head><title>Bootstrap 模板</title><meta name="viewport" content="width=device-width, initial-scale=1.0"><!-- 引⼊ Bootstrap --><link href="/libs/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"><!-- HTML5 Shim 和 Respond.js ⽤于让 IE8 ⽀持 HTML5元素和媒体查询 --><!-- 注意:如果通过 file:// 引⼊ Respond.js ⽂件,则该⽂件⽆法起效果 --><!--[if lt IE 9]><script src="https:///libs/html5shiv/3.7.0/html5shiv.js"></script><script src="https:///libs/respond.js/1.3.0/respond.min.js"></script><![endif]--></head><body><h1>Hello, world!</h1><!-- jQuery (Bootstrap 的 JavaScript 插件需要引⼊ jQuery) --><script src="https:///jquery.js"></script><!-- 包括所有已编译的插件 --><script src="js/bootstrap.min.js"></script></body></html> 在这⾥,您可以看到包含了 jquery.js、bootstrap.min.js 和 bootstrap.min.css ⽂件,⽤于让⼀个常规的 HTML ⽂件变为使⽤了 Bootstrap 的模板。
Bootstrap每天必学之栅格系统(布局)1、栅格系统(布局)Bootstrap内置了⼀套响应式、移动设备优先的流式栅格系统,随着屏幕设备或视⼝(viewport)尺⼨的增加,系统会⾃动分为最多12列。
我在这⾥是把Bootstrap中的栅格系统叫做布局。
它就是通过⼀系列的⾏(row)与列(column)的组合创建页⾯布局,然后你的内容就可以放⼊到你创建好的布局当中。
下⾯就简单介绍⼀下Bootstrap栅格系统的⼯作原理:⽹格系统的实现原理⾮常简单,仅仅是通过定义容器⼤⼩,平分12份(也有平分成24份或32份,但12份是最常见的),再调整内外边距,最后结合媒体查询,就制作出了强⼤的响应式⽹格系统。
Bootstrap框架中的⽹格系统就是将容器平分成12份。
在使⽤的时候⼤家可以根据实际情况重新编译LESS(或Sass)源码来修改12这个数值(也就是换成24或32,当然你也可以分成更多,但不建议这样使⽤)。
2、使⽤规则Bootstrap内置了⼀套响应式、移动设备。
1、数据⾏(.row)必须包含在容器(.container)中,以便为其赋予合适的对齐⽅式和内距(padding)。
如:<div class="container"><div class="row"></div></div>2、在⾏(.row)中可以添加列(.column),但列数之和不能超过平分的总列数,⽐如12。
如:<div class="container"><div class="row"><div class="col-md-4"></div><div class="col-md-8"></div>3、具体内容应当放置在列容器(column)之内,⽽且只有列(column)才可以作为⾏容器(.row)的直接⼦元素4、通过设置内距(padding)从⽽创建列与列之间的间距。
bootstrap 步骤
Bootstrap的使用步骤如下:
1.创建文件夹:按照以往的习惯创建文件夹。
2.下载Bootstrap:在官网下载压缩包,选择下载生产环境的压缩包,将
其解压到项目目录下,但是不能覆盖你自己建的文件夹。
3.创建html骨架结构:先正常搭建一个html页面,然后再选中“基础模
板”中的所需代码,复制到你自己搭建的html页面中。
4.引入相关样式文件:使用link标签引入css文件,这里以min.css为
例。
5.书写内容:正常输入内容,如果发现内容没有了浏览器默认的内外边
距,则证明css文件引入成功。
6.使用:这里使用按钮为例。
在全局css中选中按钮,根据预定义样式选
中你所需要的css按钮样式,然后复制对应的代码到你搭建好的
Bootstrap结构中并允许查看成功与否。
请注意,以上步骤是使用Bootstrap的基本步骤,但具体实现会根据具体的应用场景和需求有所变化。
本作品由VentLam创作,采用知识共享署名-非商业性使用-相同方式共享2.5 中国大陆许可协议进行许可。
BootStrap入门教程(一)2011年,twitter的“一小撮”工程师为了提高他们内部的分析和管理能力,用业余时间为他们的产品构建了一套易用、优雅、灵活、可扩展的前端工具集--BootStrap。
Bootstrap由MARK OTTO和Jacob Thornton所设计和建立,在github上开源之后,迅速成为该站上最多人watch&fork的项目。
大量工程师踊跃为该项目贡献代码,社区惊人地活跃,代码版本进化非常快速,官方文档质量极其高(可以说是优雅),同时涌现了许多基于Bootstrap建设的网站:界面清新、简洁;要素排版利落大方。
如下图所示:https:///http://www.fleetio.co m/GitHub上这样介绍bootstrap:简单灵活可用于架构流行的用户界面和交互接口的html,css,javascript工具集。
基于html5、css3的bootstrap,具有大量的诱人特性:友好的学习曲线,卓越的兼容性,响应式设计,12列格网,样式向导文档,自定义JQuery插件,完整的类库,基于Less等。
本系列教程遵循官方文档结构来介绍bootstrap,包括手脚架(Scaffolding),基础CSS,组件,javascript插件,使用LESS与自定义.本文主要介绍Boo tstrap的基础布局--Scaffolding.Bootstrap建立了一个响应式的12列格网布局系统,它引入了fixed和fluid-with两种布局方式。
我们从全局样式(Global Style),格网系统(Grid System),流式格网(Fluid grid System),自定义(Customing),布局(Layouts),响应式设计(Responsive Design)这六五个方面深入讲解Boostrap的scaffolding.全局样式(Global Style).Bootstrap要求html5的文件类型,所以必须在每个使用bootstrap页面的开头都引用:<!DOCTYPE html><html lang="en"> ...</html>2同时,它通过Bootstrap.less文件来设置全局的排版和连接显示风格.其中去掉了Body的margin,使用@baseFontFamily,@baseFontSize,@linkColor等变量来控制基本排版。
第1章Bootstrap简介1-1 Bootstrap简介1、BootStrp是简单灵活用于搭建Web页面的HTML、CSS、JavaScript的工具集、整体形成前端开发框架2、基于html5、css3的bootstrap,具有大量诱人的特性:(1)漂亮的设计(2)友好的学习曲线;(3)卓越的兼容性;(4)12列栅格;(5)响应式设计;(6)样式向导文件;3、自定义JQuery插件,完整的类库,基于less等。
1-2 Bootstrap到底是什么?如上。
1-3 如何开始使用Bootstrap<!DOCTYPE html>html5定义<meta http-equiv="X-UA-Compatible" content="IE=edge">在IE运行最新的渲染模式<meta name="viewport" content="width=device-width, initial-scale=1">初始化移动浏览器----可以通过平移或者缩放浏览器,来看网页的布局,网页中这句代码基本上都会加上viewport:网页开发者来控制视口的大小和缩放width=device-width:宽度等于设备的宽度initial-scale=1:初始缩放的比例,这里为1,就是不缩放移动浏览器是把页面放在一个虚拟的视口中,即viewport,通常这个虚拟的视口比屏幕宽,这样就不用把每个网页挤到很小的视口中,但是这样会破坏没有针对移动浏览器优化的网页布局)(viewport可用于控制大小及缩放)(代码可理解为让视口的宽度为物理设备上真实的分辨率,即宽度,初始的缩放比例为1,即不缩放)<!-- 上述3个meta标签*必须*放在最前面,任何其他内容都*必须*跟随其后!-->bootstrap 3 之后,不再支付IE7,FF 3.X虽然支持IE8,但是IE8对CSS3支持有限,需要引入其他JS文件使IE8更好的支持通常,css文件声明放在head部分,jquery和bootstrap插件声明放在body的最下面;bootstrap基于jquery,所以jquery要先引入。
bootstrap使用方法
Bootstrap是一个HTML、CSS、JavaScript框架,用于快速开发响应式、移动优先的Web项目。
它包含了大量的CSS、JavaScript组件,以及预先设计好的UI元素,可以节省大量的开发时间和工作量。
使用Bootstrap非常简单,只需要在项目中引入Bootstrap的CSS和JavaScript文件,然后按照文档中提供的示例代码编写即可。
以下是一些常见的Bootstrap使用方法:
1. 栅格系统
Bootstrap的栅格系统使用了12列网格布局,可以快速构建响应式布局。
通过在HTML元素上添加class,可以很容易地指定元素在不同屏幕宽度下的列数和偏移量。
2. CSS组件
Bootstrap包含了大量的CSS组件,例如按钮、表单、导航栏等。
只需要在HTML元素上添加相应的class,即可使用这些组件。
3. JavaScript插件
Bootstrap还包含了很多JavaScript插件,例如轮播图、模态框等。
只需要在HTML文件中引入相应的JavaScript文件,并按照文档中的说明使用即可。
4. 主题定制
Bootstrap提供了多种主题,可以通过覆盖默认变量或者修改源码进行个性化定制。
此外,还可以使用第三方工具如Bootstrap Studio进行可视化定制。
总之,Bootstrap是一个非常强大且易于使用的框架,可以让开发者快速构建出美观、响应式的Web项目。
Bootstrap简易指南看完使用手册后所作的笔记,可以当做简易使用指南使用。
1.框架1.1全局样式使用HTML5的doctype,scaffolding.less中定义全局样式,从2开始使用normalize.css,并使用reset.less进行简化1.2默认栅格系统940px宽12列栅格,使用row与span[NUM]的class来控制,使用offset[NUM]来控制偏移,于non-fluid可以直接嵌套,提供了四种响应式方案1.3流动栅格系统基于百分比,将row改为row-fluid即可使用,内嵌注意宽度是按照父列的百分比进行计算的1.4自定义栅格于variables.css中改变变量,默认列12,宽60px,间隔20px,要保证响应性还得修改responsive.less中内容1.5布局container为940px居中,container-fluid则为流体布局1.6 响应式设计responsive.less中提供了一组media query:智能手机《=480px;流式列,非固定宽度垂直平板《=767px;流式列,非固定宽度水平平板》=768px;42px 20px默认》=980px;? ? ?60px ?20px大分辨率》=1200px;70px 30px要求添加meta标签,<meta name=”viewport” content=”width=device-width,initail-scale=1.0″>有诸如.visible-phone等支持类2.基础CSS2.1 排版整个排版单位基于variables.less中@baseFontSize与@baseLineHeight两个变量;强调:string加粗,em倾斜,abbr缩写【title属性存放显示信息,.initialism会减小缩略词字体】,address【使用br换行】引用:blockquote【cite属性存放来源URL,.pull-left或right决定内容居左右】,small用于引言作者【会在内容前加入破折号】列表:ul无序号有黑点,ul.unstyled无样式,ol有数字序号,dl描述,dl.dl-horizontal水平描述2.2代码code行级代码,pre块级【<>需要转义,.pre-scrollable可以设置350px最大高度】,应用.prettyprint和.linenums来美化代码【使用google prettify】table thead【tr】tbody【tr】tr【td或th】th【必须在thead之内】caption;.table行之间有水平线分割【2.0开始为默认】 .table-borderd 【边角为圆角】.table-striped 奇偶分开【使用:nth-child ie7-8不支持】 .table-condensed 紧凑竖直方向padding减半几个可以组合使用2.4表单四种表单:.form-vertical【2.0后默认,控件标签文字左对齐】.form-inline【左对齐,控件inline-block】 .form-search【文本框圆化】 .form-horizontal【左浮动,标签与控件居于同一行且文字右对齐】支持控件:文本输入框,单选,复选,下拉,多选,上传,文本域控件组:.control-group .control-label以及.controls【默认label应该与控件在同一行?】设计了各种控件状态【如focus,disabled,去除webkit的outline】,包含.error .warning .success验证样式扩张控件:.span*来指定输入框大小,使用.input-mini或small或medium或big来指定input 和select控件大小,2.0开始对.checkbox或.radio应用.inline即可实现行级,用label.checkbox包含input[type=checkbox]即可罗列,前置或后置文本保证.add-on与input 在同行, .help-inline与.help-block设置帮助文本2.5 按钮可以应用到a button及input标签上,.btn .btn-primary .btn-info等样式【ie9不兼容】,.btn-large small mini等尺寸,.disabled类或disabled属性可以禁用2.6 图标使用.icon-前缀设置,用<i>x显示图标,用.icon-white显示反白图标,图标定义在sprites.less 中3.1按钮3.1.1按钮组建议一个组里只用一种元素<a>或<button>,使用.btn-group,组合.btn-toolbar包装.btn-group即可合成工具条组件3.1.2按钮下拉菜单下拉菜单也得嵌套在.btn-group中,使用dropdown-toggle与ul.dropdown-menu类,支持Bootstrap下拉插件,箭头使用.caret,.dropdown-menu最近父标签应用.dropup即可变为上弹菜单【会改变.caret箭头方向】3.2导航3.2.1默认项基类.nav,对齐使用.pull-left或.pull-right【依赖float】,标签页ul.nav-tabs,胶囊链接ul.nav-pills3.2.2叠放式导航指竖直叠放ul.nav-stacked3.2.3下拉项综合使用下拉按钮【js下拉项插件】,参考3.1.23.2.4导航列表<i>使用标签,.pider空表项显示为水平间隔,.active选中项,.nav-header列表头3.2.5 标签页切换导航用.tabbale的p嵌套.nav-tabs,存放容器为.tab-content,内容页使用.tab-pane,标签置底用.tabs-below,标签居左.tabs-left,居右.tabs-right3.2.6 导航条固定导航条div.navbar与.navbar-fixed-top【必须预留40px或更多padding】,导航项ul.nav,li.pider-vertical分隔条,项目名称a.brand,表单.navbar-form,对form.navbar-search中输入框使用.search-query得到搜索框,下拉菜单参考3.2.3,导航条文本使用<p>,响应式嵌套在.nav-collapse.collapse并对按钮都应有.btn-navbar【需要js切换插件】3.2.7面包屑导航ul.breadcrumb3.2.8页码div.pagination>ul,同样使用.active与.disabled,页码对齐使用.pagination-centered或.pagination-right,前后页ul.pager【居于左右端li.previous与li.next】3.3行内标签bel默认样式,bel-success成功等3.4 标号span.badge默认样式,span.badge.badge-success等3.5 排版主角单元div.hero-unit中嵌套,标题h1,可以嵌入small,3.6 缩略项ul.thumbnails>li.span*>a.thumbnail>img链接图像,div.thumbnail块状内容3.7通知基类div.alert【2.0开始替代.alert-message】,例子:div.alert>a.close+strong,加强.alert-block 提供更大的padding而.alert-heading修饰标题,语义强化.alert-error或success或info3.8进度条基本div.progress>div.bar[style="width:60%"],条纹效果div.progress.progress-striped【动画效果加上.active,使用css3渐变动画,不支持ie】,语义加强.progress-info或success 等3.9杂项消息墙div.well,关闭图标a.close4 jQuery插件4.1对话框【bootstrap-modal.js】$().modal({backdrop:true背景,keyboard:true支持ESC,show:true初始化显示}) ,触发设置data-toggle=”modal”然后data-target=”#foo”或href=“#foo”,对话框设置div.modal#foo即可:div.modal-header>a.close[data-dismiss="modal"]+div.modal-body+div.modal-footer【显示动画效果bootstrap-transition.js,对.modal应用.fade即可】,方法.modal(“toggle”)或.modal(“show”)或.modal(“hide”),事件show,shown,hide,hidden4.2 下拉项【bootstrap-dropdown.js】样式应用导航栏与胶囊链接,方法$().dropdown(),设置data-toggle=”dropdown”【也可以使用data-target=”#foo”或href=“#foo”来关联下拉项与链接】4.3 滚动侦测【bootstrap-scrollspy.js】$(…#navbar‟).scrollspy()标记添加data-spy=”scroll”【导航链接必须有href=”#id”且对应有dom#id】,选项offset【默认为10】4.4 可切换的标签页【bootstrap-tab.js】方法$(…#myTab‟).tab(…show‟) 标签页需要设置data-target=‟#id‟或href=‟#id‟标记添加data-toggle=”tab”或data-toggle=”pill”,事件show与shown 【event.target指向激活标签,event.relatedT arget指向之前激活的标签】4.5 工具提示【bootstrap-tooltips.js】$(…#example‟).tooltip(options) 中选项animation:true,placement:‟top‟,selector,title,trigger:‟hover‟,delay:{show:num, hide:100}工具提示可以单独设置data-属性实现与js调用同样的功能,指定一个selector即可【设置rel=”tooltip”】方法:.tooltip(…show‟)?.tooltip(…hide‟)?.tooltip(…toggle‟)4.6 弹出提示【bootstrap-popover.js】$(…#example‟).popover(options)中选项animation:true,placement:‟top‟,selector,trigger:‟hover‟,title,content,delay同样可以单独设置data-属性,方法也相同4.7 通知消息【bootstrap-alert.js】$(“.alert”).alert()用在通知,对关闭按钮设置data-dismiss=”alert”即可定时关闭方法$(“.alert”).alert(…close‟),事件close closed4.8 按钮【bootstrap-button.js】应用在btn与btn-group,设置data-toggle=”button”与data-toggle=”button-checkbox”与data-toggle=”button-radio”样式方法$().button(…toggle‟) 按下$().button(…loading‟) 载入文本data-loading-text属性中$().button(…reset‟)重置按钮状态4.9 折叠手风琴【bootstrap-collapse.js】$().collapse({toggle:false}),事件show,shown,hide,hidden设置data-toggle=“collapse”和data-target即可变为折叠式,data-target接收一个css选择器以选取元素添加,元素上需要添加.collapse,默认打开用.in4.10 轮播【bootstrap-carousel.js】$().carousel({interval:5000, pause:‟hover‟})标记用data-属性提供前后翻页,data-slide=”prev或next”方法.carousel(…cycle或pause 或number或prev或next‟) 事件slide,slid4.11 输入提醒【bootstrap-typeahead.js】$().typeahead({source:[]数据源, items:8列表显示个数, matcher:fn, sorter:fn, highlighter:fn}),设置data-provide=”typeahead”5. LESSmixins.less中保存所有混合,编译安装npm intall -g less uglify-js lessc ./lib/bootstrap.less > bootstrap.css压缩使用–compress,引用less.js 也可以重新编译.less文件并进行本地存储本文链接:»/resource/3236.html。
bootstrap 使用方法
Bootstrap是一种流行的前端开发框架,可以帮助开发者快速构建响应式和移动优先的网站。
以下是Bootstrap的使用方法:
1. 安装Bootstrap:可以通过下载压缩包或使用包管理器(如npm或yarn)来安装Bootstrap。
安装完成后,将Bootstrap的CSS和JavaScript文件
引入到HTML文件中。
2. 创建HTML骨架结构:先正常搭建一个HTML页面,然后根据需要选择Bootstrap提供的组件,将其复制到HTML页面中。
3. 引入相关样式文件:使用link标签引入Bootstrap的CSS文件。
也可以通过Sass工具对Bootstrap进行深度定制。
4. 书写内容:正常输入内容,如果发现内容没有了浏览器默认的内外边距,则证明CSS文件引入成功。
5. 利用Bootstrap组件:Bootstrap提供的组件不仅减少了开发工作量,
而且统一了设计风格。
例如,可以使用Navbar组件创建导航菜单,使用模态框创建对话框,使用Carousel组件添加动态轮播图等。
总之,使用Bootstrap可以快速构建出美观、响应式的网站,提高开发效率。
如需了解更多关于Bootstrap的使用方法,建议访问相关社区或论坛,或参考官方文档。
bootstrapadminlte教程1基础布局Bootstrap AdminLTE 是一套功能强大的后台管理模板,基于Bootstrap 框架和 AdminLTE 主题进行开发。
它提供了丰富的组件和样式,能够帮助开发者快速搭建现代化的后台管理系统。
在本教程中,我们将介绍 Bootstrap AdminLTE 的基础布局。
该布局是一个响应式的三栏结构,包括一个固定的顶部导航栏、一个固定的侧边栏和一个可变宽度的主内容区域。
```html<!DOCTYPE html><html><head><meta charset="utf-8"><title>AdminLTE , Basic Layout</title><!-- 引入 Bootstrap CSS --><link rel="stylesheet"href="path/to/bootstrap/css/bootstrap.min.css"><!-- 引入 AdminLTE CSS --><link rel="stylesheet"href="path/to/AdminLTE/css/adminlte.min.css"></head><!--你的页面内容--><!-- 引入 jQuery 和 Bootstrap JavaScript --><script src="path/to/jquery/jquery.min.js"></script><script src="path/to/bootstrap/js/bootstrap.min.js"></script> <!-- 引入 AdminLTE JavaScript --><script src="path/to/AdminLTE/js/adminlte.min.js"></script></body></html>```上面的代码中,我们引入了 Bootstrap CSS、AdminLTE CSS、jQuery、Bootstrap JavaScript 和 AdminLTE JavaScript。
Bootstrap Aboutthe T utorialTw i tter Bootstrap i s the most popu l ar front end framework i n the recent t i me. It i s s l eek,i ntu i t i ve, and powerfu l mob il e f i rst front-end framework for faster and eas i er web deve l opment. It uses HTML, CSS and Javascr i pt.Th i s tutor i a l w ill teach you the bas i cs of Bootstrap Framework us i ng wh i ch you can create web projects w i th ease. The tutor i a l i s d i v i ded i nto sect i ons such as BootstrapBas i c Structure, Bootstrap CSS, Bootstrap Layout Components and Bootstrap P l ug i ns. Each of these sect i ons conta i n re l ated top i cs w i th s i mp l e and usefu l examp l es.AudienceTh i s tutor i a l has been prepared for anyone who has a bas i c know l edge of HTML and CSSand has an urge to deve l op webs i tes. After comp l et i ng th i s tutor i a l you w ill f i nd yourse l fat a moderate l eve l of expert i se i n deve l op i ng web projects us i ng Tw i tter Bootstrap. PrerequisitesBefore you start proceed i ng w i th th i s tutor i a l, we are assum i ng that you are a l ready aware about the bas i cs of HTML and CSS. If you are not we ll aware of these concepts,then we w ill suggest you to go through our short tutor i a l on HTML Tutor i a l and CSS Tutor i a l.Copyright&DisclaimerCopyr i ght 2014 by Tutor i a l s Po i nt (I) Pvt. Ltd.A ll the content and graph i cs pub li shed i n th i s e-book are the property of Tutor i a l s Po i nt(I) Pvt. Ltd. The user of th i s e-book i s proh i b i ted to reuse, reta i n, copy, d i str i bute or repub li sh any contents or a part of contents of th i s e-book i n any manner w i thout wr i tten consent of the pub li sher.We str i ve to update the contents of our webs i te and tutor i a l s as t i me l y and as prec i se l yas poss i b l e, however, the contents may conta i n i naccurac i es or errors. Tutor i a l s Po i nt (I) Pvt. Ltd. prov i des no guarantee regard i ng the accuracy, t i me li ness or comp l eteness ofour webs i te or i ts contents i nc l ud i ng th i s tutor i a l. If you d i scover any errors on our webs i te or i n th i s tutor i a l, p l ease not i fy us at **************************iT able ofContentsAbout the Tuto r ial (i)Audien c e (i)P r e r equisites (i)Copy r ight&Dis c laime r (i)Table o f Contents (ii)1. BOOTSTRAP ─ OVERVIEW (1)2. BOOTSTRAP ─ ENVIRONMENT SETUP (3)Download Bootst r ap (3)File st r u c tu r e (3)HTML Template (4)3. BOOTSTRAP ─ GRID SYSTEM (6)What is a G r id? (6)What is Bootst r ap G r id System? (6)Wo r king o f Bootst r ap G r id System (6)Media Que r ies (7)G r id Options (8)Responsive Column Resets (14)O ff set Columns (15)Nesting Columns (16)Column O r de r ing (17)4. BOOTSTRAP ─ CSS OVERVIEW (19)HTML5do c type (19)Mobile Fi r st (19)Responsive Images (20)Typog r aphy and Links (20)No r mali z e (20)Containe r s (20)5. BOOTSTRAP ─ TYPOGRAPHY (22)Headings (22)Lead Body Copy (23)Emphasis (23)Abb r eviations (24)Add r esses (24)Blo c kquotes (25)Lists (26)6. BOOTSTRAP ─ CODE (29)7. BOOTSTRAP ─ TABLES (30)Basi c Table (30)Optional Table Classes (31)Conte x tual c lasses (35)Responsive tables (37)8. BOOTSTRAP ─ FORMS (39)Fo r m Layout (39)Suppo r ted Fo r m Cont r ols (42)Stati c Cont r ol (45)Fo r m Cont r ol States (46)Fo r m Cont r ol Si z ing (49)Help Te x t (50)iii9. BOOTSTRAP ─ BUTTONS (51)Button Si z e (52)Button State (54)Button Tags (57)10. BOOTSTRAP ─ IMAGES (58)11. BOOTSTRAP ─ HELPER CLASSES (59)Close i c on (59)Ca r ets (59)Qui c k Floats (59)Cente r Content Blo c ks (60)Clea rf i x (60)Showing and Hiding Content (61)S cr een Reade r Content (61)12. BOOTSTRAP ─ RESPONSIVE UTILITIES (62)P r int Classes (62)13. BOOTSTRAP ─ GLYPHICONS (64)What a r e Glyphi c ons? (64)Whe r e to f ind Glyphi c ons? (64)Usage (64)14. BOOTSTRAP ─ DROPDOWNS (66)Options (67)15. BOOTSTRAP ─ BUTTON GROUPS (70)Basi c Button G r oup (71)Button Toolba r (71)Button Si z e (72)Nesting (72)Ve r ti c al Buttong r oup (73)16. BOOTSTRAP ─ BUTTON DROPDOWNS (75)Split Button D r opdowns (76)Button D r opdown Si z e (77)D r opup Va r iation (78)17. BOOTSTRAP ─ INPUT GROUPS (80)Basi c Input G r oup (80)Input G r oup Si z ing (81)Che c kbo x es and Radio Addons (82)Button Addons (83)Buttons with D r opdowns (84)Segmented Buttons (85)18. BOOTSTRAP ─ NAVIGATION ELEMENTS (88)Tabula r Navigation o r Tabs (88)Pills Navigation (88)Justi f ied Nav (90)Disabled Links (90)D r opdowns (91)19. BOOTSTRAP ─ NAVBAR (94)De f ault Navba r (94)Responsive Navba r (95)Fo r ms in Navba r (96)Buttons in Navba r (97)Te x t in Navba r (98)Non-nav Links (98)vComponent Alignment (99)Fi x ed to Top (101)Fi x ed to Bottom (102)Stati c Top (103)Inve r ted Navba r (104)20. BOOTSTRAP ─ BREADCRUMB (106)21. BOOTSTRAP ─ PAGINATION (107)Pagination (107)Page r (110)22. BOOTSTRAP ─ LABELS (112)23. BOOTSTRAP ─ BADGES (113)A c tive Nav States (113)24. BOOTSTRAP ─ JUMBOTRON (115)25. BOOTSTRAP ─ PAGE HEADER (117)26. BOOTSTRAP ─ THUMBNAILS (118)Adding Custom Content (119)27. BOOTSTRAP ─ ALERTS (122)Dismissal Ale r ts (122)Links in Ale r ts (124)28. BOOTSTRAP ─ PROGRESS BARS (125)De f ault P r og r ess Ba r (125)Alte r nate P r og r ess Ba r (125)St r iped P r og r ess Ba r (127)Animated P r og r ess Ba r (128)Sta c ked P r og r ess Ba r (128)29. BOOTSTRAP ─ MEDIA OBJECT (130)30. BOOTSTRAP ─ LIST GROUP (135)Adding Badges to List G r oup (135)Linking List G r oup Items (136)Add Custom Content to List G r oup (137)31. BOOTSTRAP ─ PANELS (139)Panel with Heading (139)Panel with Foote r (140)Panel Conte x tual Alte r natives (141)Panel with Tables (142)Panel with Listg r oups (143)32. BOOTSTRAP ─ WELLS (145)Si z ing (145)33. BOOTSTRAP ─ PLUGINS OVERVIEW (146)Data Att r ibutes (146)P r og r ammati c API (146)No Con f li c t (147)Events (147)34. BOOTSTRAP ─ TRANSITION PLUGIN (148)Use Cases (148)35. BOOTSTRAP ─ MODAL PLUGIN (149)Usage (149)Options (151)Methods (152)Events (154)36. BOOTSTRAP ─ DROPDOWN PLUGIN (157)Usage (157)Options (159)Methods (160)37. BOOTSTRAP ─ SCROLLSPY PLUGIN (162)Usage (162)Options (164)Methods (165)Events (168)38. BOOTSTRAP ─ TAB PLUGIN (172)Usage (172)Fade E ff e c t (173)Methods (174)Events (177)39. BOOTSTRAP ─ TOOLTIP PLUGIN (180)Usage (180)Options (182)Methods (183)Events (185)40. BOOTSTRAP ─ POPOVER PLUGIN (187)Usage (187)Options (188)Methods (190)Events (192)41. BOOTSTRAP ─ ALERT PLUGIN (194)Usage (194)Options (195)Methods (195)Events (196)42. BOOTSTRAP ─ BUTTON PLUGIN (198)Loading State (198)Single Toggle (199)Che c kbo x (199)Radio (200)Usage (200)Options (200)Methods (200)43. BOOTSTRAP ─ COLLAPSE PLUGIN (204)Usage (206)Options (207)Methods (207)Events (210)44. BOOTSTRAP ─ CAROUSEL PLUGIN (213)Optional Captions (214)Usage (215)Options (216)Methods (216)Events (219)Bootstrap45. BOOTSTRAP ─ AFFIX PLUGIN (222)Usage (222)Positioning via CSS (228)Options (229)xWhat is Twitter Bootstrap?Bootstrap i s a s l eek, i ntu i t i ve, and powerfu l, mob il e f i rst front-end framework for fasterand eas i er web deve l opment. It uses HTML, CSS, and Javascr i pt.Bootstrap was deve l oped by Mark Otto and Jacob Thornton at Tw i tter. It was re l eased asan open source product i n August 2011 on G i tHub.Why Use Bootstrap?∙Mobile first approach: Bootstrap 3 framework cons i sts of Mob il e f i rst sty l es throughout the ent i re li brary i nstead of them i n separate f il es.∙Browser Support: It i s supported by a ll popu l ar browsers.∙Easy to get started: W i th just the know l edge of HTML and CSS anyone can get started w i th Bootstrap. A l so the Bootstrap off i c i a l s i te has a good documentat i on.∙Responsive design: Bootstrap's respons i ve CSS adjusts to Desktops, Tab l ets and Mob il es. More about the respons i ve des i gn i s i n the chapter BootstrapResponsive Design.∙Prov i des a c l ean and un i form so l ut i on for bu il d i ng an i nterface for deve l opers.∙It conta i ns beaut i fu l and funct i ona l bu il t-i n components wh i ch are easy to custom i ze.∙It a l so prov i des web-based custom i zat i on.∙And best of a ll i t i s an open source.1BootstrapWhat Bootstrap Package Includes?∙Scaffolding: Bootstrap prov i des a bas i c structure w i th Gr i d System, li nk sty l es, and background. Th i s i s covered i n deta il i n the sect i on BootstrapBasic Structure.∙CSS: Bootstrap comes w i th the feature of g l oba l CSS sett i ngs, fundamenta l HTML e l ements sty l ed and enhanced w i th extens i b l e c l asses, and anadvanced gr i d system. Th i s i s covered i n deta il i n the sect i on Bootstrap withCSS.∙Components: Bootstrap conta i ns over a dozen reusab l e components bu il t to prov i de i conography, dropdowns, nav i gat i on, a l erts, pop-overs, and muchmore. Th i s i s covered i n deta il i n the sect i on Layout Components.∙JavaScript Plugins: Bootstrap conta i ns over a dozen custom jQuery p l ug i ns.You can eas il y i nc l ude them a ll, or one by one. Th i s i s covered i n deta il s i n thesect i on Bootstrap Plugins.∙Customize: You can custom i ze Bootstrap's components, LESS var i ab l es, and jQuery p l ug i ns to get your very own vers i on.22.Bootstrap─Environment SetupIt i s very easy to setup and start us i ng Bootstrap. Th i s chapter w ill exp l a i n how to down l oad and setup Bootstrap. We w ill a l so d i scuss the Bootstrap f il e structure, and demonstrate i ts usage w i th an examp l e.DownloadBootstrapYou can down l oad the l atest vers i on of Bootstrap from /. Whenyou c li ck on th i s li nk, you w ill get to see a screen as be l ow:Here you can see two buttons:∙ Down l oad Bootstrap: C li ck i ng th i s, you can down l oad the precomp il edand m i n i f i ed vers i ons of Bootstrap CSS, JavaScr i pt, and fonts. No documentat i on oror i g i na l source code f il es are i nc l uded.∙ Down l oad Source: C li ck i ng th i s, you can get the l atest Bootstrap LESSand JavaScr i pt source code d i rect l y from G i tHub.If you work w i th Bootstrap's uncomp il ed source code, you need to comp il e the LESS f il esto produce usab l e CSS f il es. For comp ili ng LESS f il es i nto CSS, Bootstrap off i c i a ll y supports on l y Recess, wh i ch i s Tw i tter's CSS h i nter based on l ess.js.For better understand i ng and ease of use, we sha ll use precomp il ed vers i on of Bootstrap throughout the tutor i a l. As the f il es are comp li ed and m i n i f i ed, you don't have to bother every t i me i nc l ud i ng separate f il es for i nd i v i dua l funct i ona li ty. At the t i me of wr i t i ng th i stutor i a l the l atest vers i on (Bootstrap 3) was down l oaded.File structurePrecompiled BootstrapOnce the comp il ed vers i on Bootstrap i s down l oaded, extract the ZIP f il e, and you w ill seethe fo ll ow i ng f il e/d i rectory structure:3As you can see, there are comp il ed CSS and JS (bootstrap.*), as we ll as comp il ed and m i n i f i ed CSS and JS (bootstrap.m i n.*). Fonts from G l yph i cons are i nc l uded, as i t i s the opt i ona l Bootstrap theme.Bootstrap Source CodeIf you have down l oaded the Bootstrap source code then the f il e structure wou l d be as fo ll ows:∙The f il es under l ess/, js/, and fonts/ are the source code for Bootstrap CSS, JS, and i con fonts (respect i ve l y).∙The d i st/ fo l der i nc l udes everyth i ng li sted i n the precomp il ed down l oad sect i on above.∙docs-assets/, examp l es/, and a ll*.htm l f il es are Bootstrap documentat i on. HTMLT emplateA bas i c HTML temp l ate us i ng Bootstrap wou l d l ook li ke th i s:<!DOCTYPE html><html><head><title>Bootstrap 101 Template</title><meta name="viewport" content="width=device-width, initial-scale=1.0"><!-- Bootstrap --><link href="css/bootstrap.min.css" rel="stylesheet"><!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries--><!-- WARNING: Respond.js doesn't work if you view the pagevia file:// --><!--[if lt IE 9]><script src="https:///libs/html5shiv/3.7.0/html5shiv.js"></script><script src="https:///libs/respond.js/1.3.0/respond.min.js"></script><![endif]--></head><body><h1>Hello, world!</h1><!-- jQuery (necessary for Bootstrap's JavaScript plugins) --><script src="https:///jquery.js"></script><!-- Include all compiled plugins (below), or include individual files as needed--><script src="js/bootstrap.min.js"></script></body></html>Here you can see the jquery.js,bootstrap.min.js and bootstrap.min.css f il es thatare i nc l uded to make a norma l HTM f il e to the Bootstrapped Temp l ate. Just make sure toi nc l ude jQuery li brary before you i nc l ude Bootstrap li brary.More deta il s about each of the e l ements i n th i s above p i ece of code w ill be d i scussed i nthe chapter Bootstrap CSS Overv i ew.Th i s temp l ate structure i s a l ready i nc l uded as part of the Try it(on li ne comp il er) too l. Hence i n a ll the examp l es (i n the fo ll ow i ng chapters) of th i s tutor i a l you w ill on l y see the contents of the <body> e l ement. Once you c li ck on the Try it opt i on ava il ab l e at the topr i ght corner of examp l e, and you w ill see the ent i re code.ExampleNow l et's try an examp l e us i ng the above temp l ate. Try the fo ll ow i ng examp l e us i ng Tryi t opt i on ava il ab l e at the top r i ght corner of the be l ow samp l e code box on our webs i te:<h1>Hello, world!</h1>In a ll the subsequent chapters we have used dummy text from the s i te http://www.li /.5In th i s chapter, we sha ll d i scuss the Bootstrap Gr i d System.Whatis a Grid?As put by W i kiped i a:In graph i c des i gn, a gr i d i s a structure (usua ll y two-d i mens i ona l) made up of a ser i es ofi ntersect i ng stra i ght (vert i ca l, hor i zonta l) li nes used to structure the content. It i s w i de l y used to des i gn l ayout and content structure i n pr i nt des i gn. In web des i gn, i t i s a very effect i ve method to create a cons i stent l ayout rap i d l y and effect i ve l y us i ng HTML and CSS.To put i n s i mp l e words, gr i ds i n web des i gn organ i ze and structure content, makes the webs i tes easy to scan and reduces the cogn i t i ve l oad on users.Whatis Bootstrap Grid System?As put by the off i c i a l documentat i on of Bootstrap for gr i d system:Bootstrap i nc l udes a respons i ve, mob il e f i rst f l u i d gr i d system that appropr i ate l y sca l esup to 12 co l umns as the dev i ce or v i ewport s i ze i ncreases. It i nc l udes predef i ned c l assesfor easy l ayout opt i ons, as we ll as powerfu l m i x i ns for generat i ng more semant i c l ayouts.Let us understand the above statement. Bootstrap 3 i s mob il e f i rst i n the sense that the code for Bootstrap now starts by target i ng sma ll er screens li ke mob il e dev i ces, tab l ets, and th en “expand s” components and gr i ds for l arger screens such as l aptops, desktops.Mobile First Strategy∙Contento Determ i ne what i s most i mportant.∙Layouto Des i gn to sma ll er w i dths f i rst.o Base CSS address mob il e dev i ce f i rst; med i a quer i es address for tab l et,desktops.∙Progressive Enhancemento Add e l ements as screen s i ze i ncreases.Working ofBootstrap GridSystemGr i d systems are used for creat i ng page l ayouts through a ser i es of rows and co l umns that house your content. Here's how the Bootstrap gr i d system works:∙ Rows must be p l aced w i th i n a .container c l ass for proper a li gnment and padd i ng.∙ Use rows to create hor i zonta l groups of co l umns. 6∙Content shou l d be p l aced w i th i n the co l umns, and on l y co l umns may be thei mmed i ate ch il dren of rows.∙Predef i ned gr i d c l asses li ke .row and.col-xs-4 are ava il ab l e for qu i ck l y mak i ng gr i d l ayouts. LESS m i x i ns can a l so be used for more semant i c l ayouts.∙Co l umns create gutters (gaps between co l umn content) v i a padd i ng. That padd i ng i s offset i n rows for the f i rst and the l ast co l umn v i a negat i ve marg i non .rows.∙Gr i d co l umns are created by spec i fy i ng the number of twe l ve ava il ab l e co l umns you w i sh to span. For examp l e, three equa l co l umns wou l d use three .col-xs-4.Media QueriesMed i a query i s a rea ll y fancy term for "cond i t i ona l CSS ru l e". It s i mp l y app li es some CSS, based on certa i n cond i t i ons set forth. If those cond i t i ons are met, the sty l e i sapp li ed.Med i a Quer i es i n Bootstrap a ll ow you to move, show and h i de content based on thev i ewport s i ze. Fo ll ow i ng med i a quer i es are used i n LESS f il es to create the key breakpo i nts i n the Bootstrap gr i d system./* Extra small devices (phones, less than 768px) *//* No media query since this is the default in Bootstrap *//* Small devices (tablets, 768px and up) */@media (min-width: @screen-sm-min) { ... }/* Medium devices (desktops, 992px and up) */@media (min-width: @screen-md-min) { ... }/* Large devices (large desktops, 1200px and up) */@media (min-width: @screen-lg-min) { ... }Occas i ona ll y these are expanded to i nc l ude a max-w i dth to li m i t CSS to a narrower setof dev i ces.@media (max-width: @screen-xs-max) { ... }@media (min-width: @screen-sm-min) and (max-width: @screen-sm-max) { ... }@media (min-width: @screen-md-min) and (max-width: @screen-md-max) { ... }@media (min-width: @screen-lg-min) { ... }Med i a quer i es have two parts, a dev i ce spec i f i cat i on and then a s i ze ru l e. In the above case, the fo ll ow i ng ru l e i s set:7Let us cons i der th i s li ne:@media (min-width: @screen-sm-min) and (max-width: @screen-sm-max) { ... }For a ll dev i ces no matter what k i nd w i th m i n-w i dth:@screen-sm-m i n,i f the w i dth of the screen gets sma ll er than @screen-sm-max, then do someth i ng.Grid OptionsThe fo ll ow i ng tab l e summar i zes aspects of how Bootstrap gr i d system works across mu l t i p l e dev i ces:Extra small devices Phones (<768px) Small devicesTablets(≥768px)MediumdevicesDesktops(≥992px)Large devicesDesktops(≥1200px)Gr i d behav i or Hor i zonta l ata ll t i mesCo ll apsed tostart, hor i zonta labovebreakpo i ntsCo ll apsed tostart, hor i zonta labovebreakpo i ntsCo ll apsed tostart, hor i zonta labovebreakpo i ntsMaxconta i nerw i dthNone (auto) 750px 970px 1170pxC l asspref i x .col-xs- .col-sm- .col-md- .col-lg-# ofco l umns 12 12 12 12Maxco l umnw i dthAuto 60px 78px 95pxGutter w i dth 30px(15px on eachs i de of aco l umn)30px(15px on eachs i de of aco l umn)30px(15px on eachs i de of aco l umn)30px(15px on each s i deof a co l umn)Nestab l e Yes Yes Yes YesOffsets Yes Yes Yes Yes8Bootstrap Co l umnorder i ng Yes Yes Yes YesBasic Grid StructureFo ll ow i ng i s bas i c structure of Bootstrap gr i d:<div class="container"><div class="row"><div class="col-*-*"></div><div class="col-*-*"></div></div><div class="row">...</div></div><div class="container">....Let us see some s i mp l e gr i d examp l es:Example:Stacked-to-horizontalLet us see a s i mp l e gr i d examp l e w i th s i mp l e l ayout: two co l umns, two paragraphs perco l umn. (Here sty li ng for each co l umn i s used. You can avo i d i t.)<div class="container"><h1>Hello, world!</h1><div class="row"><div class="col-md-6" style="background-color: #dedef8; box-shadow:inset 1px -1px 1px #444, inset -1px 1px 1px #444;"><p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed doeiusmod tempor incididunt ut labore et dolore magna aliqua. Utenim ad minim veniam, quis nostrud exercitation ullamco laborisnisi ut aliquip ex ea commodo consequat.</p><p>Sed ut perspiciatis unde omnis iste natus error sit voluptatemaccusantium doloremque laudantium, totam rem aperiam, eaque ipsaquae ab illo inventore veritatis et quasi architecto beataevitae dicta sunt explicabo.</p>9</div><div class="col-md-6" style="background-color: #dedef8;box-shadow:inset 1px -1px 1px #444, inset -1px 1px 1px #444;"><p>Sed ut perspiciatis unde omnis iste natus error sit voluptatemaccusantium doloremque laudantium.</p><p> Neque porro quisquam est, qui dolorem ipsum quia dolor sitamet, consectetur, adipisci velit, sed quia non numquam eiusmodi tempora incidunt ut labore et dolore magnam aliquam quaeratvoluptatem.</p></div></div>Details∙<div class="container">...</div> e l ement i s added to ensure proper center i ng and max i mum w i dth for l ayout.∙Once conta i ner i s added, next you need to th i nk i n terms of rows. Add <div class="row">...</div> and co l umns <div class="col-md-6"></div>i ns i dethe rows.∙Every row i n the gr i d i s made up of 12 un i ts and you can def i ne the des i red s i ze of your co l umns us i ng those un i ts. In our examp l e we have two co l umns eachmade of 6 un i ts w i de i.e 6+6=12.You can try some more opt i ons li ke:<d i v c l ass="co l-md-3"></d i v> and <d i v c l ass="co l-md-9"></d i v>or <d i v c l ass="co l-md-7"></d i v> and <d i v c l ass="co l-md-5"></d i v>.Exper i ment and make sure that the sum a l ways needs to be 12.10Example:Medium and Large DeviceWe have seen the bas i c gr i d system i n ‘Examp l e: Stacked-to-hor i zonta l’. Here we have used 2 d i vs and gave them the 50%/50% sp li t at the med i um v i ewport w i dth:<div class="col-md-6">....</div><div class="col-md-6">....</div>But at l arge, your des i gn cou l d rea ll y be better as a 33%/66%. So what we’re go i ng todo i s, set i t up to change the co l umn w i dths at the breakpo i nt:<div class="col-md-6 col-lg-4">....</div><div class="col-md-6 col-lg-4">....</div>Now Bootstrap i s go i ng to say “at the med i um s i ze, I l ook at c l asses w i th md i n themand use those. At the l arge s i ze, I l ook at c l asses w i th the word lg i n them and use those. In th i s case, our 2 d i vs w ill go from a 50%/50% sp li t and then up to a 33%/66%. Check i t out i n the fo ll ow i ng examp l e. (Here sty li ng for each co l umn i s used. You canavo i d i t.)<div class="container"><h1>Hello, world!</h1><div class="row"><div class="col-md-6 col-lg-4" style="background-color: #dedef8;box-shadow: inset 1px -1px 1px #444, inset -1px 1px 1px #444;"><p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed doeiusmod tempor incididunt ut labore et dolore magna aliqua. Utenim ad minim veniam, quis nostrud exercitation ullamco laborisnisi ut aliquip ex ea commodo consequat.</p><p>Sed ut perspiciatis unde omnis iste natus error sit voluptatemaccusantium doloremque laudantium, totam rem aperiam, eaque ipsaquae ab illo inventore veritatis et quasi architecto beataevitae dicta sunt explicabo.</p></div><div class="col-md-6 col-lg-8"" style="background-color: #dedef8;box-shadow: inset 1px -1px 1px #444, inset -1px 1px 1px #444;">11<p>Sed ut perspiciatis unde omnis iste natus error sit voluptatemaccusantium doloremque laudantium.</p><p> Neque porro quisquam est, qui dolorem ipsum quia dolor sitamet, consectetur, adipisci velit, sed quia non numquam eiusmodi tempora incidunt ut labore et dolore magnam aliquam quaeratvoluptatem.</p></div></div>Example:Mobile,tablet,desktopsWe have seen an examp l e for Med i um and Large Dev i ce. Now l et us take i t to anotherl eve l, where we wou l d want to change i t for the extra sma ll phone s i ze as we ll. Say wewant to add the opt i on for the co l umns to be sp li t 75%/25% for tab l ets, we go li ke th i s:<div class="col-sm-3 col-md-6 col-lg-4">....</div><div class="col-sm-9 col-md-6 col-lg-8">....</div>Now th i s g i ves us 3 d i fferent co l umn l ayouts at each po i nt. On a phone, i t w ill be 75% onthe l eft, and 25% on the r i ght. On a tab l et, i t w ill be 50%/50% aga i n, and on a l argev i ewport, i t w ill be 33%/66%. Three d i fferent l ayouts for each of the three respons i ves i zes. Check i t out i n the fo ll ow i ng examp l e. (Here sty li ng for each co l umn i s used. Youcan avo i d i t.)<div class="container"><h1>Hello, world!</h1><div class="row"><div class="col-sm-3 col-md-6 col-lg-8"style="background-color: #dedef8; box-shadow:inset 1px -1px 1px #444,12inset -1px 1px 1px #444;"><p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmodtempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodoconsequat.</p><p>Sed ut perspiciatis unde omnis iste natus error sit voluptatemaccusantium doloremque laudantium, totam rem aperiam, eaque ipsaquae ab illo inventore veritatis et quasi architecto beatae vitae dictasunt explicabo.</p> </div><div class="col-sm-9 col-md-6 col-lg-4"style="background-color: #dedef8; box-shadow:inset 1px -1px 1px #444, inset -1px 1px 1px#444;"><p>Sed ut perspiciatis unde omnis iste natus error sit voluptatemaccusantium doloremque laudantium.</p><p> Neque porro quisquam est, qui dolorem ipsum quia dolor sitamet, consectetur, adipisci velit, sed quia non numquam eiusmodi tempora incidunt ut labore et dolore magnam aliquam quaeratvoluptatem.</p></div></div>13。
Bootstrap5文字排版菜鸟教程Bootstrap 5 默认设置Bootstrap 5 默认的 font-size 为 16px, line-height 为 1.5。
默认的 font-family 为 "Helvetica Neue", Helvetica, Arial, sans-serif。
此外,所有的<p> 元素margin-top: 0 、margin-bottom: 1rem (16px)。
<h1> - <h6>Bootstrap 中定义了所有的 HTML 标题(h1 到 h6)的样式。
请看下面的实例:实例<div class="container"> <h1>h1 Bootstrap 标题</h1> <h2>h2 Bootstrap 标题</h2> <h3>h3 Bootstrap 标题</h3> <h4>h4 Bootstrap 标题</h4> <h5>h5 Bootstrap 标题</h5> <h6>h6 Bootstrap 标题</h6> </div>尝试一下»你也可以使用 .h1 到 .h6 类来设置元素的样式:实例<div class="container"> <p class="h1">h1 Bootstrap 标题</p> <p class="h2">h2 Bootstrap 标题</p> <p class="h3">h3 Bootstrap 标题</p> <p class="h4">h4 Bootstrap 标题 </p> <p class="h5">h5 Bootstrap 标题</p> <p class="h6">h6 Bootstrap 标题</p> </div>尝试一下»Display 标题类Bootstrap 还提供了四个 Display 类来控制标题的样式: .display-1, .display-2, .display-3, .display-4。
bootstrap基础设计基本表格Bootstrap基础设计是一种流行的前端框架,它具有可重用性和易于定制的特点,以帮助创建更易于上手和美观的界面。
在此框架中,表格是其中非常重要的一部分,可以帮助您展示数据和信息。
在本文中,我们将介绍bootstrap基础设计中的基本表格。
第一步,为表格设置基本结构。
在引入bootstrap文件后,可以通过以下代码,从表开始构建。
<div class="table-responsive"><table class="table"></table></div>第二步,添加表头。
在表格中,表头通常用于标识每列所表示的内容。
下面的代码显示如何向表格中添加表头。
<thead><tr><th>#</th><th>First Name</th><th>Last Name</th><th>Username</th></tr></thead>第三步,添加表格内容。
一旦您有了表头,就可以添加内容了。
此处添加了三行内容,具体可以根据您的需要进行自定义。
<tbody><tr><td>1</td><td>Mark</td><td>Otto</td><td>@mdo</td></tr><tr><td>2</td><td>Jacob</td><td>Thornton</td><td>@fat</td></tr><tr><td>3</td><td>Larry</td><td>the Bird</td><td>@twitter</td></tr></tbody>第四步,添加表格样式。