HTML5和CSS3扁平化风格博客
效果:
代码:
html结果
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta charset="utf-8" />
<link rel="stylesheet" type="text/css" href="https://necolas.github.io/normalize.css/3.0.2/normalize.css">
<link rel="stylesheet" type="text/css" href="main.css">
</head>
<body>
<div class="main-wrapper">
<!-- 页头 S -->
<header>
<nav>
<div class="logo"><a href="">素颜猪</a></div>
<ul>
<li><a href="">首页</a></li>
<li><a href="">图书</a></li>
<li><a href="">相册</a></li>
<li><a href="">视频</a></li>
<li><a href="">音乐</a></li>
</ul>
</nav>
<div id="banner">
<div class="inner">
<h2>素颜猪</h2>
<p>
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
</p>
<button>了解我</button>
<div class="more">
更多
</div>
</div>
</div>
</header>
<!-- 页头 E -->
<!-- 内容 S -->
<div class="content">
<section class="green-section">
<div class="wrapper">
<h3>标题</h3>
<div class="hr"></div>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
</div>
<div class="icon-group">
<span class="icon">item1</span>
<span class="icon">item2</span>
<span class="icon">item3</span>
</div>
</section>
<section class="gray-section">
<div class="article-preview">
<div class="img-section">
<img src="imgs/fj1.jpg">
</div>
<div class="text-section">
<h3>标题</h3>
<div class="sub-heading">副标题</div>
<p>Lorem roident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
</div>
</div>
<div class="article-preview">
<div class="text-section">
<h3>标题</h3>
<div class="sub-heading">副标题</div>
<p>Lorem roident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
</div>
<div class="img-section">
<img src="imgs/fj2.jpg">
</div>
</div>
<div class="article-preview">
<div class="img-section">
<img src="imgs/fj3.jpg">
</div>
<div class="text-section">
<h3>标题</h3>
<div class="sub-heading">副标题</div>
<p>Lorem roident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
</div>
</div>
</section>
<section class="purple-section">
<div class="wrapper">
<div class="heading-wrapper">
<h3>标题</h3>
<div class="hr"></div>
<div class="sub-heading">
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
</div>
</div>
<div class="card-group clearfix">
<div class="card">
<h4>标题</h4>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
</div>
<div class="card">
<h4>标题</h4>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
</div>
<div class="card">
<h4>标题</h4>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
</div>
<div class="card">
<h4>标题</h4>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
</div>
</div>
</div>
</section>
</div>
<!-- 内容 E -->
<!-- 页脚 S -->
<footer>
<ul class="share-group">
<li>item1</li>
<li>item1</li>
<li>item1</li>
<li>item1</li>
</ul>
<div class="copy">©素颜猪</div>
</footer>
<!-- 页脚 E -->
</div>
</body>
</html>
css样式
/*页头style S*/
nav{background:transparent;height: 50px}
#banner{background: transparent;height: 500px}
nav ul{list-style: none;margin: 0;float: right;}
nav ul li,nav .logo{display: inline-block;line-height: 50px;margin-right: 20px;}
nav ul li a,nav .logo a{line-height: inherit;text-decoration: none; display: inline-block;height: inherit;color: #fff}
nav .logo{float: left;font-size: 20px;font-weight: bold;letter-spacing: 2px;}
#banner .inner{max-width: 300px;text-align: center;margin: 0 auto;position: relative;top: 80px}
#banner .inner h2{margin:0;}
button{border: none;background:#333;color: #eee;padding: 10px}
#banner .inner .more{margin-top: 80px}
/*页头style E*/
/*内容style S*/
.green-section{text-align: center;background:#089DB0;color: #fff;padding: 100px 0;}
.wrapper{max-width: 1080px;margin: 0 auto;}
.hr{width: 100%;height: 2px; margin:20px auto;}
.green-section .hr{background: #078494;width: 50%;}
.icon-group{margin-top: 40px;}
.green-section .icon-group .icon{display: inline-block;width: 80px;height: 80px;background: #0D6F7C;transform:rotate(45deg);margin:20px;}
.gray-section{background:#252f34;color: #fff}
.gray-section .img-section {width: 40%;}
.img-section img{width: 100%}
.gray-section .text-section{width: 60%;}
.article-preview > div{float: left;font-size: 0px}
.article-preview:nth-child(odd){background-color: rgba(255,255,255,0.05);}
.article-preview:after{content: '';clear: both;display: block;}
.text-section{position: relative;top: 60px;left: 50px;}
.text-section h3{margin-bottom: 20px;}
.text-section .sub-heading{font-size: 22px;margin-top: 0px}
.text-section p{font-size: 18px;letter-spacing: 1px;}
.text-section > *{max-width: 90%;}
.purple-section{background:#3f3965;color: #fff;padding: 80px;}
.purple-section .heading-wrapper{text-align: center;}
.heading-wrapper .hr{background:#373259;width: 50%}
.card{float: left;width: 50%;min-height: 300px;padding: 50px;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;/*border: 1px solid white*/}
.clearfix:after{content: '';clear: both;display: block;}
.card p{font-size: 18px;letter-spacing: 1px;}
.card:first-child{background:rgba(0,0,0,0.05);}
.card:nth-child(2){background:rgba(0,0,0,0.09);}
.card:nth-child(3){background:rgba(0,0,0,0.14);}
.card:nth-child(4){background:rgba(0,0,0,0.18);}
/*内容style E*/
/*页脚style S*/
footer{background:#333;color: #fff;min-height: 200px;text-align: center;}
ul.share-group{display: block;width: 1080px;margin: 0 auto;padding: 30px}
.share-group li{display: inline-block;padding: 10px}
.copy{padding: 20px}
/*页脚style E*/
.main-wrapper{background:#444 url(imgs/cwz3.jpg);background-attachment: fixed;background-repeat: no-repeat;background-size: cover;background-position: center;}
声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系本站删除。