添加h标签字体样式
h1
h2
h3
h4
h5
h标签的副标签
<h3>这是主标题
<small>这是副标题</small>
</h3>
更大的标题
display-1
display-2
display-3
display-4
引言
lead 突出显示
返回顶部
<p><del>这是一段被删除的文本</del><ins>,这是一段新插入进去的文本</ins></p>
<p><em>这里的文本会倾斜</em></p>
<p><strong>这里的文本会加粗</strong></p>
<p><abbr title="attrbitue">attr</abbr></p>
<p><abbr title="Hypper Text Markup Langauge" class="initialism">HTML</abbr></p>
无特效列表
list-unstyled 无特效列表
list-inline 让里面的li变为inline-block
list-inline-item 需要给li加上才行 3.x版本不需要在li上面加list-inlien-item
text-truncate 单行文本溢出打点省略 3.x版本使用的是text-overflow
想要保存的话按ctrl+s保存
```<div class="container">
<div class="row">
<figure class="figure">
<img class="img-fluid rounded figure-img" src="1.jpg" alt="">
<figcaption class="figure-caption">这是谁</figcaption>
</figure>
</div>
</div>
<div class="row">
<picture>
<source media="(min-width:1200px)" srcset="./1.jpg">
<source media="(min-width:992px)" srcset="./2.jpg">
<source media="(min-width:768px)" srcset="./3.jpg">
<source media="(min-width:576px)" srcset="./4.jpg">
<img src="./5.jpg" alt="">
</picture>
</div>
<div class="container">
<div class="row">
<div class="col bg-primary text-white d-xl-block d-none">只在超大屏幕下显示</div>
<div class="col bg-dark text-white d-none d-lg-block d-xl-none">只在大屏幕下显示</div>
<div class="col bg-dark text-white d-none d-md-block d-lg-none">只在中等屏幕下显示</div>
<div class="col bg-dark text-white d-none d-sm-block d-md-none">只在小屏幕下显示</div>
<div class="col bg-dark text-white d-sm-none">只在超小屏幕下显示</div>
</div>
</div>
<div class="container mt-5">
<div class="row">
<div class="col bg-primary text-white d-xl-none">只在超大屏幕以外显示</div>
<div class="col bg-dark text-white d-lg-none d-xl-block">只在大屏幕以外显示</div>
<div class="col bg-dark text-white d-md-none d-lg-block">只在中等屏幕以外显示</div>
<div class="col bg-dark text-white d-sm-none d-md-block">只在小屏幕以外显示</div>
<div class="col bg-dark text-white d-sm-block d-none">只在超小屏幕以外显示</div>
</div>
</div>
<div class="container">
<div class="row">
<div class="embed-responsive embed-responsive-16by9">
<iframe src='https://player.youku.com/embed/XNTIwMTQxMDMyOA==' allowfullscreen></iframe>
</div>
</div>
</div>
<div class="row mt-5">
<button type="button" class="close"></button>
<span>×</span>
</div>
<div class="row mt-5">
<h1 class="text-hide"
style="background-image: url('/assets/brand/bootstrap-solid.svg'); width: 50px; height: 50px;">Bootstrap
</h1>
</div>
<div class="row">
<div class="text-nowrap text-truncate" style="width: 8rem;">
This text should overflow the parent.
</div>
</div>
<!-- fade show 是动画 -->
<!-- data-dismiss 是js -->
× 是x
<div class="alert alert-warning alert-dismissible fade show">
这是一个可以关闭的警告框,但是需要引入jquery和bootstrap.js
<button class="close" data-dismiss="alert">×</button>
</div>
<nav>
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="#">首页</a></li>
<li class="breadcrumb-item"><a href="#">关于我们</a></li>
<li class="breadcrumb-item active">联系我们</li>
</ol>
</nav>
<!-- 不同类型的按钮 -->
<a class="btn btn-primary" href="#">a标签按钮</a>
<button class="btn btn-secondary" type="submit">button标签按钮</button>
<input type="button" value="input标签" class="but but-success" >
<!-- 点击切换状态 -->
<button class="btn btn-primary " data-toggle="button">点击切换状态</button>
<!-- 切换按钮的active状态 -->
<button id="btn" class="btn btn-primary">点击切换状态</button>
<script>
$('#btn').button('toggle')
</script>
<!-- 左箭头 -->
<a href="#indicators" class="carousel-control-prev" data-slide='prev'>
<span class="carousel-control-prev-icon"></span>
</a>
<!-- 右箭头 -->
<a href="#indicators" class="carousel-control-next" data-slide='next'>
<span class="carousel-control-next-icon"></span>
</a>
<ol class="carousel-indicators">
<li class="active" data-target="#indicators" data-slide-to="0"></li>
<li data-target="#indicators" data-slide-to="1"></li>
<li data-target="#indicators" data-slide-to="2"></li>
</ol>
<div class="carousel-item active">
<img src="1.jpg" alt="" class="img-fluid">
<div class="carousel-caption">
<h5>这是一张图</h5>
<p>这是文字</p>
</div>
</div>
//启动轮播图
$('#methods').carousel({
interval: 2000
});
//左到右循环播放
$('#methods').carousel('cycle');
//停止轮播
$('#methods').carousel('pause');
//上一张轮播图
$('#methods').carousel('prev')
//下一张轮播图
$('#methods').carousel('next')
//指示器添加事件
$('.indicators li').each(function(index,ele){
$(ele).on('click',function(){
$('#methods').carousel(index)
})
})
$('#methods').on('slide.bs.carousel',function(e){
console.log(e.direction) //轮播滚动的方向
console.log(e.relatedTarget) //下一个dom
console.log(e.from) //当前dom位置索引
console.log(e.to) //滑动到下一个dom的位置索引
})
<p>
<a href="#jiuyi" class="btn btn-primary" data-toggle="collapse">九依</a>
<button data-toggle="collapse" data-target="#jiuyi" class="btn btn-primary"> 九依</button>
</p>
<!-- 折叠块 -->
<div class="collapse show" id="jiuyi">
<div class="card card-body">
<p class="card-text">???????????????????????????????????????????</p>
</div>
</div>
$('#myCollapse').collapse('toggle') //执行淡入,隐藏
$('#myCollapse').collapse('show')//显示
$('#myCollapse').collapse('hide')//隐藏
$('#myCollapse').on('show.bs.collapse',function(e){
console.log('我显示了')
})
$('#myCollapse').on('shown.bs.collapse',function(e){
console.log('折叠完成')
})
$('#myCollapse').on('hide.bs.collapse',function(e){
console.log('开始隐藏')
})
$('#myCollapse').on('hidden.bs.collapse',function(e){
console.log('全部隐藏')
})
<div class="dropdown">
<button class="btn btn-secondary dropdown-toggle" data-toggle="dropdown">button标签下拉</button>
<div class="dropdown-menu">
<a class="dropdown-item" href="">北京</a>
<a class="dropdown-item" href="">上海</a>
<a class="dropdown-item" href="">广州</a>
</div>
</div>
form-group 表单组
form-control input表单重置样式,button
form-text 配合input:text使用 字体样式
text-muted 配合input:text使用 字体样式
form-control-file 提交文件按钮样式
form-control-range 滑块样式
form-check-inline 让单选/复选框一行展示
form-check 复/单选框组
form-check-input 复/单选框样式
form-check-lable 复选框样式
form-control-lg / col-form-label-lg 大尺寸的表单
form-control-sm / col-form-label-sm 小尺寸的表单
form-inline 变为一行
readonly 只读属性
form-control-plaintext 只读文本样式
col-form-label 文本垂直对齐
验证表单
valid-feedback 验证通过
invalid-feedback 验证失败
required 提交验证
novalidate 加了之后没有值的input可以通过
(function(){
var forms = document.querySelectorAll('.needs-validation');
forms.forEach(function(form,index){
form.addEventListener('submit',function(ev){
if(form.checkValidity()===false){
ev.preventDefault(); //阻止默认事件
ev.stopPropagation();//防止冒泡
}
form.classList.add('was-validated')//添加验证
})
})
}())
<div class="form-group input-group">
<div class="input-group-prepend">
<span class="input-group-text">上传在左边</span>
</div>
<div class="custom-file">
<input type="file" name="" id="file" class="custom-file-input">
<label for="file" class="custom-file-label"></label>
</div>
</div>
<div class="jumbotron">
<h1 class="display-3">Hello, world!</h1>
<p class="lead">This is a simple hero unit, a simple jumbotron-style component for calling extra attention to featured content or information.</p>
<hr class="my-4">
<p>It uses utility classes for typography and spacing to space content out within the larger container.</p>
<p class="lead">
<a class="btn btn-primary btn-lg" href="#" role="button">Learn more</a>
</p>
</div>
<div class="row mt-5">
<div class="col">
<ul class="list-group">
<li class="list-group-item d-flex justify-content-between align-items-center">
red
<span class="badge badge-danger badge-pill">14</span>
</li>
</ul>
</div>
</div>
<div class="row mt-5">
<div class="col-4">
<div class="list-group" id="myList">
<a href="#list-home1" class="list-group-item list-group-item-action">Home</a>
<a href="#list-profile1" class="list-group-item list-group-item-action ">Profile</a>
<a href="#list-messages1" class="list-group-item list-group-item-action ">Messages</a>
<a href="#list-settings" class="list-group-item list-group-item-action ">Settings</a>
</div>
</div>
<div class="col-8">
<div class="tab-content">
<div class="tab-pane fade " id="list-home1">HomeHomeHomeHomeHomeHomeHomeHomeHomeHome</div>
<div class="tab-pane fade" id="list-profile1">ProfileProfileProfileProfileProfileProfileProfile
</div>
<div class="tab-pane fade" id="list-messages1">messagesmessagesmessagesmessagesmessagesmessages
</div>
<div class="tab-pane fade" id="list-settings1">
SettingsSettingsSettingsSettingsSettingsSettingsSettings</div>
</div>
</div>
</div>
<script>
$('#myList a:first-child').tab('show');
$('#myList a').on('click', function () {
$(this).tab('show')
})
</script>
<!-- button打开模态框 -->
<!-- data属性 -->
<!-- data-backdrop="false"是否显示遮罩层 -->
<!-- data-keyboard=" false"键盘esc是否退出,需要获得焦点 -->
<!-- data.focus 让模态框获取到焦点(没啥用) -->
<!-- data.show 初始化模态框是否显示 -->
<button class="btn btn-primary" data-toggle="modal" data-target="#modal1">普通模态框</button>
$('#modal4').on('show.bs.modal',function(ev){
// 1. $(ev.relatedTarget) 这个值为点击的button
// 2. .data('wahtever') 这个是获取data-开关的属性的值
var value = $(ev.relatedTarget).data('whatever');
$(this).find('.modal-title').text('新评论来自于' + value);
$(this).find('.modal-body input').val(value)
})
$("#myBtn").on('click',function(){
$('#modal8').modal('show')
})
$('#modal8').modal('show');
setTimeout(function(){
$('#modal8').modal('hide');
},2000)
<div class="container">
<div class="row">
<div class="col">
<div class="media">
<a href=""><img width="150" src="1.jpg" alt=""></a>
<div class="media-body ml-2">
<h5>这是标题</h5>
这是一段文本这是一段文本这是一段文本这是一段文本
</div>
</div>
</div>
</div>
</div>
<div class="row mt-5">
<div class="col">
<ul class="nav nav-tabs">
<li class="nav-item"><a href="#home" class="nav-link active" data-toggle="tab">Home</a></li>
<li class="nav-item"><a href="#profile" class="nav-link" data-toggle="tab">Profile</a></li>
<li class="nav-item"><a href="#contact" class="nav-link" data-toggle="tab">Contact</a></li>
</ul>
<div class="tab-content">
<div class="tab-pane show acitve fade" id="home">HomeHomeHome</div>
<div class="tab-pane fade" id="profile">HProfileProfileProfile</div>
<div class="tab-pane fade" id="contact">ContactContactContactContacte</div>
</div>
</div>
</div>
<div class="row mt-5">
<ul class="nav nav-pills flex-column col-3" id="mymenu">
<li class="nav-item"><a href="#home2" class=" nav-link ">Home</a></li>
<li class="nav-item"><a href="#profile2" class="nav-link">Profile</a></li>
<li class="nav-item"><a href="#contact2" class=" nav-link">Contact</a></li>
</ul>
<div class="tab-content col-9">
<div class="tab-pane fade show" id="home2">HomeHomeHome</div>
<div class="tab-pane fade" id="profile2">HProfileProfileProfile</div>
<div class="tab-pane fade" id="contact2">ContactContactContactContacte</div>
</div>
</div>
$('#mymenu li:first-child a').tab('show')
$('#mymenu li a').on('click', function () {
$(this).tab('show')
})
$('#mymenu li:first-child a').on('show.bs.tab', function () {
console.log('该内容要显示了')
})
$('#mymenu li:first-child a').on('shown.bs.tab', function () {
console.log('该内容已经显示了')
})
$('#mymenu li:first-child a').on('hide.bs.tab', function () {
console.log('要消失了')
})
$('#mymenu li:first-child a').on('hidden.bs.tab', function () {
console.log('已经完全消失了')
})
$(function(){
//初始化
$('[data-toggle="popover"]').popover();
//显示
$(this).popover('show');
//隐藏
$(this).popover('hide')
//显示隐藏切换
$(this).popover('toggle')
//销毁
$(this).popover('dispose')
//创建[data-toggle="popover"]
$(this).popover('enable')
//删除[data-toggle="popover"]
$(this).popover('disable')
//创建删除
$(this).popover('toggleEnabled')
// 事件
$(this).on('show.bs.popover',function(){
console.log('显示开始')
})
$(this).on('shown.bs.popover',function(){
console.log('显示好了')
})
$(this).on('hide.bs.popover',function(){
console.log('开始隐藏')
})
$(this).on('hidden.bs.popover',function(){
console.log('隐藏好了')
})
$(this).on('inserted.bs.popover',function(){
console.log('创建好了dom')
})
})
$(function(){
//初始化
$('[data-toggle="tooltip"]').popover();
//显示
$(this).tooltip('show');
//隐藏
$(this).tooltip('hide')
//显示隐藏切换
$(this).tooltip('toggle')
//销毁
$(this).tooltip('dispose')
//创建[data-toggle="popover"]
$(this).tooltip('enable')
//删除[data-toggle="popover"]
$(this).tooltip('disable')
//创建删除
$(this).tooltip('toggleEnabled')
// 事件
$(this).on('show.bs.popover',function(){
console.log('显示开始')
})
$(this).on('shown.bs.popover',function(){
console.log('显示好了')
})
$(this).on('hide.bs.popover',function(){
console.log('开始隐藏')
})
$(this).on('hidden.bs.popover',function(){
console.log('隐藏好了')
})
$(this).on('inserted.bs.popover',function(){
console.log('创建好了dom')
})
})
<div class="list-group col-2">
<a href="#item1" class="fode list-group-item list-group-item-action">item1</a>
<a href="#item2" class="fode list-group-item list-group-item-action">item2</a>
<a href="#item3" class="fode list-group-item list-group-item-action">item3</a>
<a href="#item4" class="fode list-group-item list-group-item-action">item4</a>
</div>
<div class="bodyScoll1 col-10"data-target="#scoll" data-offset="0" data-spy="scroll" >
<h5 id="item1">item1</h5>
<p>...</p>
<h5 id="item2">item1</h5>
<p>...</p>
<h5 id="item3">item1</h5>
<p>...</p>
<h5 id="item4">item1</h5>
<p>...</p>
</div>
<div class=" mt-5">
<div class="toast "data-autohide="false" data-animation="true" data-delay="2000">
<div class="toast-header">
<strong class="mr-auto">Bootstrap</strong>
<small>11 mins ago</small>
<button class="close ml-1 mb-1" data-dismiss="toast">
<span>×</span>
</button>
</div>
<div class="toast-body">Hello,World,This is NeW World</div>
</div>
</div>
<script>
$(function(){
$('.toast').toast('show'); //显示
$('.toast').toast('hide'); //隐藏
//事件
$('.toast').on('show.bs.toast',function(){
console.log('消息框要显示了')
})
$('.toast').on('shown.bs.toast',function(){
console.log('消息框显示了')
})
$('.toast').on('hide.bs.toast',function(){
console.log('消息框要隐藏了')
})
$('.toast').on('hidden.bs.toast',function(){
console.log('消息框隐藏了')
})
})
</script>
返回顶部
animation=“true” data-delay=“2000”>