为了账号安全,请及时绑定邮箱和手机立即绑定

正在回答

2 回答

html5

<!DOCTYPE html>

<html>

<head>

<meta charset="utf-8"> 

<title>Document</title> 

<link rel="stylesheet" href="css/reset.css">

<link rel="stylesheet" href="css/main.css"/>

</head>

<body>

<div class="main-wrapper">

<header>

<nav>

<div class="logo"><a href="#">王小窝</a></div>

<ul>

<li><a href="#" class="active">链接1</a></li>

<li><a href="#">链接2</a></li>

<li><a href="#">链接3</a></li>

<li><a href="#">链接4</a></li>

</ul>

</nav>

<div id="banner">

<div class="inner">

<h1>王小窝</h1>

<p class="sub-heading">Lorem ipsum dolor sit amet, consectetur adipisicing elit.</p>

<button>了解我</button>

<div class="more">更多</div>

</div>

</div>

</header>

<div class="content">

<section class="green-section">

<div class="wrapper">

<div>

<h2>一个标题</h2>

<div class="hr"></div>

<p class="sub-heading">Lorem ipsum dolor sit amet, consectetur adipisicing elit.</p>

</div>

<div class="icon-group">

<span class="icon">item1</span>

<span class="icon">item2</span>

<span class="icon">item3</span>

</div>

</div>

</section>

<section class="gray-section">

<div class="article-preview">

<div class="img-section">

<img src="img/pic01.jpg" alt="">

</div>

<div class="text-section">

<h2>其实我内心是拒绝的</h2>

<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit.</p>

</div>

</div>

<div class="article-preview">

<div class="text-section">

<h2>其实我内心是拒绝的</h2>

<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit.</p>

</div>

<div class="img-section">

<img src="img/pic02.jpg" alt="">

</div>

            </div>

<div class="article-preview">

<div class="img-section">

<img src="img/pic03.jpg" alt="">

</div>

<div class="text-section">

<h2>其实我内心是拒绝的</h2>

<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit.</p>

</div>

</section>

<section class="purple-section">

<div class="heading-wrapper">

<h2>不约</h2>

<div class="hr"></div>

<div class="sub-heading">

Lorem ipsum dolor sit amet, consectetur adipisicing elit. 

</div>

<div class="card-group clearfix">

<div class="card">

<h3>标题</h3>

<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Corporis odit veniam maxime est inventore eveniet quas voluptates quis minima laudantium beatae corrupti excepturi ratione rerum mollitia!</p>

</div>

<div class="card">

<h3>标题</h3>

<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Corporis odit veniam maxime est inventore eveniet quas voluptates quis minima laudantium beatae corrupti excepturi ratione rerum mollitia!</p>

</div>

<div class="card"><h3>标题</h3>

<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Corporis odit veniam maxime est inventore eveniet quas voluptates quis minima laudantium beatae corrupti excepturi ratione rerum mollitia!</p></div>

<div class="card"><h3>标题</h3>

<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Corporis odit veniam maxime est inventore eveniet quas voluptates quis minima laudantium beatae corrupti excepturi ratione rerum mollitia!</p></div>

<div class="card"><h3>标题</h3>

<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Corporis odit veniam maxime est inventore eveniet quas voluptates quis minima laudantium beatae corrupti excepturi ratione rerum mollitia!</p></div>

<div class="card"><h3>标题</h3>

<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Corporis odit veniam maxime est inventore eveniet quas voluptates quis minima laudantium beatae corrupti excepturi ratione rerum mollitia!</p></div>

</div>

</div>

</section>

</div>

<footer>

<ul class="share-group">

<li>item</li>

<li>item</li>

<li>item</li>

<li>item</li>

<li>item</li>

</ul>

<div class="copy">

&copy 王小窝-2017

</div>

</footer>

</div>

</body>

</html>


css

.clearfix:after{

content: '';

display: block;

clear: both;

}

ul{

margin: 0;

}

header{

background: rgba(0,0,0,0.4);

}

nav{

background: transparent;

height: 50px;

}

#banner{

background: transparent;

height: 700px;

}

nav ul{

list-style: none;

margin: 0;

float: right;

}

nav ul li,nav .logo{

display: inline-block;

line-height: 50px;

margin-right: 20px;

}

.logo a{

text-decoration: none;

}

