Bootstrap4+MySQL前后端综合实训-Day01-PM【position定位的四种方式、Flex布局语法教程及案例(概念、容器属性、项目属性)、双飞翼布局复习、Bootstrap4 教程】
【Bootstrap4前端框架+MySQL數(shù)據(jù)庫(kù)】前后端綜合實(shí)訓(xùn)【10天課程 博客匯總表 詳細(xì)筆記】
目 ? 錄
HTML中的三種元素(塊元素、內(nèi)聯(lián)元素、內(nèi)聯(lián)塊元素)
position定位的四種方式
固定導(dǎo)航在頂部:固定定位 --> position: fixed;
案例——粘性定位 position: sticky; top: 0px;
Flex 布局語(yǔ)法教程
一、Flex布局是什么?
二、基本概念
三、容器的屬性
3.1 flex-direction屬性
3.2 flex-wrap屬性
3.3 flex-flow
3.4 justify-content屬性
3.5 align-items屬性
3.6 align-content屬性
四、項(xiàng)目的屬性
4.1 order屬性
4.2 flex-grow屬性
4.3 flex-shrink屬性
4.4 flex-basis屬性
4.5 flex屬性
4.6 align-self屬性
flex布局案例
flex-direction、flex-wrap、justify-content、align-items、align-content屬性
flex屬性綜合舉例
雙飛翼布局復(fù)習(xí)
前端技術(shù)
Bootstrap4?教程
HTML中的三種元素(塊元素、內(nèi)聯(lián)元素、內(nèi)聯(lián)塊元素)
HTML中的三種元素
display:
換行、table、空格:在HTML中會(huì)自動(dòng)轉(zhuǎn)換為空格。
position定位的四種方式
固定導(dǎo)航在頂部:固定定位 --> position: fixed;
案例——粘性定位 position: sticky; top: 0px;
<!DOCTYPE html> <html><head><meta charset="utf-8"><title></title><style type="text/css">body {margin: 0px;}nav {width: 100%;height: 40px;background-color: #5F9EA0;/* text-align: center;line-height: 40px; */position: sticky;top: 0px;display: flex; /*去掉a標(biāo)簽間的空格*/justify-content: center; /*去掉a標(biāo)簽間的空格*/}nav>a {display: inline-block;background-color: #b6c85b;width: 100px;display: flex;justify-content: center;align-items: center;border: 1px white solid;}nav>a:hover {background-color: #808080;}</style></head><body><h1>我是標(biāo)題</h1><nav><a href="https//www.baidu.com">百度</a><a href="https//www.baidu.com">京東</a><a href="https//www.baidu.com">淘寶</a><a href="https//www.baidu.com">騰訊</a><a href="https//www.baidu.com">拼多多</a></nav><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /></body> </html>Flex 布局語(yǔ)法教程
網(wǎng)頁(yè)布局(layout)是CSS的一個(gè)重點(diǎn)應(yīng)用。
布局的傳統(tǒng)解決方案,基于盒狀模型,依賴 display屬性 + position屬性 + float屬性。它對(duì)于那些特殊布局非常不方便,比如,垂直居中就不容易實(shí)現(xiàn)。
2009年,W3C提出了一種新的方案—-Flex布局,可以簡(jiǎn)便、完整、響應(yīng)式地實(shí)現(xiàn)各種頁(yè)面布局。目前,它已經(jīng)得到了所有瀏覽器的支持,這意味著,現(xiàn)在就能很安全地使用這項(xiàng)功能。
Flex布局已經(jīng)成為布局的首選方案。本文介紹Flex布局的語(yǔ)法。
一、Flex布局是什么?
二、基本概念
采用Flex布局的元素,稱為Flex容器(flex container),簡(jiǎn)稱”容器”。它的所有子元素自動(dòng)成為容器成員,稱為Flex項(xiàng)目(flex item),簡(jiǎn)稱”項(xiàng)目”。
容器存在兩根軸:默認(rèn)情況下水平方向?yàn)橹鬏S(main axis);垂直方向?yàn)榻徊孑S(cross axis)。主軸的開(kāi)始位置(與邊框的交叉點(diǎn))叫做main start(flex-start),結(jié)束位置叫做main end(flex-end);交叉軸的開(kāi)始位置叫做cross start(flex-start),結(jié)束位置叫做cross end(flex-end)。
項(xiàng)目永遠(yuǎn)按照沿主軸排列。單個(gè)項(xiàng)目占據(jù)的主軸空間叫做main size,占據(jù)的交叉軸空間叫做cross size。
三、容器的屬性
以下6個(gè)屬性設(shè)置在容器上,以下六個(gè)屬性必須配合display:flex / display:inline-flex。
3.1 flex-direction屬性
flex-direction屬性決定主軸的方向(即項(xiàng)目的排列方向),默認(rèn)從左到右排列(主軸方向默認(rèn)為row)。
.box {flex-direction: row | row-reverse | column | column-reverse; }它可能有4個(gè)值。
3.2 flex-wrap屬性
默認(rèn)情況下,項(xiàng)目都排在一條線(又稱”軸線”)上。flex-wrap屬性定義,如果一條軸線排不下,如何換行。
.box{flex-wrap: nowrap | wrap | wrap-reverse; }它可能取三個(gè)值。
(1)nowrap(默認(rèn)):不換行。
(2)wrap:換行,第一行在上方。
(3)wrap-reverse:換行,第一行在下方。
3.3 flex-flow
flex-flow屬性是flex-direction屬性和flex-wrap屬性的簡(jiǎn)寫(xiě)形式,默認(rèn)值為row nowrap。
.box {flex-flow: <flex-direction> <flex-wrap>; }3.4 justify-content屬性
justify-content屬性定義了項(xiàng)目在主軸上的對(duì)齊方式。
.box {justify-content: flex-start | flex-end | center | space-between | space-around; }它可能取5個(gè)值,具體對(duì)齊方式與軸的方向有關(guān)。下面假設(shè)主軸為從左到右。
3.5 align-items屬性
align-items屬性定義項(xiàng)目在交叉軸上如何對(duì)齊。(交叉軸)
.box {align-items: flex-start | flex-end | center | baseline | stretch; }它可能取5個(gè)值。具體的對(duì)齊方式與交叉軸的方向有關(guān),下面假設(shè)交叉軸從上到下。
3.6 align-content屬性
align-content屬性定義了多根軸線的對(duì)齊方式。如果項(xiàng)目只有一根軸線,該屬性不起作用。(多軸使用情況:多軸-->單軸)
.box {align-content: flex-start | flex-end | center | space-between | space-around | stretch; }該屬性可能取6個(gè)值。
四、項(xiàng)目的屬性
以下6個(gè)屬性設(shè)置在項(xiàng)目(子元素)上。
4.1 order屬性
order屬性定義項(xiàng)目的排列順序。數(shù)值越小,排列越靠前,默認(rèn)為0。
.item {order: <integer>; }4.2 flex-grow屬性
flex-grow屬性定義項(xiàng)目的放大比例,默認(rèn)為0,即如果存在剩余空間,也不放大。(按比例占據(jù)剩余空間!)
.item {flex-grow: <number>; /* default 0 */ }如果所有項(xiàng)目的flex-grow屬性都為1,則它們將等分剩余空間(如果有的話)。如果一個(gè)項(xiàng)目的flex-grow屬性為2,其他項(xiàng)目都為1,則前者占據(jù)的剩余空間將比其他項(xiàng)多一倍。
4.3 flex-shrink屬性
flex-shrink屬性定義了項(xiàng)目的縮小比例,默認(rèn)為1(不壓縮),即如果空間不足,該項(xiàng)目將縮小。
.item {flex-shrink: <number>; /* default 1 */ }如果所有項(xiàng)目的flex-shrink屬性都為1,當(dāng)空間不足時(shí),都將等比例縮小。如果一個(gè)項(xiàng)目的flex-shrink屬性為0,其他項(xiàng)目都為1,則空間不足時(shí),前者不縮小。
負(fù)值對(duì)該屬性無(wú)效。
4.4 flex-basis屬性
flex-basis屬性定義了在分配多余空間之前,項(xiàng)目占據(jù)的主軸空間(main size)。瀏覽器根據(jù)這個(gè)屬性,計(jì)算主軸是否有多余空間。它的默認(rèn)值為auto,即項(xiàng)目的本來(lái)大小。
.item {flex-basis: <length> | auto; /* default auto */ }它可以設(shè)為跟width或height屬性一樣的值(比如350px),則項(xiàng)目將占據(jù)固定空間。
4.5 flex屬性
flex屬性是flex-grow, flex-shrink 和 flex-basis的簡(jiǎn)寫(xiě),默認(rèn)值為0 1 auto。后兩個(gè)屬性可選。
.item {flex: none | [ <'flex-grow'> <'flex-shrink'>? || <'flex-basis'> ] }該屬性有兩個(gè)快捷值:auto (1 1 auto) 和 none (0 0 auto)。
建議優(yōu)先使用這個(gè)屬性,而不是單獨(dú)寫(xiě)三個(gè)分離的屬性,因?yàn)闉g覽器會(huì)推算相關(guān)值。
4.6 align-self屬性
align-self屬性允許單個(gè)項(xiàng)目有與其他項(xiàng)目不一樣的對(duì)齊方式,可覆蓋align-items屬性。默認(rèn)值為auto,表示繼承父元素的align-items屬性,如果沒(méi)有父元素,則等同于stretch。(設(shè)置元素在交叉軸上的對(duì)齊方式!)
.item {align-self: auto | flex-start | flex-end | center | baseline | stretch; }該屬性可能取6個(gè)值,除了auto,其他都與align-items屬性完全一致。
flex布局案例
flex-direction、flex-wrap、justify-content、align-items、align-content屬性
<!DOCTYPE html> <html><head><meta charset="utf-8"><title></title><style type="text/css">body {margin: 0px;}.parent {height: 200px;background-color: #5F9EA0;display: flex;flex-direction: row;flex-wrap: wrap;justify-content: flex-start;/* align-items: center; */align-content: flex-end;}.children {height: 40px;width: 40px;border-radius: 50%;background-color: red;margin: 10px;text-align: center;line-height: 40px;}</style></head><body><div class="parent"><div class="children">1</div><div class="children">2</div><div class="children">3</div><div class="children">4</div><div class="children">5</div><div class="children">6</div><div class="children">7</div><div class="children">1</div><div class="children">2</div><div class="children">3</div><div class="children">4</div><div class="children">5</div><div class="children">6</div><div class="children">7</div><div class="children">1</div><div class="children">2</div><div class="children">3</div><div class="children">4</div><div class="children">5</div><div class="children">6</div><div class="children">7</div></div></body> </html>flex屬性綜合舉例
<!DOCTYPE html> <html><head><meta charset="utf-8"><title></title><style type="text/css">body {margin: 0px;}.parent {height: 200px;background-color: #5F9EA0;display: flex;flex-direction: row;/* flex-wrap: wrap; */justify-content: flex-start;/* align-items: center; *//* align-content: flex-end; *//* border: 3px red solid; */border-width: 3px;border-color: red;border-style: solid;}.children {height: 40px;width: 60px;border-radius: 50%;background-color: red;margin: 10px;text-align: center;line-height: 40px;flex-shrink: 0;}</style></head><body><div class="parent"><div class="children">1</div><div class="children" style="flex-grow: 1;">2</div><div class="children" style="flex-grow: 1;">3</div><div class="children" style="order: -1;">4</div><div class="children" style="flex-grow: 2;">5</div><div class="children">6</div><div class="children" style="order: -2;">7</div><div class="children">6</div><div class="children">6</div><div class="children" style="align-self: center;">10</div><div class="children">6</div><div class="children" style="flex-shrink: 1;">6</div><div class="children" style="flex-shrink: 2;">7</div></div></body> </html>雙飛翼布局復(fù)習(xí)
<!DOCTYPE html> <html><head><meta charset="utf-8"><title></title><style type="text/css">body {background-color: antiquewhite;margin: 0px;border: 1px red solid;min-height: 100vh;/*W3C盒子與IE盒子*/box-sizing: border-box;display: flex;flex-direction: column;}header,footer {height: 100px;background-color: #5F9EA0;}#main {flex-grow: 1;display: flex;align-items: stretch;}#left,#right {width: 100px;background-color: burlywood;flex-shrink: 0;}#content {flex-grow: 1;}</style></head><body><!--body默認(rèn)的高度為內(nèi)容高度,body的高度為視窗(瀏覽器窗口)的高度--><header>頭部</header><div id="main"><div id="left">左側(cè)</div><div id="content">【環(huán)球網(wǎng)快訊】接近美東時(shí)間16日凌晨0時(shí),美國(guó)現(xiàn)任總統(tǒng)特朗普發(fā)推稱“我贏了大選”。【環(huán)球網(wǎng)快訊】接近美東時(shí)間16日凌晨0時(shí),美國(guó)現(xiàn)任總統(tǒng)特朗普發(fā)推稱“我贏了大選”。【環(huán)球網(wǎng)快訊】接近美東時(shí)間16日凌晨0時(shí),美國(guó)現(xiàn)任總統(tǒng)特朗普發(fā)推稱“我贏了大選”。【環(huán)球網(wǎng)快訊】接近美東時(shí)間16日凌晨0時(shí),美國(guó)現(xiàn)任總統(tǒng)特朗普發(fā)推稱“我贏了大選”。【環(huán)球網(wǎng)快訊】接近美東時(shí)間16日凌晨0時(shí),美國(guó)現(xiàn)任總統(tǒng)特朗普發(fā)推稱“我贏了大選”。【環(huán)球網(wǎng)快訊】接近美東時(shí)間16日凌晨0時(shí),美國(guó)現(xiàn)任總統(tǒng)特朗普發(fā)推稱“我贏了大選”。【環(huán)球網(wǎng)快訊】接近美東時(shí)間16日凌晨0時(shí),美國(guó)現(xiàn)任總統(tǒng)特朗普發(fā)推稱“我贏了大選”。【環(huán)球網(wǎng)快訊】接近美東時(shí)間16日凌晨0時(shí),美國(guó)現(xiàn)任總統(tǒng)特朗普發(fā)推稱“我贏了大選”。【環(huán)球網(wǎng)快訊】接近美東時(shí)間16日凌晨0時(shí),美國(guó)現(xiàn)任總統(tǒng)特朗普發(fā)推稱“我贏了大選”。【環(huán)球網(wǎng)快訊】接近美東時(shí)間16日凌晨0時(shí),美國(guó)現(xiàn)任總統(tǒng)特朗普發(fā)推稱“我贏了大選”。【環(huán)球網(wǎng)快訊】接近美東時(shí)間16日凌晨0時(shí),美國(guó)現(xiàn)任總統(tǒng)特朗普發(fā)推稱“我贏了大選”。【環(huán)球網(wǎng)快訊】接近美東時(shí)間16日凌晨0時(shí),美國(guó)現(xiàn)任總統(tǒng)特朗普發(fā)推稱“我贏了大選”。【環(huán)球網(wǎng)快訊】接近美東時(shí)間16日凌晨0時(shí),美國(guó)現(xiàn)任總統(tǒng)特朗普發(fā)推稱“我贏了大選”。【環(huán)球網(wǎng)快訊】接近美東時(shí)間16日凌晨0時(shí),美國(guó)現(xiàn)任總統(tǒng)特朗普發(fā)推稱“我贏了大選”。【環(huán)球網(wǎng)快訊】接近美東時(shí)間16日凌晨0時(shí),美國(guó)現(xiàn)任總統(tǒng)特朗普發(fā)推稱“我贏了大選”。【環(huán)球網(wǎng)快訊】接近美東時(shí)間16日凌晨0時(shí),美國(guó)現(xiàn)任總統(tǒng)特朗普發(fā)推稱“我贏了大選”。【環(huán)球網(wǎng)快訊】接近美東時(shí)間16日凌晨0時(shí),美國(guó)現(xiàn)任總統(tǒng)特朗普發(fā)推稱“我贏了大選”。【環(huán)球網(wǎng)快訊】接近美東時(shí)間16日凌晨0時(shí),美國(guó)現(xiàn)任總統(tǒng)特朗普發(fā)推稱“我贏了大選”。【環(huán)球網(wǎng)快訊】接近美東時(shí)間16日凌晨0時(shí),美國(guó)現(xiàn)任總統(tǒng)特朗普發(fā)推稱“我贏了大選”。【環(huán)球網(wǎng)快訊】接近美東時(shí)間16日凌晨0時(shí),美國(guó)現(xiàn)任總統(tǒng)特朗普發(fā)推稱“我贏了大選”。【環(huán)球網(wǎng)快訊】接近美東時(shí)間16日凌晨0時(shí),美國(guó)現(xiàn)任總統(tǒng)特朗普發(fā)推稱“我贏了大選”。【環(huán)球網(wǎng)快訊】接近美東時(shí)間16日凌晨0時(shí),美國(guó)現(xiàn)任總統(tǒng)特朗普發(fā)推稱“我贏了大選”。【環(huán)球網(wǎng)快訊】接近美東時(shí)間16日凌晨0時(shí),美國(guó)現(xiàn)任總統(tǒng)特朗普發(fā)推稱“我贏了大選”。【環(huán)球網(wǎng)快訊】接近美東時(shí)間16日凌晨0時(shí),美國(guó)現(xiàn)任總統(tǒng)特朗普發(fā)推稱“我贏了大選”。【環(huán)球網(wǎng)快訊】接近美東時(shí)間16日凌晨0時(shí),美國(guó)現(xiàn)任總統(tǒng)特朗普發(fā)推稱“我贏了大選”。【環(huán)球網(wǎng)快訊】接近美東時(shí)間16日凌晨0時(shí),美國(guó)現(xiàn)任總統(tǒng)特朗普發(fā)推稱“我贏了大選”。【環(huán)球網(wǎng)快訊】接近美東時(shí)間16日凌晨0時(shí),美國(guó)現(xiàn)任總統(tǒng)特朗普發(fā)推稱“我贏了大選”。【環(huán)球網(wǎng)快訊】接近美東時(shí)間16日凌晨0時(shí),美國(guó)現(xiàn)任總統(tǒng)特朗普發(fā)推稱“我贏了大選”。【環(huán)球網(wǎng)快訊】接近美東時(shí)間16日凌晨0時(shí),美國(guó)現(xiàn)任總統(tǒng)特朗普發(fā)推稱“我贏了大選”。【環(huán)球網(wǎng)快訊】接近美東時(shí)間16日凌晨0時(shí),美國(guó)現(xiàn)任總統(tǒng)特朗普發(fā)推稱“我贏了大選”。</div><div id="right">右側(cè)</div></div><footer>底部</footer></body> </html>前端技術(shù)
Bootstrap4?教程
- Bootstrap4——菜鳥(niǎo)教程(非常詳細(xì)!!!)
- Bootstrap4——中文網(wǎng)
- Bootstrap4——GitHub
Bootstrap4:聯(lián)網(wǎng)引用方式,網(wǎng)絡(luò)加載!語(yǔ)法匯總提示庫(kù)!
<!DOCTYPE html> <html><head><meta charset="utf-8"><title></title><!-- 新 Bootstrap4 核心 CSS 文件 --><link rel="stylesheet" href="bootstrap4/css/bootstrap.min.css"><!-- jQuery文件。務(wù)必在bootstrap.min.js 之前引入 --><script src="jquery/jquery.min.js"></script><!-- bootstrap.bundle.min.js 用于彈窗、提示、下拉菜單,包含了 popper.min.js --><script src="js/popper.min.js"></script><!-- 最新的 Bootstrap4 核心 JavaScript 文件 --><script src="bootstrap4/js/bootstrap.min.js"></script><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><body><div class="container"><h1 class="text-success">我是標(biāo)題</h1><h1 class="text-danger">我是標(biāo)題</h1><h1 class="text-primary">我是標(biāo)題</h1><h1 class="text-info">我是標(biāo)題</h1></div><hr><table class="table table-bordered table-striped table-hover"><thead><tr><th>學(xué)號(hào)</th><th>姓名</th><th>年齡</th><th>性別</th></tr></thead><tbody><tr><td>101</td><td>張三</td><td>20</td><td>男</td></tr><tr><td>101</td><td>張三</td><td>20</td><td>男</td></tr><tr><td>101</td><td>張三</td><td>20</td><td>男</td></tr><tr><td>101</td><td>張三</td><td>20</td><td>男</td></tr><tr><td>101</td><td>張三</td><td>20</td><td>男</td></tr></tbody></table></body> </html>底層基礎(chǔ)決定上層建筑,加油加油~
與50位技術(shù)專家面對(duì)面20年技術(shù)見(jiàn)證,附贈(zèng)技術(shù)全景圖總結(jié)
以上是生活随笔為你收集整理的Bootstrap4+MySQL前后端综合实训-Day01-PM【position定位的四种方式、Flex布局语法教程及案例(概念、容器属性、项目属性)、双飞翼布局复习、Bootstrap4 教程】的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: Bootstrap4+MySQL前后端综
- 下一篇: 【Bootstrap4前端框架+MySQ