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

为什么做出来的效果图不能居中

nav {

background: #ccc;

height: 50px;

}

#banner {

background: #777;

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;

}

nav ul li a {

line-height: inherit;

text-decoration: none;

display: inline-block;

height: inherit;

color: #fff;

}

#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: 10px;

}

#banner button {

padding: 14px 60px;

}

#banner .inner .more {

margin-top: 280px;

}

.sub-heading {

line-height: 30px;

margin: 30px 0;

}

.logo {

font-size: 20px;

font-weight: 700;

letter-spacing: 1px;

float: left;

padding: 10px;

}

.logo a {

color: #fff;

text-decoration: none;

}

.active {

border-bottom: 4px solid #fff;

}

h1 {

padding: 12px;

border-top: 2px solid #fff;

border-bottom: 2px solid #fff;

}

h2 {

font-size: 30px;

}

#main-btn {

padding: 14px 28px;

font-size: 20px;

letter-spacing: 4px;

border-radius: 6px;

background: #18a;

}

.green-section {

background: #089DB0;

color: #fff;

text-align: center;

padding: 100px 0;

}

.green-section .hr {

background: #078494;

width: 60%;

}

.wrapper {

max-width: 1080px;

}

.hr {

width: 100%;

height: 2px;

margin: 0 auto;

margin: 20px auto;

}

wrapper hr .sub-heading {

font-size: 18px;

}

.green-section .icon-group .icon {

display: inline-block;

width: 80px;

height: 80px;

border: 1px solid #0D6F7C;

transform: rotate(45deg);

margin: 20px;

}

.icon-group {

margin-top: 60PX;

}

.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 .sub-heading {

font-size: 22px;

margin-top: 0;

}

.text-section > * {

max-width: 98%;

}

.purple-section {

padding: 80px;

background: #3f3965;

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;

/*border:1px solid white;*/

}

.clearfix:after {

content: '';

display: block;

clear: both;

}

.h3{

font-size:24px;

}

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.09);

}


正在回答

5 回答

http://img1.sycdn.imooc.com//58f63a0f0001ef8713070418.jpg我的是这样


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

你是怎么解决的????


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

问题已解决

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

效果图56627b5b000192e605000226.jpg

56627b5c0001e75705000256.jpg

56627b5c0001735305000197.jpg


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

<!doctype html>

<html>

<head>

<meta charset="utf-8">

<title>无标题文档</title>

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

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

</head>


<body>

<header><!-- 页头开始 -->

  <nav>

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

    <ul>

      <li><a href="#" class="active">首页</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>

        <div class="sub-heading"> 我是副标题你好 </div>

        <p>Lorem ipsum dolor sit amet,

          consectetur adipisicing elit.</p>

      </div>

    </div>

    <div class="article-preview">

      <div class="text-section">

        <h2>又一个标题</h2>

        <div class="sub-heading"> 我是副标题你好 </div>

        <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>

        <div class="sub-heading"> 我是副标题你好 </div>

        <p>Lorem ipsum dolor sit amet,

          consectetur adipisicing elit.</p>

      </div>

    </div>

  </section>

  <section class="purple-section">

    <div class="wrapper">

      <div class="heading-wrapper">

        <h2>又一个标题</h2>

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

        <div class="sub-heading">Lorem ipsum dolor sit amet, consectetur adipisicing elit.Ex, est eos obcaecati facere aut, consectetur maiores odit molestiae iusto aliquid magnam evenier blanditiis autem eius </div>

      </div>

      <div class="card-group clearfix">

        <div class="card">

          <h3>标题三</h3>

          <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit.Ex, est eos obcaecati facere aut, consectetur maiores odit molestiae iusto aliquid magnam evenier blanditiis autem eius consequuntur nulla distinctio, quidem maxime?</p>

        </div>

        <div class="card">

          <h3>标题三</h3>

          <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit.Ex, est eos obcaecati facere aut, consectetur maiores odit molestiae iusto aliquid magnam evenier blanditiis autem eius consequuntur nulla distinctio, quidem maxime?</p>

        </div>

        <div class="card">

          <h3>标题三</h3>

          <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit.Ex, est eos obcaecati facere aut, consectetur maiores odit molestiae iusto aliquid magnam evenier blanditiis autem eius consequuntur nulla distinctio, quidem maxime?</p>

        </div>

        <div class="card">

          <h3>标题三</h3>

          <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit.Ex, est eos obcaecati facere aut, consectetur maiores odit molestiae iusto aliquid magnam evenier blanditiis autem eius consequuntur nulla distinctio, quidem maxime?</p>

        </div>

        <div class="card">

          <h3>标题三</h3>

          <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit.Ex, est eos obcaecati facere aut, consectetur maiores odit molestiae iusto aliquid magnam evenier blanditiis autem eius consequuntur nulla distinctio, quidem maxime?</p>

        </div>

        <div class="card">

          <h3>标题三</h3>

          <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit.Ex, est eos obcaecati facere aut, consectetur maiores odit molestiae iusto aliquid magnam evenier blanditiis autem eius consequuntur nulla distinctio, quidem maxime?</p>

        </div>

      </div>

    </div>

  </section>

</div>

<!-- 内容结束 -->

<footer><!-- 页脚开始 --> 

  

</footer>

<!-- 页脚结束 -->

</body>

</html>


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

举报

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

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

进入课程

为什么做出来的效果图不能居中

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