練習(xí)一:
php中文網(wǎng)public_footer組件:
1、html代碼:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="public_footer.css">
<title>Title</title>
</head>
<body>
<div class="public-footer">
<div class="nav">
<a href=""><span>鏈接1</span></a>
<a href=""><span>鏈接2</span></a>
<a href=""><span>鏈接3</span></a>
<a href=""><span>鏈接4</span></a>
<a href=""><span>鏈接5</span></a>
<a href=""><span>鏈接6</span></a>
<a href=""><span>鏈接7</span></a>
</div>
<div class="logo">
<a href=""><img src="../../../images/logo.png" alt=""></a>
</div>
<div class="info">
<p>2019 fengniao.com. All rights reserved . 安徽鬧著玩(無聊網(wǎng))版權(quán)所有</p>
<p>皖I(lǐng)CP證150110號(hào) 京ICP備14323013號(hào)-2 皖公網(wǎng)安備110108024357788號(hào)</p>
<p>違法和不良信息舉報(bào)電話: 0551-1234567 舉報(bào)郵箱: admin@baidu.com</p>
</div>
<div>
<p>關(guān)注公眾號(hào)</p>
<img src="../../../static/images/erwei-code.png" alt="">
</div>
</div>
</body>
</html>
2、css代碼:
@import url(../../public_reset.css);
.public-footer {
min-width: 800px;
max-width: 1200px;
height: 200px;
margin: 0 auto;
outline:1px dashed red;
color:#ffffff;
background-color: #404040;
display: grid;
grid-template-columns: 1.5fr 4.5fr 4fr;
grid-tempalte-rows: 2fr 8fr;
}
.public-footer > .nav {
grid-column:1/3;
margin-left: 30px;
align-self: center;
}
.public-footer > .nav > a {
margin-left:20px ;
color:#ffffff;
}
.public-footer > .logo {
grid-row:2/3;
margin-top: 21px;
/*align-self: end;*/
justify-self: end;
}
.public-footer > .logo img {
width: 140px;
height: 60px;
}
.public-footer > .info {
grid-column: 2/3;
grid-row:2/3;
justify-self: center;
}
.public-footer > .info > p {
margin-top: 15px;
}
.public-footer > :last-child {
grid-column: 3/4;
grid-row:1/3;
align-self: center;
margin-left: 20px;
}
.public-footer > :last-child > p {
margin-left: 24px;
}
.public-footer > :last-child > img {
width: 120px;
margin-top: 10px;
}
3、效果圖:在火狐瀏覽器中打開網(wǎng)格線
總結(jié):
1、補(bǔ)充網(wǎng)格線定位練習(xí);從1開始,整數(shù)遞增,反向 從-1開始 負(fù)數(shù)遞減
(1)劃網(wǎng)格線:grid-template-columns/rows:
屬性值:px; fr; 函數(shù):repeat(1,1fr)——(1:重復(fù)次數(shù),重復(fù)內(nèi)容),minmax(100px,150px)伸縮空間
(2)網(wǎng)格線定位:grid-row/column-strat/end:1;
簡(jiǎn)寫:grid-row/column: start/end ; (start網(wǎng)格定位起點(diǎn)線-end定位終止線)
2、網(wǎng)格中單元格對(duì)齊方法:是否旨在有空隙的時(shí)候有作用?
3、單元格內(nèi)容對(duì)其:grid容器屬性和項(xiàng)目屬性易混淆:
容器屬性:
(1)align/justify(水平垂直)-items/content(內(nèi)容、單元格):
屬性值:start center end;
(2)簡(jiǎn)寫:place-items/content(內(nèi)容/單元格):align justify;
項(xiàng)目屬性:align/justify-self:
屬性值:start center end :
4、網(wǎng)格間隙很少用:
(1)grid-column/row-gap: 屬性值:px;
(2) 簡(jiǎn)寫grid-gap: row column /gap
微信掃碼
關(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)