nav ul li a{

line-height: 50px;

text-decoration: none;

display: inline-block;

height: inherit;

color: #fff;

}

nav ul li.logo{

float: left;

padding: 10px;

}

#banner .inner{

max-width: 300px;

text-align: center;

margin: 0 auto;

position: relative;

top: 160px;

}

#banner .inner h1{

margin: 0;

}

button{

border: none;

background: #333;

color: #eee;

padding: 14px 40px;

}

#banner button{

padding: 14px 60px;

}

#banner .inner .more{

margin-top: 230px;

}

.sub-heading{

line-height: 30px;

    margin: 30px;

}

.logo{

font-size: 20px;

font-weight: 700;

letter-spacing: 1px;

}

.logo a{

color: #fff;

}

h1{

padding: 12px;

border-top: 2px solid #fff;

border-bottom: 2px solid #fff;

}

h2{

font-size: 30px;

}

h3{

font-size: 24px;

}

p{

font-size: 18px;

letter-spacing: 1px;

}

.hr{

width: 100%;

height: 2px;

margin: 20px auto;

}

.sub-heading{

font-sizes: 18px;

}

#main-btn{

padding: 14px 28px;

font-size: 20px;

letter-spacing: 4px;

border-radius: 6px;

background: #18A;

}

.green-section{

background:#089DB0;

text-align: center;

color: #fff;

padding:100px 0;

}

.green-section .icon-group .icon{

display: inline-block;

width: 80px;

height: 80px;

background: #0D6F7C;

transform: rotate(45deg);

margin: 20px;

}

.icon-group{

margin-top: 20px;

}

.green-section .hr{

background:#078494;

width: 60%;

}

.wrapper{

max-width: 1080px;

margin: 0px auto;

}

.gray-section{

background: #252F34;

color: #fff;

}

.gray-section .img-section{

width:45%;

}

.img-section img{

width: 100%;

}

.gray-section .text-section{

width: 55%;

}

.article-preview > div{

float: left;

font-size: 0;

}

.article-preview:nth-child(odd){

background-color: rgba(255,255,255,0.05);

}

.article-preview:after{

content: '';

display: block;

clear: both;

}

.text-section{

position: relative; 

top: 68px; 

left: 50px;

}

.text-section h2{

margin-bottom: 20px;

}

.text-section p{

font-size: 18px;

letter-spacing: 1px;

}

.text-section > *{

max-width: 90%;

}

.purple-section{

padding: 80px;

background: #262149;

color: #fff;

}

.purple-section .heading-wrapper{

text-align: center;

}

.purple-section .hr{

background: #373259;

width: 60%;

}

.card{

float: left;

width: 50%;

min-height: 300px;

padding: 50px;

-webkit-box-sizing: border-box;

-moz-box-sizing: border-box;

box-sizing: border-box;

}

.card:first-child{

background-color: rgba(0,0,0,0.04);

}

.card:nth-child(2){

background-color: rgba(0,0,0,0.08);

}

.card:nth-child(3){

background-color: rgba(0,0,0,0.12);

}

.card:nth-child(4){

background-color: rgba(0,0,0,0.16);

}

.card:nth-child(5){

background-color: rgba(0,0,0,0.20);

}

.card:nth-child(6){

background-color: rgba(0,0,0,0.24);

}

footer{

background: #333;

color: #fff;

min-height: 200px;

text-align: center;

}

ul .share-group{

display: block;

width: 1080px;

margin: 0 auto;

padding: 50px;

}

.share-group li{

display: inline-block;

padding: 10px;

}

.copy{

padding-bottom: 20px;

}

.main-wrapper{

background: #444 url(../img/banner.jpg);

background-attachment: fixed;

background-repeat: no-repeat;

background-size: cover;

background-position: center;

}


0 回复 有任何疑惑可以回复我~
#1

Dreamer1017

张小窝的上下没有hr啊
2017-09-20 回复 有任何疑惑可以回复我~
#2

Dreamer1017

张小窝的上下没有hr啊
2017-09-20 回复 有任何疑惑可以回复我~

万分感谢!

0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消
HTML5和CSS3扁平化风格博客
  • 参与学习       86807    人
  • 解答问题       383    个

HTML5与CSS3搭建超酷扁平化风格博客

进入课程

有源码吗

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信