bootstrop
Bootstrap
è§å£
è§å£çæ¦å¿µ
1.å¨PC端没æè§å£çæ¦å¿µï¼åªæçªå£ã
2.æ¯html页é¢å¤é¢çä¸ä¸ªå®¹å¨æ们ä¼æææçå
容é½æ¾è¿è§å£éé¢ï¼ç¶åå¨å¯¹è§å£è¿è¡ç¼©æ¾
3.é»è®¤è§å£ç宽度æ¯980px å 为æ©æPC端ç½é¡µççå¿ç980px
4.è§å£å®½åº¦ä¸º980px对äºç§»å¨ç«¯æ¥è¯´ä¼åºç°ç¼©å°åæåå¾å°çæ
åµ æ以åæ¥æä¾äºåå»æ¾å¤§çåè½ï¼ä½æ¯éè¦å·¦å³æ»å¨ï¼ç¨æ·ä½éªå¾å·®ï¼æ以æ们éè¦è®¾ç½®ç§»å¨ç«¯çè§å£ä¸åç缩æ¾
metaæ ç¾
metaæ ç¾æ¯å¯¹ç½é¡µè¿è¡é ç½®
<meta name="viewport" content="width=device-width, initial-scale=1.0">
â a.nameæçæ¯æ们éè¦é
ç½®çä¸è¥¿çåå,viewport æçæ¯é
ç½®è§å£
â b.content æçæ¯éè¦é
ç½®çå
容éé¢,设置å¤ä¸ªå±æ§æ¶ä½¿ç¨éå·éå¼
â width æçæ¯è®¾ç½®è§å£ç宽度 é»è®¤æ¯980 è¿é设置çdevice -widthæçæ¯åæ们çææºå±å¹ä¸æ ·å®½
â initial-scale åå§å缩æ¾1.0 æçå°±æ¯ä¸è¿è¡ç¼©æ¾
â user-scalable æçæ¯ç¨æ·æ¯å¦å¯ä»¥è¿è¡ç¼©æ¾no表示ä¸å
许 yes表示å
许
â maximum-scale 设置移å¨ç«¯é¡µé¢æ大çæ¾å¤§åæ°1.0 表示ä¸è½æ¾å¤§
â minimum-scale 设置移å¨ç«¯ä¹ä¹°çå¢æå°æ¾å¤§åæ° 1.0表示ä¸è½ç¼©å°
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
//ä¸è¿°3个metaæ ç¾*å¿
é¡»*æ¾å¨æåé¢ï¼ä»»ä½å
¶ä»å
容é½*å¿
é¡»*è·éå
¶åï¼
å¼å ¥bootstrap
å¼å ¥bootstrap.css
å¼å ¥bootstrapçcssæ件
<link href="bootstrap/css/bootstrap.min.css" rel="stylesheet">
å¼å ¥bootstrap.js
1.boots trapæ¡æ¶æ¯ä¾èµäºjQueryç æ以å¨å¼å ¥bootstrap.jsä¹åä¸å®å®è¦å å¼å ¥ jQuery
2.å¼å ¥bootstrap.min.jsæ¯å è½½ Bootstrap çææ JavaScript æ件ãä½ ä¹å¯ä»¥æ ¹æ®éè¦åªå è½½å个æ件
<script src="jquery.min.js"></script>
<script src="bootstrap/js/bootstrap.min.js"></script>
Glyphicons åä½å¾æ
å æ¬250å¤ä¸ªæ¥èª Glyphicon Halflings çåä½å¾æ ãhttps://v3.bootcss.com/components/
<span class="glyphicon glyphicon-search" aria-hidden="true"></span>
bootstrap容å¨
container 宽度åºå®å¹¶ä¸å± ä¸æ¾ç¤ºçå®¹å¨ æ¯ä¸ 个ååºå¼çå®¹å¨ ä¼è·éå±æçååè宽度åçååæ°¸ è¿ä¿æå± ä¸
container-fluid å ¨å±å®¹å¨
<div class="container"</div>
<!-- å
¨å±å®¹å¨ -->
<div class="container-fluid"></div>
å æ ¼ç³»ç»
Bootstrap æä¾äºä¸å¥ååºå¼ã移å¨è®¾å¤ä¼å çæµå¼æ æ ¼ç³»ç»ï¼éçå±å¹æè§å£ï¼viewportï¼å°ºå¯¸çå¢å ï¼ç³»ç»ä¼èªå¨å为æå¤12åãå®å å«äºæäºä½¿ç¨çé¢å®ä¹ç±»ï¼è¿æ强大çmixin ç¨äºçææ´å ·è¯ä¹çå¸å±
ä»ç»
1.æ
æ ¼ç³»ç»ç¨äºéè¿ä¸ç³»åçè¡ï¼rowï¼ä¸åï¼columnï¼çç»åæ¥å建页é¢å¸å±ï¼ä½ çå
容就å¯ä»¥æ¾å
¥è¿äºå建好çå¸å±ä¸ãä¸é¢å°±ä»ç»ä¸ä¸ Bootstrap æ
æ ¼ç³»ç»çå·¥ä½åçï¼
a.âè¡ï¼rowï¼âå¿
é¡»å
å«å¨ â.containerâï¼åºå®å®½åº¦ï¼æ â.container-fluidâ100% 宽度ï¼ä¸ï¼ä»¥ä¾¿ä¸ºå
¶èµäºåéçæåï¼aligmentï¼åå
è¡¥ï¼paddingï¼ã
b.éè¿âè¡ï¼rowï¼âå¨æ°´å¹³æ¹åå建ä¸ç»âåï¼columnï¼âã
c.ä½ çå
容åºå½æ¾ç½®äºâåï¼columnï¼âå
ï¼å¹¶ä¸ï¼åªæâåï¼columnï¼âå¯ä»¥ä½ä¸ºè¡ï¼rowï¼âçç´æ¥åå
ç´ ã
d.类似â.rowâåâ.col-xs-4âè¿ç§é¢å®ä¹çç±»ï¼å¯ä»¥ç¨æ¥å¿«éå建æ
æ ¼å¸å±ã
e.éè¿ä¸ºâåï¼columnï¼â设置âpaddingâå±æ§ï¼ä»èå建åä¸åä¹é´çé´éï¼gutterï¼ãéè¿ä¸ºâ.rowâå
ç´ è®¾ç½®è´å¼âmarginâä»èæµæ¶æ为â.containerâå
ç´ è®¾ç½®çâpaddingâï¼ä¹å°±é´æ¥ä¸ºâè¡ï¼rowï¼âæå
å«çâåï¼columnï¼âæµæ¶æäºâpaddingâã
f.è´å¼ç marginå°±æ¯ä¸é¢ç示ä¾ä¸ºä»ä¹æ¯åå¤çªåºçåå ãå¨æ
æ ¼åä¸çå
容ææä¸è¡ã
g.æ
æ ¼ç³»ç»ä¸çåæ¯éè¿æå®1å°12çå¼æ¥è¡¨ç¤ºå
¶è·¨è¶çèå´ãä¾å¦ï¼ä¸ä¸ªç宽çåå¯ä»¥ä½¿ç¨ä¸ä¸ªâ.col-xs-4âæ¥å建ã
h.å¦æä¸âè¡ï¼rowï¼âä¸å
å«äºçâåï¼columnï¼âå¤§äº 12ï¼å¤ä½çâåï¼columnï¼âæå¨çå
ç´ å°è¢«ä½ä¸ºä¸ä¸ªæ´ä½å¦èµ·ä¸è¡æåã
i.æ
æ ¼ç±»éç¨äºä¸å±å¹å®½åº¦å¤§äºæçäºåçç¹å¤§å°çè®¾å¤ ï¼å¹¶ä¸é对å°å±å¹è®¾å¤è¦çæ
æ ¼ç±»ãå æ¤ï¼å¨å
ç´ ä¸åºç¨ä»»ä½â.col-md-â»âï¼æ
æ ¼ç±»éç¨äºä¸å±å¹å®½åº¦å¤§äºæçäºåçç¹å¤§å°çè®¾å¤ ï¼å¹¶ä¸é对å°å±å¹è®¾å¤è¦çæ
æ ¼ç±»ã å æ¤ï¼å¨å
ç´ ä¸åºç¨ä»»ä½â.col-lg-â»'ä¸åå¨ï¼ ä¹å½±å大å±å¹è®¾å¤ã
æ æ ¼åæ°
éè¿ä¸è¡¨å¯ä»¥è¯¦ç»æ¥ç Bootstrap çæ æ ¼ç³»ç»æ¯å¦ä½å¨å¤ç§å±å¹è®¾å¤ä¸å·¥ä½çã
è¶ å°å±å¹ ææº (<768px) | å°å±å¹ å¹³æ¿ (â¥768px) | ä¸çå±å¹ æ¡é¢æ¾ç¤ºå¨ (â¥992px) | 大å±å¹ 大æ¡é¢æ¾ç¤ºå¨ (â¥1200px) | |
---|---|---|---|---|
æ æ ¼ç³»ç»è¡ä¸º | æ»æ¯æ°´å¹³æå | 大äºéå¼æ¶å为水平æå | ååä¸é¡¹ | ååä¸é¡¹ |
.container æ大宽度 | None ï¼èªå¨ï¼ | 750px | 970px | 1170px |
ç±»åç¼ | .col-xs- | .col-sm- | .col-md- | .col-lg- |
åï¼columnï¼æ° | 12 | 12 | 12 | 12 |
æ大åï¼columnï¼å®½ | èªå¨ | ~62px | ~81px | ~97px |
槽ï¼gutterï¼å®½ | 30px ï¼æ¯åå·¦å³åæ 15px | 30px ï¼æ¯åå·¦å³åæ 15px | 30px ï¼æ¯åå·¦å³åæ 15px | 30px ï¼æ¯åå·¦å³åæ 15px |
å¯åµå¥ | æ¯ | æ¯ | æ¯ | æ¯ |
å移ï¼Offsetsï¼ | æ¯ | æ¯ | æ¯ | æ¯ |
åæåº | æ¯ | æ¯ | æ¯ | æ¯ |
å®ä¾
1.row
a.ä¸å®è¦åå¨å®¹å¨éé¢è¦ä¸ç¶ä¼äº§çæ»å¨æ¡ å 为ä»è®¾ç½®äºå¤è¾¹è·æ¥æµæ¶å®¹å¨çå
è¾¹è· å¦æä¸ç¨å®¹å¨å
裹宽度就ä¼è¶
åºå»(å
¶å®å®¹å¨åæ¬æ¯æ15pxçå·¦å³å
è¾¹è·å¨ rowéé¢è®¾ç½®äºå®½åº¦ä¸ºautoç¶åmargin-leftåmargin-right ç»è´å¼é£ä¹å°±æµæ¶äºå®¹å¨çè¾¹è·)
b.å¦ærow宽度设æ»äºæ¯100% é£ä¹marginå°±åªä¼å½±åçåçä½ç½®ä¸ä¼å½±åçå大å°
c.å¦ærow宽度ç»äºauto ä¸ä»£è¡¨ä»ä¸å®æ¯å®½åº¦ç100% é»è®¤æ¯100% å¦æç»çåçmargin为è´å¼ é£ä¹é»çåä¼å大
2.æ
æ ¼ç³»ç»å®ä¹çç±»å
a.åä¸å
¼å®¹:å¾å¤§çå±å¹è¿è¡å
¼å®¹
b.åä¸è¦ç:ä¸ä½æ¯è¾å¤§çå±å¹çæ ·å¼çæé£ä¹å°±ä¼å¯¹ä¹åçæ¯è¾å°çå±å¹ä¸çæ ·å¼è¿è¡è¦ç
c.åä¸å
¼å®¹ç好å¤:å½å¤ä¸ªå±å¹å¸å±ä¸æ ·æ¶ä¸éè¦å
¨é¨ååªéè¦åå
¶ä¸æå°çé£ä¸ä¸ªå³å¯
d.åä¸è¦çç好å¤:å½æ们åæ¶åäºå¾å¤ç±»åæ¶å¤§å±å¹ç±»åçæ é£ä¹å°±ä¼ è¦çå°å±æ
çç±»åæ ·å¼
e.åä¸è¦ççåçå°±æ¯cssæ ·å¼ç书å顺åºçé®é¢ä¹å°±æ¯è¯´å¤§å± å¹çç±»åæºç å¨åé¢
3.col
a.åå¿
é¡»åè¡éé¢ (åªæåå¯ä»¥ä½ä¸ºè¡çç´æ¥åå
ç´ )
//css:
<style type="text/css">
.row>div {
height: 100px;
border: 1px solid black;
text-align: center;
line-height: 100px;
}
</style>
//html
<div class="container">
<div class="row">
<div class="col-xs-6 col-sm-4 col-md-3 col-lg-2">ææ¯ç¬¬1个divçå</div>
<div class="col-xs-6 col-sm-4 col-md-3 col-lg-2">ææ¯ç¬¬2个divçå</div>
<div class="col-xs-6 col-sm-4 col-md-3 col-lg-2">ææ¯ç¬¬3个divçå</div>
<div class="col-xs-6 col-sm-4 col-md-3 col-lg-2">ææ¯ç¬¬4个divçå</div>
<div class="col-xs-6 col-sm-4 col-md-3 col-lg-2">ææ¯ç¬¬5个divçå</div>
<div class="col-xs-6 col-sm-4 col-md-3 col-lg-2">ææ¯ç¬¬6个divçå</div>
<div class="col-xs-6 col-sm-4 col-md-3 col-lg-2">ææ¯ç¬¬7个divçå</div>
<div class="col-xs-6 col-sm-4 col-md-3 col-lg-2">ææ¯ç¬¬8个divçå</div>
<div class="col-xs-6 col-sm-4 col-md-3 col-lg-2">ææ¯ç¬¬9个divçå</div>
<div class="col-xs-6 col-sm-4 col-md-3 col-lg-2">ææ¯ç¬¬10个divçå</div>
<div class="col-xs-6 col-sm-4 col-md-3 col-lg-2">ææ¯ç¬¬11个divçå</div>
<div class="col-xs-6 col-sm-4 col-md-3 col-lg-2">ææ¯ç¬¬12个divçå</div>
</div>
<div class="row">
<div class="col-xs-6">ææ¯ç¬¬1个divçå</div>
<div class="col-xs-6">ææ¯ç¬¬1个divçå</div>
<div class="col-xs-6">ææ¯ç¬¬1个divçå</div>
<div class="col-xs-6">ææ¯ç¬¬1个divçå</div>
<div class="col-xs-6">ææ¯ç¬¬1个divçå</div>
<div class="col-xs-6">ææ¯ç¬¬1个divçå</div>
<div class="col-xs-6">ææ¯ç¬¬1个divçå</div>
<div class="col-xs-6">ææ¯ç¬¬1个divçå</div>
<div class="col-xs-6">ææ¯ç¬¬1个divçå</div>
<div class="col-xs-6">ææ¯ç¬¬1个divçå</div>
<div class="col-xs-6">ææ¯ç¬¬1个divçå</div>
<div class="col-xs-6">ææ¯ç¬¬1个divçå</div>
</div>
</div>
4.åå移
a.使ç¨.col-md-offset-* ç±»å¯ä»¥å°ååå³ä¾§å移ãè¿äºç±»å®é
æ¯éè¿ä½¿ç¨ * éæ©å¨ä¸ºå½åå
ç´ å¢å äºå·¦ä¾§çè¾¹è·ï¼marginï¼ã
<div class="row">
<div class="col-xs-6 col-sm-4"></div>
<div class="col-xs-6 col-sm-4"></div>
<div class="col-xs-6 col-xs-offset-3 col-sm-4 col-sm-offset-0"></div>
</div>
5.æåº
â a.éè¿ä½¿ç¨ .col-md-push-* å .col-md-pull-* 类就å¯ä»¥å¾å®¹æçæ¹ååï¼columnï¼ç顺åºã
<div class="row">
<div class="col-md-9 col-md-push-3">.col-md-9 .col-md-push-3</div>
<div class="col-md-3 col-md-pull-9">.col-md-3 .col-md-pull-9</div>
</div>
常è§çå¸å±æ¹å¼
1.åºå®å®½é«+æµ®å¨æè
å®ä½( åªé ä¼ ç»çPC端çå¸å±)
2.ç¾åæ¯å¸å±æ©æç移å¨ç«¯å¸å±
3.flexå¼¹æ§å¸å±
4.ååºå¼å¸å±éé
å¤ä¸ªç»ç«¯
5.remå¸å±æ¯è¾æ°åç移å¨ç«¯å¸å±
常ç¨æ ·å¼
1.æ é¢æ ç¾
ä¸ä¸é´è· åä½å¤§å°å ç²æ¾ç¤º å¨åçh1æ ç¾ ä¸é½åäºä¿®æ¹
<h1>ä½ å¥½ï¼ä¸ç</h1>
<span class="h1">ä½ å¥½ï¼ä¸ç</span>
2.段è½æ ç¾
æ¯å¨æ¯ä¸ä¸ªæ®µè½ä¹åä¼æ个marginéå¼
<p>Nullam quis risus eget urna mollis ornare vel eu leo.</p>
<p>Nullam quis risus eget urna mollis ornare vel eu leo.</p>
3.ææ¬çªåºæ¾ç¤º
leadç±»ç¨äºææ¬çªåºæ¾ç¤º
<p class="lead">Nullam quis risus eget urna mollis ornare vel eu leo.</p>
4.ææ¬é«äº®æ¾ç¤º
让markæ ç¾ä¸çææ¬é«äº®æ¾ç¤º
<mark>highlight</mark>
5.å é¤æä¸æ®µæå
表示å é¤æä¸æ®µæåå ¶å® å°±æ¯ä½¿ç¨text-decorationæ¥å®ç°çä½æ¯ èèå°è¯ä¹æç¡®åä¸è¬æ们é½ä½¿ ç¨de1æ ç¾
<del>This line of text is meant to be treated as deleted text.</del>
6.å é¤æ个ææ¬
sæ ç¾å¾å°sç¨äºå é¤æ个ææ¬
<s>This line of text is meant to be treated as no longer accurate.</s>
7.æå ¥ææ¬
表示æå ¥ææ¬èä¸ä½¿ç¨ä¸å线æ è®°è¯ä¹æç¡®åæ们ä¹æ¯ä½¿ç¨ins ins表示insert u表示underline åªæ¯ å纯çä¸å线
<ins>This line of text is meant to be treated as an addition to the document.</ins>
<u>This line of text will render as underlined</u>
8.缩å°ççææ¬
缩å°ççææ¬ä¸è¬æ¯ç¶å®¹å¨åä½ç85%
<small>This line of text is meant to be treated as fine print.</small>
9.æåå ç²
æåå ç²strong 强壮çææ表示å ç²bæ ç¾ è¡¨ç¤ºboldå ç²çææ ä½æ¯ç¨çä¸å¤
<strong>rendered as bold text</strong>
<b>rendered as bold text</b>
10.æä½
表示æä½ä½¿ç¨font-styleæ¥è®¾ç½® iæ ç¾ ä¹å¯ä»¥è¡¨ç¤ºä½æ¯ä¸ è¬ä¸ä¼ç¨äºè¡¨ç¤ºæä½
<em>rendered as italicized text</em>
<i>rendered as italicized text</i>
11.ææ¬ç对é½æ¹å¼
设置ææ¬ç对é½æ¹å¼ 使ç¨text-alianæ¥è®¾ç½®
<p class="text-left">Left aligned text.</p>
<p class="text-center">Center aligned text.</p>
<p class="text-right">Right aligned text.</p>
12.设置大å°å
<p class="text-lowercase">Lowercased text.</p><!-- å
¨é¨åå°å -->
<p class="text-uppercase">Uppercased text.</p><!-- å
¨é¨å大å -->
<p class="text-capitalize">Capitalized text.</p><!-- ææé¦åæ¯å大å -->
13.å表
â a.æ åºå表 æå顺åºæ å ³ç´§è¦çä¸åå ç´ ã
<ul>
<li>Lorem ipsum dolor sit amet</li>
<li>Consectetur adipiscing elit</li>
<li>Integer molestie lorem at massa</li>
<li>Facilisis in pretium nisl aliquet</li>
<li>Nulla volutpat aliquam velit
<ul>
<li>Phasellus iaculis neque</li>
<li>Purus sodales ultricies</li>
<li>Vestibulum laoreet porttitor sem</li>
<li>Ac tristique libero volutpat at</li>
</ul>
</li>
<li>Faucibus porta lacus fringilla vel</li>
<li>Aenean sit amet erat nunc</li>
<li>Eget porttitor lorem</li>
</ul>
â b.æåºå表 顺åºè³å ³éè¦çä¸ç»å ç´ ã
<ol>
<li>Lorem ipsum dolor sit amet</li>
<li>Consectetur adipiscing elit</li>
<li>Integer molestie lorem at massa</li>
<li>Facilisis in pretium nisl aliquet</li>
<li>Nulla volutpat aliquam velit</li>
<li>Faucibus porta lacus fringilla vel</li>
<li>Aenean sit amet erat nunc</li>
<li>Eget porttitor lorem</li>
</ol>
â c.æ æ ·å¼å表 移é¤äºé»è®¤ç list-style æ ·å¼å左侧å¤è¾¹è·çä¸ç»å ç´ ï¼åªé对ç´æ¥åå ç´ ï¼ãè¿æ¯é对ç´æ¥åå ç´ çï¼ä¹å°±æ¯è¯´ï¼ä½ éè¦å¯¹ææåµå¥çå表é½æ·»å è¿ä¸ªç±»æè½å ·æåæ ·çæ ·å¼ã
<ul class="list-unstyled">
<li>Lorem ipsum dolor sit amet</li>
<li>Consectetur adipiscing elit</li>
<li>Integer molestie lorem at massa</li>
<li>Facilisis in pretium nisl aliquet</li>
<li>Nulla volutpat aliquam velit
<ul>
<li>Phasellus iaculis neque</li>
<li>Purus sodales ultricies</li>
<li>Vestibulum laoreet porttitor sem</li>
<li>Ac tristique libero volutpat at</li>
</ul>
</li>
<li>Faucibus porta lacus fringilla vel</li>
<li>Aenean sit amet erat nunc</li>
<li>Eget porttitor lorem</li>
</ul>
â d.å èå表 éè¿è®¾ç½® display: inline-block; 并添å å°éçå è¡¥ï¼paddingï¼ï¼å°ææå ç´ æ¾ç½®äºåä¸è¡ã
<ul class="list-inline">
<li>Lorem ipsum</li>
<li>Phasellus iaculis</li>
<li>Nulla volutpat</li>
</ul>
â e.æè¿°å表 带ææè¿°ççè¯å表ã
<dl>
<dt>Description lists</dt>
<dd>A description list is perfect for defining terms.</dd>
<dt>Euismod</dt>
<dd>Vestibulum id ligula porta felis euismod semper eget lacinia odio sem nec elit.</dd>
<dd>Donec id elit non mi porta gravida at eget metus.</dd>
<dt>Malesuada porta</dt>
<dd>Etiam porta sem malesuada magna mollis euismod.</dd>
</dl>
â f.æ°´å¹³æåçæè¿°å表 .dl-horizontal å¯ä»¥è®©
- å
ççè¯åå
¶æè¿°æå¨ä¸è¡ãå¼å§æ¯å
- çé»è®¤æ ·å¼å å å¨ä¸èµ·ï¼éç导èªæ¡éæ¸å±å¼èæåå¨ä¸è¡ã
<dl class="dl-horizontal">
<dt>Description lists</dt>
<dd>A description list is perfect for defining terms.</dd>
<dt>Euismod</dt>
<dd>Vestibulum id ligula porta felis euismod semper eget lacinia odio sem nec elit.</dd>
<dd>Donec id elit non mi porta gravida at eget metus.</dd>
<dt>Malesuada porta</dt>
<dd>Etiam porta sem malesuada magna mollis euismod.</dd>
<dt>Felis euismod semper eget lacinia</dt>
<dd>Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus.</dd>
</dl>
14.è¡¨æ ¼
â a. table-striped æ马æ¡çº¹
â b. table-borderd è¾¹æ¡
â c. table-hover é¼ æ æ¬æµ®çç¶æ
â d. table-condensedç´§ç¼©è¡¨æ ¼ åå°è¡¨æ ¼ ä¹é´çpadding
â e.ç¶æç±»
Class | æè¿° |
---|---|
.active |
é¼ æ æ¬åå¨è¡æåå æ ¼ä¸æ¶æ设置çé¢è² |
.success |
æ è¯æåæ积æçå¨ä½ |
.info |
æ è¯æ®éçæ示信æ¯æå¨ä½ |
.warning |
æ è¯è¦åæéè¦ç¨æ·æ³¨æ |
.danger |
æ è¯å±é©ææ½å¨ç带æ¥è´é¢å½±åçå¨ä½ |
<table class="table table-striped table-borderd table-hove table-condensed">
<thead>
<tr class="active">
<th>#</th>
<th>First Name</th>
<th>Last Name</th>
<th>Username</th>
</tr>
</thead>
<tbody>
<tr class="success">
<th scope="row">1</th>
<td>Mark</td>
<td>Otto</td>
<td>@mdo</td>
</tr>
<tr class="warning">
<th scope="row">2</th>
<td>Jacob</td>
<td>Thornton</td>
<td>@fat</td>
</tr>
<tr class="danger">
<th scope="row">3</th>
<td colspan="2">Larry the Bird</td>
<td>@twitter</td>
</tr>
</tbody>
</table>
15.ååºå¼è¡¨æ ¼
â a.å°ä»»ä½â.tableâå
ç´ å
裹å¨â.table-responsiveâå
ç´ å
ï¼å³å¯å建ååºå¼è¡¨æ ¼ï¼å
¶ä¼å¨å°å±å¹è®¾å¤ä¸ï¼å°äº768pxï¼æ°´å¹³æ»å¨ãå½å±å¹å¤§äº 768px 宽度æ¶ï¼æ°´å¹³æ»å¨æ¡æ¶å¤±ã
â 注æç¹ï¼table-responsiveè¿ä¸ªç±»å¿
é¡»å å¨è¡¨æ ¼å¤é¢çä¸ä¸ªå®¹å¨éé¢èä¸ éé¢çå
ç´ å¿
é¡»æ¯è¡¨æ ¼ å½å±å¹æ æ³æ¾ç¤ºææçè¡¨æ ¼å
容æ¶å°±ä¼å¨è¡¨æ ¼å
é¨æ¾ç¤ºæ»å¨æ¡å¯ä»¥æ»å¨æ¾ç¤ºå¹¶ä¸æ¯é¡µé¢çæ»å¨æ¡
<div class="table-responsive">
<table class="table">
<thead>
<tr>
<th>#</th>
<th>Table heading</th>
<th>Table heading</th>
<th>Table heading</th>
<th>Table heading</th>
<th>Table heading</th>
<th>Table heading</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">1</th>
<td>Table cell</td>
<td>Table cell</td>
<td>Table cell</td>
<td>Table cell</td>
<td>Table cell</td>
<td>Table cell</td>
</tr>
<tr>
<th scope="row">2</th>
<td>Table cell</td>
<td>Table cell</td>
<td>Table cell</td>
<td>Table cell</td>
<td>Table cell</td>
<td>Table cell</td>
</tr>
<tr>
<th scope="row">3</th>
<td>Table cell</td>
<td>Table cell</td>
<td>Table cell</td>
<td>Table cell</td>
<td>Table cell</td>
<td>Table cell</td>
</tr>
</tbody>
</table>
</div>
16.表å
â a.ç¨çæ¯è¾å¤:
â form-horizontalæ¯è®©è¡¨åå
ç´ æ°´å¹³æåèä¸ ä½¿ç¨bootstrap设å®å¥½çæ
æ ¼ç±»
â form group å¨bootstrapéé¢è®¾å®å¥½äº-äºæ ·å¼è®©è¡¨åæç
§ä»çæ ·å¼è¿è¡æå
â form-controlæ¯ä¸æ§ä»¶ç宽度设置为100%èä¸æ¯è®¾ ç½®å¨inputå
ç´ ä¸é¢ç
â b.å
æ¬å¤§é¨å表åæ§ä»¶ãææ¬è¾å
¥åæ§ä»¶ï¼è¿æ¯æææ HTML5 ç±»åçè¾å
¥æ§ä»¶ï¼ textãpasswordãdatetimeãdatetime-localãdateãmonthãtimeãweekãnumberãemailãurlãsearchãtel å colorã
<form class="form-horizontal">
<div class="form-group">
<label for="inputEmail3" class="col-sm-2 control-label">Email</label>
<div class="col-sm-10">
<input type="email" class="form-control" id="inputEmail3" placeholder="Email">
</div>
</div>
<div class="form-group">
<label for="inputPassword3" class="col-sm-2 control-label">Password</label>
<div class="col-sm-10">
<input type="password" class="form-control" id="inputPassword3" placeholder="Password">
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<div class="checkbox">
<label>
<input type="checkbox"> Remember me
</label>
</div>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button type="submit" class="btn btn-default">Sign in</button>
</div>
</div>
</form>
17.æ§ä»¶
â a.ç¦ç¨ disabledå±æ§ååç使ç¨æ¹æ³ä¸æ ·ä½æ¯æä¸ä¸ªdisabledç±»ä»æ¯å è½½å¤å± div.ä¸é¢ç
â b.åªè¯» åªè¯»è¾å
¥æ¡ådisabledçæ ·å¼å·® ä¸å¤åªæ¯é¼ æ è¿æ¯åæ¬çç¶æ
â c.åªè¦ç»å
ç´ å ä¸btn btn-default 类就å¯ä»¥æä»»ä½æ ç¾åææé®(å¯ä½ä¸ºæé®ä½¿ç¨çæ ç¾æå
ç´ ä¸º ã æ å
ç´ æ·»å æé®ç±»ï¼button classï¼å³å¯ä½¿ç¨ Bootstrap æä¾çæ ·å¼ã)
<input class="form-control" id="disabledInput" type="text" placeholder="Disabled input here..." disabled>
<input class="form-control" type="text" placeholder="Readonly input hereâ¦" readonly>
<a class="btn btn-default" href="#" role="button">Link</a>
<button class="btn btn-default" type="submit">Button</button>
<input class="btn btn-default" type="button" value="Input">
<input class="btn btn-default" type="submit" value="Submit">
<p class="btn btn-default" type="submit">Button</p>
<div class="btn btn-default" type="submit">Button</div>
â d.æé®é¢å®ä¹ç±»
<button type="button" class="btn btn-default">ï¼é»è®¤æ ·å¼ï¼Default</button>
<button type="button" class="btn btn-primary">ï¼é¦é项ï¼Primary</button>
<button type="button" class="btn btn-success">ï¼æåï¼Success</button>
<button type="button" class="btn btn-info">ï¼ä¸è¬ä¿¡æ¯ï¼Info</button>
<button type="button" class="btn btn-warning">ï¼è¦åï¼Warning</button>
<button type="button" class="btn btn-danger">ï¼å±é©ï¼Danger</button>
<button type="button" class="btn btn-link">ï¼é¾æ¥ï¼Link</button>
â e.éè¿ç»æé®æ·»å .btn-block ç±»å¯ä»¥å°å ¶æ伸è³ç¶å ç´ 100%ç宽度ï¼èä¸æé®ä¹å为äºå级ï¼blockï¼å ç´ ã
<button type="button" class="btn btn-primary btn-lg btn-block">ï¼å级å
ç´ ï¼Block level button</button>
<button type="button" class="btn btn-default btn-lg btn-block">ï¼å级å
ç´ ï¼Block level button</button>
18.æ å¢è²
æ å¢èæ¯è² æ å¢ææ¬é¢è²
<div class="bs-example bs-example-bg-classes" data-example-id="contextual-backgrounds-helpers">
<p class="bg-primary">Nullam id dolor id nibh ultricies vehicula ut id elit.</p>
<p class="bg-success">Duis mollis, est non commodo luctus, nisi erat porttitor ligula.</p>
<p class="bg-info">Maecenas sed diam eget risus varius blandit sit amet non magna.</p>
<p class="bg-warning">Etiam porta sem malesuada magna mollis euismod.</p>
<p class="bg-danger">Donec ullamcorper nulla non metus auctor fringilla.</p>
<p class="text-primary">Nullam id dolor id nibh ultricies vehicula ut id elit.</p>
<p class="text-success">Duis mollis, est non commodo luctus, nisi erat porttitor ligula.</p>
<p class="text-info">Maecenas sed diam eget risus varius blandit sit amet non magna.</p>
<p class="text-warning">Etiam porta sem malesuada magna mollis euismod.</p>
<p class="text-danger">Donec ullamcorper nulla non metus auctor fringilla.</p>
</div>
19.å ³éæé®
é»è®¤å¨å³ä¸è§
<button type="button" class="close" aria-label="Close"><span aria-hidden="true">×</span></button>
20.ä¸è§ç¬¦å·
<span class="caret"></span>
21.æµ®å¨
â a.å¿«éæµ®å¨ èä¸å äº!important æç¡®äºçä¼å
级
â b.让å
容åå±
ä¸
â c.æ¸
é¤æµ®å¨
<div class="pull-left">左浮å¨</div>
<div class="pull-right">å³æµ®å¨</div>
<div class="center-block bg-danger" style="width: 200px;height: 200px; ">çå</div>
<div class="clearfix">éè¿ä¸ºç¶å
ç´ æ·»å .clearfix ç±»å¯ä»¥å¾å®¹æå°æ¸
é¤æµ®å¨ï¼floatï¼ãè¿éæ使ç¨çæ¯ Nicolas Gallagher åé ç micro clearfix æ¹å¼ãæ¤ç±»è¿å¯ä»¥ä½ä¸º mixin 使ç¨ã</div>
22.æ¾ç¤ºæéèå 容
<div class="show">...</div>
<div class="hidden">...</div>
注æç¹ï¼
a.è¿ä¸ªååºå¼å·¥å
·æ²¡æåä¸å
¼å®¹ååä¸è¦ççåè½ å 为å±å¹å®½å¸¦å¤ææ¶ å¤ææ¡ä»¶åæ»äº æ以å¿
须符åæ¡ä»¶æè½çæ
b.éè¿åç¬æèå使ç¨ä»¥ä¸ååºçç±»ï¼å¯ä»¥é对ä¸åå±å¹å°ºå¯¸éèææ¾ç¤ºé¡µé¢å
容ã
<div class="visible-xs">è¶
å°å±å¹æ¾ç¤º</div>
<div class="visible-sm">å°å±å¹æ¾ç¤º</div>
<div class="visible-md">ä¸å±å¹æ¾ç¤º</div>
<div class="visible-lg">大å±å¹æ¾ç¤º</div>
<div class="hidden-xs">è¶
å°å±å¹éè</div>
<div class="hidden-sm">å°å±å¹éè</div>
<div class="hidden-md">ä¸å±å¹éè</div>
<div class="hidden-lg">大å±å¹éè</div>
åä½å¾æ
设置font-family å°±å¯ä»¥è®©å¸¸è§çå符æ¾ç¤ºåºä¸åçå¾æ ç¢éå¾ è·åä½ä¸æ · å¯ä»¥æ¹åé¢è²å大å°
åä½å¾æ å
¶å®å°±æ¯æä¸äºç¢éå¾æå
æä¸ä¸ªåä½æ件 åæä¸ä¸ªåä½åº ç¶åæè¿äºç¼ç ç»å¯¹åºçç±»å
//css:
body {
font-family: wingdings;
font-size: 30px;
color: red;
}
//html:
wwwwasdczvaffvnv oq ï½ï½ï½ï½ï½ãããããã[][][]ããããããï½ï½ï½ï½ï½ï½ï½{}{}{}
1.å
å¼å
¥iconfont.css
2.ç´æ¥ä½¿ç¨ç±»
//å¼å
¥:
<link rel="stylesheet" type="text/css" href="font/iconfont.css"/>
//css:
span {
font-size: 50px;
}
/* åä½åºéé¢è®¾ç½®iconfontç±»æ¯ä¸ºäºç»å
ç´ æå®åä½åº
* é£ä¹ä¹å°±æ¯ä»¥ä¸ºçå¦ææ个å
ç´ éè¦å åä½å¾æ é£ä¹å°±å¿
é¡»å iconfontè¿ä¸ªç±»
* å°±å¾ä¸æ¹ä¾¿ */
span {
font-family: iconfont;
}
p {
font-family: wingdings;
}
/* å\e65cè¿ç§unicodeç ä¸è½ç´æ¥æ¾å¨æ ç¾éé¢
* ä¼æä»å½åå符串è¿è¡è§£æä¸ä¼æ¾ç¤ºå¯¹åºçå¾æ èä¸è¿ç§unicodeç åªè½æ¾å¨ä¸ºå
ç´ æè
伪类éé¢å»å*/
span:before {
content: "\e65c";
}
//html:
<span class="icon-wuliu">123</span>
<span class="icon-nv">456</span>
<span class="icon-yinsi">789</span>
<span>
132
</span>
<span class="glyphicon glyphicon-heart"></span>
<p>[]</p>
å±æ§éæ©å¨
[]表示å±æ§éæ©å¨
[å±æ§å]è¿é表示çæ¯ åªè¦å ç´ æè¿ä¸ªå±æ§é£ä¹å°±ä¼è¢«éä¸
//css:
[class] {
font-size: 30px;
}
/* 表示çæ¯å¯¹åºå±æ§åçå±æ§å¼ä»¥ä»ä¹å¼å¤´çå°±ä¼è¢«éä¸ */
[class^="li"] {
color: yellow;
}
[class^="zhang"] {
color: blue;
}
/* 表示çæ¯å¯¹åºå±æ§åçå±æ§å¼ä»¥ä»ä¹ç»å°¾çå°±ä¼è¢«éä¸ */
[class$="si"] {
font-weight: 900;
}
/* åªè¦éé¢å
å«å¯¹åºçå¼é£ä¹å°±ä¼è¢«éä¸ */
[class*="s"] {
background-color: green;
}
less
1.æ们åæ¬çcssæ ·å¼ç缺ç¹ï¼
a.å¤å±ççåéæ©å¨è¦åå¾å¤é
b.å¦æä¸é´æ个å
ç´ ä¸éè¦äºé£ä¹æ´ä½çå¸å±å°±ä¼ä¹±
c.ä¸ä¾¿äºç»´æ¤ å¦ææ个类åæè
idååçååé£ä¹ç»´æ¤èµ·æ¥å°±å¾é¾ .headeråætheader çµä¸åèå¨å
¨èº«
注ï¼css é¢å¤çå¨ å°±æ¯æcssä½ä¸ºç¼ç¨è¯è¨æ¥ç¼åå¯ä»¥å£°æåé ä¹å¯ä»¥åµå¥
2.lessç使ç¨ä¸ç¼è¯
a.ç´æ¥å¼å
¥lessæ¯æ²¡åæ³è®©æ ·å¼çæçå¿
须对 lessæ件è¿è¡ç¼è¯
b.æ¹æ³ä¸ æ¯å°å¯¹åºçlessæ件以åless.js对lessæ件è¿è¡ç¼è¯ç¼è¯æ对åºçcssæ件
注ï¼å¼å
¥lessæ件æ¶éè¦æ³¨æçæ¯æä¹ åre1å±æ§éé¢çstylesheetä¿®æ¹æstyJesheet/less
c.æ¹æ³äº ç´æ¥ 使ç¨vscodeéé¢çæ件åªè¦çæäºlessæ件æè
对lessæ件è¿è¡ä¿®æ¹ é£ä¹å°±ä¼åæ¥çæcssæ件
注ï¼ä½¿ç¨æ件æ1essç¼è¯æcssæ件ä¹å导å
¥åªéè¦å¯¼å
¥cssæ件å³å¯
//æ¹æ³ä¸
<link rel="stylesheet/less" href="demo.less"/>
<script src="js/less.min.js" ></script>
ç»ä»¶
1.ç»ä»¶ç»åèµ·æ¥çæ§ä»¶(è³å°å¾å
å«ä¸¤ä¸ªæ ç¾) å¯ä»¥å®ç°ä¸ä¸ªå
·ä½çåè½
2.为ä»ä¹è¦åºç°ç»ä»¶?
ä¹æ以ä¼åºç°ç»ä»¶æ¯å 为è¿äºç»æå¨å¾å¤çç½ç«ä¸é½æ使ç¨ï¼(éå¤ä½¿ç¨)ï¼é£ä¹æ们就æåå好 ç¶åéè¦ ä½¿ç¨çæ¶åæ ¹æ®èªå·±çéæ±æ¹ä¸ä¸
3.常ç¨çbootstrapç»ä»¶
a.ä¸æèå ä¸åäºselectæ ç¾ç
b. 导èªæ¡
c.表åç»
d.å页
f.åªä½å¯¹è±¡ï¼å¾æå表ï¼
4.ç»ä»¶ç使ç¨
导èªæ¡
<!-- 导èªæ¡çå¤§å®¹å¨ -->
<nav class="navbar navbar-default">
<!-- è¿éé»è®¤æ¯éºæ»¡å±å¹çå®¹å¨ å¦æéè¦å±
ä¸æ¾ç¤ºé£ä¹å°±æ¯æ¢æcontainer -->
<!--<div class="container-fluid">-->
<div class="container">
<!-- 导èªæ¡ç头é¨å¨ç§»å¨ç«¯æ¾ç¤ºçæ¶åæ¯ä¸ä¸ªæé® ä¼æä¹åå¨PC端æ¾ç¤ºçå
容é½æå -->
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<!-- è¿ä¸ªæé®æ¯ç¨æ¥åæ¢å¯¼èªæ¡ä¸»ä½é¨åçæ¾ç¤ºæè
æå ç -->
<!-- data-toggle æ¯ç¨æ¥æ§å¶æé®çæå åè½çç¸å½äº ç»æé®çåè½ååå§å -->
<!-- data- target åæ¶æ§å¶æçåæé®éé¢çå
容ç主 è¦å
³èçå
容çid -->
<!-- dataå¼å¤´çå±æ§é½æ¯ç¨æ¥ååè½ç -->
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
<!-- è¿ä¸ª sr-only æ¯ç»ç²æé
读å¨è¯å«ç-->
<span class="sr-only">Toggle navigation</span>
<!-- æé®ä¸é´çå 个横æ -->
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<!-- è¬æ们ä¼æ¾ç½ç«çlogo -->
<a class="navbar-brand" href="#">ç½ç«logo</a>
</div>
<!--导èªæ ç主ä½é¨åæ¯ææ导èªé¾æ¥ ä¹æ¯å¨ç§»å¨ç«¯æ¨ªå导èªéèä¹å å¨æé®ç¹å»å±å¼ä¹åæ¾ç¤ºçå
容 -->
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<!--左边çèåæ -->
<ul class="nav navbar-nav">
<li class="active"><a href="#">é¦é¡µ <span class="sr-only">(current)</span></a></li>
<li><a href="#">èµ·æ¥</a></li>
<!-- ä¸æèå -->
<!--<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Dropdown <span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="#">Action</a></li>
<li><a href="#">Another action</a></li>
<li><a href="#">Something else here</a></li>
<li role="separator" class="divider"></li>
<li><a href="#">Separated link</a></li>
<li role="separator" class="divider"></li>
<li><a href="#">One more separated link</a></li>
</ul>
</li>-->
</ul>
<!--æç´¢æ¡ -->
<form class="navbar-form navbar-left">
<div class="form-group">
<input type="text" class="form-control" placeholder="æ¥æ¾">
</div>
<button type="submit" class="btn btn-default">æç´¢</button>
</form>
<!-- å³è¾¹çèåæ -->
<ul class="nav navbar-nav navbar-right">
<li><a href="#">ç»é</a></li>
<!--ä¸æèå -->
<!--<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Dropdown <span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="#">Action</a></li>
<li><a href="#">Another action</a></li>
<li><a href="#">Something else here</a></li>
<li role="separator" class="divider"></li>
<li><a href="#">Separated link</a></li>
</ul>
</li>-->
</ul>
</div><!-- /.navbar-collapse -->
</div><!-- /.container-fluid -->
</nav>
æé®
<div class="dropdown container">
<button class="btn btn-default dropdown-toggle" type="button" id="dropdownMenu1" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
Dropdown
<span class="caret"></span>
</button>
<ul class="dropdown-menu" aria-labelledby="dropdownMenu1">
<li class="dropdown-header">èåå</li>
<li role="separator" class="divider"></li>
<li><a href="#">Action</a></li>
<li><a href="#">Another action</a></li>
<li class="disabled" ><a href="#">Something else here</a></li>
<li role="separator" class="divider"></li>
<li><a href="#">Separated link</a></li>
</ul>
</div>
è¾å ¥æ¡
<div class="input-group container">
<input type="text" class="form-control" aria-label="Amount (to the nearest dollar)">
<span class="input-group-addon">ç¾åº¦ä¸ä¸</span>
</div>
æ ç¾é¡µ
<ul class="nav nav-tabs container">
<li role="presentation" class="active"><a href="#">Home</a></li>
<li role="presentation"><a href="#">Profile</a></li>
<li role="presentation"><a href="#">Messages</a></li>
</ul>
å页
<nav aria-label="Page navigation">
<ul class="pagination">
<li>
<a href="#" aria-label="Previous">
<span aria-hidden="true">«</span>
</a>
</li>
<li><a href="#">1</a></li>
<li><a href="#">2</a></li>
<li><a href="#">3</a></li>
<li><a href="#">4</a></li>
<li><a href="#">5</a></li>
<li>
<a href="#" aria-label="Next">
<span aria-hidden="true">»</span>
</a>
</li>
</ul>
</nav>
bootstrapè½®æå¾
//css:
<link rel="stylesheet" type="text/css" href="bootstrap/css/bootstrap.min.css" />
//html:
<!-- è½®æå¾å¤é¨çå¤§å®¹å¨ -->
<div id="carousel-example-generic" class="carousel slide" data-ride="carousel">
<!-- è½®æå¾ä¸é¢çå°åç¹ -->
<ol class="carousel-indicators">
<!-- è¿éçæ¯ä¸ä¸ª11å
ç´ é½æ¯ä¸ä¸ªå°åç¹data-slide-to æ¯ å¯¹åºçéè¦åæ¢çè½®æå¾çç´¢å¼ -->
<li data-target="#carousel-example-generic" data-slide-to="0" class="active"></li>
<li data-target="#carousel-example-generic" data-slide-to="1" class=""></li>
<li data-target="#carousel-example-generic" data-slide-to="2" class=""></li>
</ol>
<!--è½®æå¾ææçå¾çè½®æ项-->
<div class="carousel-inner" role="listbox">
<!-- active表示é»è®¤æ¾ç¤ºé£ä¸å¼ -->
<!-- item表示æ¯ä¸å¼ è½®æå¾ -->
<div class="item active">
<img class="small-image visible-xs" src="images/slide_01_640x340.jpg" alt="...">
<!--<div class="carousel-caption">è½®æå¾çæ é¢</div>-->
</div>
<div class="item">
<img class="small-image visible-xs" src="images/slide_02_640x340.jpg" alt="...">
<!--<div class="carousel-caption">è½®æå¾çæ é¢</div>-->
</div>
<div class="item">
<img class="small-image visible-xs" src="images/slide_03_640x340.jpg" alt="...">
<!--<div class="carousel-caption">è½®æå¾çæ é¢</div>-->
</div>
<div class="item">
<img class="small-image visible-xs" src="images/slide_04_640x340.jpg" alt="...">
<!--<div class="carousel-caption">è½®æå¾çæ é¢</div>-->
</div>
</div>
<!-- ä¸ä¸é¡µä¸ä¸é¡µçæ§å¶æé® -->
<a class="left carousel-control" href="#carousel-example-generic" role="button" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a class="right carousel-control" href="#carousel-example-generic" role="button" data-slide="next">
<span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div>
//js:
<script src="js/jquery-1.12.4.min.js" type="text/javascript" charset="utf-8"></script>
<script src="bootstrap/js/bootstrap.min.js" type="text/javascript" charset="utf-8"></script>
ååºå¼è½®æå¾
//css:
<link rel="stylesheet" type="text/css" href="bootstrap/css/bootstrap.min.css" />
<style type="text/css">
.large-image {
width: 100%;
height: 410px;
/* å¾çä¸ç´å±
ä¸æ¾ç¤º */
background-position: center center;
}
.small-image {
width: 100%;
}
</style>
//html:
<!--
ååºå¼è½®æå¾çéæ±:
1.è¿ä¸ªè½®æå¾è¦å
¼å®¹PC端å移å¨ç«¯
ç¨ä¸¤å¼ å¾çè¿è¡åæ¢PC端 使ç¨å¤§å¾ç移å¨ç«¯ä½¿ç¨å°å¾ç
-->
<!-- è½®æå¾å¤é¨çå¤§å®¹å¨ -->
<div id="carousel-example-generic" class="carousel slide" data-ride="carousel">
<!-- è½®æå¾ä¸é¢çå°åç¹ -->
<ol class="carousel-indicators">
<li data-target="#carousel-example-generic" data-slide-to="0" class="active"></li>
<li data-target="#carousel-example-generic" data-slide-to="1" class=""></li>
<li data-target="#carousel-example-generic" data-slide-to="2" class=""></li>
<li data-target="#carousel-example-generic" data-slide-to="3" class=""></li>
</ol>
<!--è½®æå¾ææçå¾çè½®æ项-->
<div class="carousel-inner" role="listbox">
<!-- active表示é»è®¤æ¾ç¤ºé£ä¸å¼ -->
<!-- item表示æ¯ä¸å¼ è½®æå¾ -->
<div class="item active">
<div class="large-image hidden-xs" style="background-image: url(images/slide_01_2000x410.jpg);"></div>
<img class="small-image visible-xs" src="images/slide_01_640x340.jpg" alt="...">
<!--<div class="carousel-caption">è½®æå¾çæ é¢</div>-->
</div>
<div class="item">
<div class="large-image hidden-xs" style="background-image: url(images/slide_02_2000x410.jpg);"></div>
<img class="small-image visible-xs" src="images/slide_02_640x340.jpg" alt="...">
<!--<div class="carousel-caption">è½®æå¾çæ é¢</div>-->
</div>
<div class="item">
<div class="large-image hidden-xs" style="background-image: url(images/slide_03_2000x410.jpg);"></div>
<img class="small-image visible-xs" src="images/slide_03_640x340.jpg" alt="...">
<!--<div class="carousel-caption">è½®æå¾çæ é¢</div>-->
</div>
<div class="item">
<div class="large-image hidden-xs" style="background-image: url(images/slide_04_2000x410.jpg);"></div>
<img class="small-image visible-xs" src="images/slide_04_640x340.jpg" alt="...">
<!--<div class="carousel-caption">è½®æå¾çæ é¢</div>-->
</div>
</div>
<!-- ä¸ä¸é¡µä¸ä¸é¡µçæ§å¶æé® -->
<a class="left carousel-control" href="#carousel-example-generic" role="button" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a class="right carousel-control" href="#carousel-example-generic" role="button" data-slide="next">
<span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div>
//js:
<script src="js/jquery-1.12.4.min.js" type="text/javascript" charset="utf-8"></script>
<script src="bootstrap/js/bootstrap.min.js" type="text/javascript" charset="utf-8"></script>
tabæ åæ¢
//css:
<link rel="stylesheet" type="text/css" href="bootstrap/css/bootstrap.min.css" />
//html:
<div class="container">
<ul class="nav nav-tabs" role="tablist">
<!--
è¿éæ¯éè¿aæ ç¾çhrefæ¥åä¸é¢å
容ççåè¿è¡å
³èï¼éç¹å®ä½ï¼
åªæå½aæ ç¾çæ¶åï¼ä¹å°±æ¯è¯´å¿
é¡»è¦æhrefå±æ§ æå¯ä»¥ç¨hrefæ¥è¿è¡å
³è ï¼ å¦ææ¯å
¶ä»æ ç¾ é£ä¹å°±éè¦ä½¿ç¨data-targetæ¥è¿è¡å
³è
data-toggle="tab"对æ ç¾çåè½è¿è¡åå§å设置
-->
<li role="presentation" class="active"><a href="#home" aria-controls="home" role="tab" data-toggle="tab">é¦é¡µ</a></li>
<li role="presentation"><a data-target="#profile" aria-controls="profile" role="tab" data-toggle="tab">ç²¾å</a></li>
<li role="presentation"><a href="#messages" aria-controls="messages" role="tab" data-toggle="tab">è´ç©è½¦</a></li>
<li role="presentation"><a href="#settings" aria-controls="settings" role="tab" data-toggle="tab">æç</a></li>
</ul>
<!-- ä¸é¢tabæ 对åºçå
容 -->
<div class="tab-content">
<div role="tabpanel" class="tab-pane active" id="home">æå»</div>
<div role="tabpanel" class="tab-pane" id="profile">å§æ§½</div>
<div role="tabpanel" class="tab-pane" id="messages">ä½ ç
å¥</div>
<div role="tabpanel" class="tab-pane" id="settings">ç
ä½ åæ»´</div>
</div>
</div>
//js:
<script src="js/jquery-1.12.4.min.js" type="text/javascript" charset="utf-8"></script>
<script src="bootstrap/js/bootstrap.min.js" type="text/javascript" charset="utf-8"></script>
å·¥å ·æ示æ¡
//css:
<link rel="stylesheet" type="text/css" href="bootstrap/css/bootstrap.min.css" />
<style type="text/css">
button {
margin: 20px;
}
</style>
//html:
<div class="container">
<button type="button" class="btn btn-default" data-toggle="tooltip" data-placement="left" title="Tooltip on left">Tooltip on left</button>
<button type="button" class="btn btn-default" data-toggle="tooltip" data-placement="top" title="Tooltip on top">Tooltip on top</button>
<button type="button" class="btn btn-default" data-toggle="tooltip" data-placement="bottom" title="Tooltip on bottom">Tooltip on bottom</button>
<button type="button" class="btn btn-default" data-toggle="tooltip" data-placement="right" title="Tooltip on right">Tooltip on right</button>
</div>
//js:
<script src="js/jquery-1.12.4.min.js" type="text/javascript" charset="utf-8"></script>
<script src="bootstrap/js/bootstrap.min.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
$(function() {
//æå¨è°ç¨tooltipæ¹æ³ 对æé®è¿è¡åå§å
//è·åæ¥æå±æ§data-toggle并ä¸å±æ§å¼ä¸ºtooltipçå
ç´ è°ç¨tooltipæ¹æ³è¿è¡åå§å
$('[data-toggle="tooltip"]').tooltip();
})
</script>
模ææ¡
//css:
<link rel="stylesheet" type="text/css" href="bootstrap/css/bootstrap.min.css" />
//html:
<!-- è¿ç§æ¨¡ææ¡æ常ç¨ä¸è¬æ¯ç½ç«çç»å½æ³¨å -->
<!-- data-toggle 对äºå¼¹åºæ¡çidè¿è¡å
³è-->
<div class="container">
<button style="float: right;" type="button" class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal">ç»é</button>
</div>
<!-- 模ææ¡ç主ä½é¨å -->
<!-- æå¤å±è¿ä¸ªçåæ¯ä¸ä¸ªé®ç½©å± å 满æ´ä¸ªå±å¹ -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog" role="document">
<!-- 模ææ¡çå
容 -->
<div class="modal-content">
<!--模ææ¡çå¤´é¨ è¯´æä½ç¨-->
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title" id="myModalLabel">ç»éæ¡</h4>
</div>
<!--模ææ¡çå
容é¨å-->
<div class="modal-body">
<form class="form-horizontal">
<div class="form-group">
<label for="inputEmail3" class="col-sm-2 control-label">ç¨æ·å</label>
<div class="col-sm-10">
<input type="email" class="form-control" id="inputEmail3" placeholder="请è¾å
¥ç¨æ·å">
</div>
</div>
<div class="form-group">
<label for="inputPassword3" class="col-sm-2 control-label">å¯ç </label>
<div class="col-sm-10">
<input type="password" class="form-control" id="inputPassword3" placeholder="请è¾å
¥å¯ç ">
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<div class="checkbox">
<label>
<input type="checkbox">è®°ä½å¯ç
</label>
</div>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-3 col-sm-6">
<button type="submit" class="btn btn-danger btn-lg btn-block">ç»é</button>
</div>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">å
³é</button>
<button type="button" class="btn btn-primary" data-dismiss="modal">ä¿å</button>
</div>
</div>
</div>
</div>
//js:
<script src="js/jquery-1.12.4.min.js" type="text/javascript" charset="utf-8"></script>
<script src="bootstrap/js/bootstrap.min.js" type="text/javascript" charset="utf-8"></script>
bootstrap3ä¸bootstrap4çåºå«
ä¸åç¹:
1.å¼å
¥çæ件ä¸ä¸æ ·bootstrap4 å®å
¨èå¼äºIE8å¼å
¥jQueryç²¾ç®ç å¤å¼å
¥äºpopper.js
2.æ°å¢å¾å¤å®¹å¨æ¯å
³äºä¸åçå±å¹çå±
ä¸æ¾ç¤º container容å¨å®½åº¦åæäº1140px
3.æ
æ ¼ç³»ç»çååå¤ ååºäºä¸ä¸ªæ¡£
xs .col-* <576px
sm .col-sm-* >576px&&<768px
md .col-md-* >768px&&<992px
lg .col-lg-* >992px&&<1200px
xl .col-xl-* >1200px
æ°å¢äºä¸ä¸ªç±»col é»è®¤å¹³åå±å¹å®½åº¦(flex : 1)ä½æ¯hpicolç±»æ ä¸ä¸ªç¹ç¹ å°±æ¯ä¸ä¼æ¢è¡
å¦æéè¦æ¢è¡é£ä¹å°±æ¯ä½¿ç¨ä¸ä¸ª.W-100å ä¸ä¸ª é¢å¤çæ ç¾
4.æ§å¶å¨ä¸åå±å¹æ¾ç¤ºéèçç±»bootstrap3 hidden-sm visible -5mä»ä¸å
· å¤åä¸å
¼å®¹ååä¸è¦ççåè½
bootstrap4æ¾ç¤ºéèåæ äºd-sm-none d-sm-block èä¸ å®å
·æåä¸å
¼å®¹ååä¸å®¿ççåè½
5.å¼å
¥çæ件ä¸ä¸æ ·bootstrap4 å®å
¨èå¼äºIE8å¼å
¥jQueryç²¾ç®ç å¤å¼å
¥äºpopper.js
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/jquery.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js" integrity="sha384-OgVRvuATP1z7JjHLkuOU7Xw704+h835Lr+6QL9UvYjZE3Ipu6Tp75j7Bh/kR0JKI" crossorigin="anonymous"></script>
上一篇: AngularJs初体验
下一篇: 导出excel 转html 预览