<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Grid布局和scrollreveal使用demo</title>
<script src="https://unpkg.com/scrollreveal@4"></script>
<script>
ScrollReveal({ reset: true });
</script>
<link rel="stylesheet" />
<style>
:root {
--primary-color: rgb(233, 86, 62);
--text-color-darker: #333;
--text-color-normal: #666;
}
* {
margin: 0;
padding: 0;
}
body {
font-family: Helvetica, sans-serif, Arial;
}
.wrapper {
display: flex;
flex-direction: column;
align-items: center;
max-width: 1080px;
margin: 0 auto;
box-sizing: border-box;
padding: 80px 20px 20px;
}
.wrapper > h1 {
font-size: 18px;
color: var(--text-color-darker);
}
.wrapper > h1::after {
content: '';
display: block;
height: 4px;
background: var(--primary-color);
width: 80%;
margin: 20px auto;
}
.wrapper > h3 {
font-size: 16px;
color: var(--text-color-normal);
margin: 20px auto 40px;
}
.feature-list {
display: grid;
grid-template-columns: repeat(3, 1fr);
grid-template-rows: 120px 120px;
column-gap: 5vw;
row-gap: 20px;
}
.feature-item {
display: grid;
grid-template-columns: 60px 1fr;
grid-template-rows: 1fr 2fr;
grid-template-areas:
'icon title'
'icon content';
}
.feature-item > i {
grid-area: icon;
font-size: 28px;
color: var(--primary-color);
}
.feature-item > p {
line-height: 24px;
}
@media screen and (max-width: 786px) {
.feature-list {
grid-template-columns: repeat(2, 1fr);
}
.feature-item {
grid-template-columns: 40px 1fr;
}
}
</style>
</head>
<body>
<div style="height: 800px"></div>
<section class="wrapper">
<h1>Font Awesome字體圖標(biāo)</h1>
<h3>Font Awesome為您提供可縮放的矢量圖標(biāo),您可以使用CSS所提供的所有特性對它們進(jìn)行更改。</h3>
<div class="feature-list">
<div class="feature-item">
<i class="fa fa-flag"></i>
<h4 class="item-tit">一個(gè)字庫,675個(gè)圖標(biāo)</h4>
<p>僅一個(gè)Font Awesome字庫,就包含了與網(wǎng)頁相關(guān)的所有形象圖標(biāo)。</p>
</div>
<div class="feature-item">
<i class="fa fa-ban"></i>
<h4 class="item-tit">無需依賴JavaScript</h4>
<p>Font Awesome完全不依賴JavaScript,因此無需擔(dān)心兼容性。</p>
</div>
<div class="feature-item">
<i class="fa fa-arrows-alt"></i>
<h4 class="item-tit">無限縮放</h4>
<p>無論在任何尺寸下,可縮放的矢量圖形都會為您呈現(xiàn)出完美的圖標(biāo)。</p>
</div>
<div class="feature-item">
<i class="fa fa-microphone"></i>
<h4 class="item-tit">如言語一般自由</h4>
<p>Font Awesome完全免費(fèi),哪怕是商業(yè)用途。請查看許可。</p>
</div>
<div class="feature-item">
<i class="fa fa-pencil"></i>
<h4 class="item-tit">CSS控制</h4>
<p>Font Awesome的矢量圖標(biāo),將使您的網(wǎng)站在視網(wǎng)膜級的高分屏上大放異彩。</p>
</div>
<div class="feature-item">
<i class="fa fa-eye"></i>
<h4 class="item-tit">高分屏完美呈現(xiàn)</h4>
<p>Font Awesome的矢量圖標(biāo),將使您的網(wǎng)站在視網(wǎng)膜級的高分屏上大放異彩。</p>
</div>
</div>
</section>
<section class="wrapper">
<h1>疫情速報(bào)</h1>
<h3>記者從西寧市新冠肺炎疫情防控處置工作指揮部獲悉,10月28日0時(shí)20分,西寧市新增3名新冠肺炎病毒核酸檢測陽性人員</h3>
</section>
<script>
// 單個(gè)項(xiàng)的動(dòng)畫持續(xù)時(shí)間2s,從下往上,間隔400ms
ScrollReveal().reveal('.feature-item', { distance: '48px', duration: 2000, interval: 400 });
</script>
</body>
</html>

grid-layout.gif