
批改狀態(tài):合格
老師批語(yǔ):寫(xiě)得不錯(cuò), 特別是配的圖, 非常直觀(guān)
flex-basis:auto;
默認(rèn)值,在子元素css
中定義的類(lèi)似width:100px;
這個(gè)寬度;flex-basis:80px;
自定義的值,可以取代width:100px;
中定義的寬度;flex-basis:20%;
當(dāng)寬度定義為百分比的時(shí)候,這個(gè)百分比是相對(duì)父元素比較的,比如父元素width:100px;
那么這個(gè)子元素的寬度就是20px
;flex-basis
的優(yōu)先級(jí)大于width
,并且可以用min-width
設(shè)定子元素的最小寬度;flex-grow:數(shù)值
可以設(shè)定子元素所分配父元素剩余空間的比例,這個(gè)數(shù)值可以是整數(shù),也可以是百分比;flex-shrink:數(shù)值
可以設(shè)定子元素收縮比例,這個(gè)數(shù)值可以是整數(shù)也可以是百分比,0是不收縮;flex: flex-grow flex-shrink flex-basis
上三種設(shè)置的簡(jiǎn)寫(xiě)flex-grow
是控制要不要 擴(kuò)展,分不分配父元素剩余空間;flex-shrink
控制子元素在父元素空間不足的時(shí)候 要不是收縮;flex-basis
設(shè)定子元素的寬度;align-self:
設(shè)置單獨(dú)子元素在父元素交叉軸的對(duì)齊方式,如圖;order:數(shù)字
是設(shè)定子元素排序的位置,默認(rèn)是先寫(xiě)在前,order
數(shù)值越小越靠前,如圖;puplic_header.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>公共頭部</title>
<link rel="stylesheet" href="../../../static/font/iconfont.css">
<link rel="stylesheet" href="public_header.css">
</head>
<body>
<div class="public-header">
<a href="">網(wǎng)站首頁(yè)</a>
<a href="">二手交易</a>
<a href="">房屋出租</a>
<a href="">兼職招聘</a>
<a href="">網(wǎng)站導(dǎo)航</a>
<span>
<a href=""><i class="iconfont icon-huiyuan2"></i>登錄</a>
<a href="">免費(fèi)注冊(cè)</a>
</span>
</div>
</body>
</html>
public_reset.css
部分
*{
margin: 0;
padding: 0;
}
body{
font-size: 13px;
color: #555555;
background-color: #efefef;
}
a{
text-decoration: none;
color: #404040;
font-size: 13px;
}
li{
list-style: none;
}
public_header.css
部分
@import "../public_reset.css";
/*公共頭部導(dǎo)航*/
.public-header {
height: 44px;
background-color: #000000;
padding: 0 20px;
display: flex;
flex-flow: row nowrap;
}
.public-header a {
line-height: 44px;
color: #cccccc;
padding: 0 10px;
}
.public-header > a:hover{
color: #000000;
background-color: #ffffff;
}
.public-header > span {
margin-left: auto;
}
.public-header > span i {
font-size: 16px;
color: #cccccc;
padding-right: 10px;
}
public_headline.html
文件
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="public_headline.css">
<title>公共大標(biāo)題</title>
</head>
<body>
<div class="public-headline">
<span>二手交易</span>
</div>
</body>
</html>
public_headline.css
文件
@import "../public_reset.css";
.public-headline {
padding: 30px;
text-align: center;
}
.public-headline > span{
font-size: 30px;
font-weight: bold;
padding-bottom: 10px;
border-bottom: 2px solid red;
}
微信掃碼
關(guān)注PHP中文網(wǎng)服務(wù)號(hào)
QQ掃碼
加入技術(shù)交流群
Copyright 2014-2025 http://ipnx.cn/ All Rights Reserved | php.cn | 湘ICP備2023035733號(hào)