0

我正在做一个项目,我正在制作两个全宽的 div,主要的 div 首先出现,第二个 div 出现在主 div 之后。

主分区 CSS:

*{
margin:0px;
        padding:0px;
    }

    div.main{
        top: -100px;
        /*background: url(img/bg.jpg) no-repeat center center fixed #000000;*/
        /*background: url(http://www.deliciousfood4u.com/wp-content/uploads/2012/05/food_steak_desktop_1302x1020_wallpaper-420339.jpg) no-repeat center center fixed #324a6f;*/
        background-size: cover;
        background-repeat: no-repeat;
        margin-left: -1px;
        position: absolute;
    }

    html, body, .main, #wrappertwo { height: 100%; min-height: 100%; }
    .main { margin: 0 auto; oveflow: hidden; width: 100%; background-color: gray;}

我希望我的最终网站在此处与此网站类似:http: //www.whitmansnyc.com/

你可以在这里看到所有的代码:http: //jsfiddle.net/QFRB8/

4

1 回答 1

0

给你,我相信你会比我有更好的用途。只需编辑那里的框并将其删除以具有主div和第二div的全宽。

http://jsfiddle.net/tS9fX/

html:

<!DOCTYPE>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>

  <title>Blah</title>
  <link type="text/css" rel="stylesheet" media="all" href=
  "style.css" />
  <link type="text/css" rel="stylesheet" media="screen" href="css.css" />
  <link type="text/css" rel="stylesheet" media="screen" href="css_002.css" />
</head>

<body class="user_suscriptions index">
  <div id="wrapper">
    <h1 class="logo">Title</h1>
<h2>another title</h2>
<div class="field form_suscription">
  <form novalidate="novalidate" method="post" id="new_user_suscription" data-remote=
  "true" class="simple_form new_user_suscription" action="/user_suscriptions"
  accept-charset="UTF-8" name="new_user_suscription">
    <div style="margin:0;padding:0;display:inline">
      <input type="hidden" value="&#10003;" name="utf8" /> <input type="hidden"
      value="1Oz4NpXl188INQoGZkqy4LaItW/6sxtsNNruWFBJQEM=" name=
      "authenticity_token" />
    </div>

    <div class="error_message"></div>

    <div class="input email required user_suscription_email">
      <input type="email" size="50" placeholder="Your email address ;)" name=
      "user_suscription[email]" id="user_suscription_email" class=
      "string email required left" autofocus="autofocus" />
    </div><input type="submit" value="Subscribe!" name="commit" class=
    "btn green-btn" />
  </form>

  <div class="clear"></div><small>blahb</small>
</div>

<div class="clear"></div>

<div class="content">
  <div class="left">
    <h2 class="logo">test subject</h2>
  </div>

  <div class="right">
    <h2>Blah title.</h2>

    <p>Blah</p>
  </div>

  <div class="clear"></div>
</div>

<div class="content">
  <div class="block">
    <h3>blag</h3>

    <p>blag</p>
  </div>

  <div class="block">
    <h3>blag</h3>

    <p>blag</p>
  </div>

  <div class="block">
    <h3>blag</h3>

    <p>blag</p>
  </div>

  <div class="clear"></div>
</div>

<div class="clear"></div>
  </div>
</body>
</html>

CSS:

article,
aside,
details,
figcaption,
figure,
footer,
header,
hgroup,
nav,
section,
summary {
    display: block;
}
audio,
canvas,
video {
    display: inline-block;
}



audio:not([controls]) {
    display: none;
    height: 0;
}



[hidden] {
    display: none;
}

html {
    font-family: sans-serif; /* 1 */
    -webkit-text-size-adjust: 100%; /* 2 */
    -ms-text-size-adjust: 100%; /* 2 */
}

body {
    margin: 0;
}

a:focus {
    outline: thin dotted;
}

a:active,
a:hover {
    outline: 0;
}

h1 {
    font-size: 2em;
}

abbr[title] {
    border-bottom: 1px dotted;
}


b,
strong {
    font-weight: bold;
}



dfn {
    font-style: italic;
}



mark {
    background: #ff0;
    color: #000;
}




code,
kbd,
pre,
samp {
    font-family: monospace, serif;
    font-size: 1em;
}


pre {
    white-space: pre;
    white-space: pre-wrap;
    word-wrap: break-word;
}

q {
    quotes: "\201C" "\201D" "\2018" "\2019";
}



small {
    font-size: 80%;
}


sub,
sup {
    font-size: 75%;
    line-height: 0;
    position: relative;
    vertical-align: baseline;
}

sup {
    top: -0.5em;
}

sub {
    bottom: -0.25em;
}


img {
    border: 0;
}


svg:not(:root) {
    overflow: hidden;
}



figure {
    margin: 0;
}


fieldset {
    border: 1px solid #c0c0c0;
    margin: 0 2px;
    padding: 0.35em 0.625em 0.75em;
}


legend {
    border: 0; /* 1 */
    padding: 0; /* 2 */
}


button,
input,
select,
textarea {
    font-family: inherit; /* 1 */
    font-size: 100%; /* 2 */
    margin: 0; /* 3 */
}


button,
input {
    line-height: normal;
}
button,
html input[type="button"], /* 1 */
input[type="reset"],
input[type="submit"] {
    -webkit-appearance: button; /* 2 */
    cursor: pointer; /* 3 */
}



button[disabled],
input[disabled] {
    cursor: default;
}


input[type="checkbox"],
input[type="radio"] {
    box-sizing: border-box; /* 1 */
    padding: 0; /* 2 */
}

input[type="search"] {
    -webkit-appearance: textfield; /* 1 */
    -moz-box-sizing: content-box;
    -webkit-box-sizing: content-box; /* 2 */
    box-sizing: content-box;
}

input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-decoration {
    -webkit-appearance: none;
}


button::-moz-focus-inner,
input::-moz-focus-inner {
    border: 0;
    padding: 0;
}


textarea {
    overflow: auto; /* 1 */
    vertical-align: top; /* 2 */
}

table {
    border-collapse: collapse;
    border-spacing: 0;
}
body {
  font: 14px "Lato", sans-serif;
  background: url(http://i.imgur.com/oRLPdXl.jpg) no-repeat center center fixed;
  background-size: cover;
  color: #FFF; }

#bgMax {
  min-height: 100%;
  min-width: 1400px;
  width: 100%;
  height: auto;
  position: fixed;
  top: 0;
  left: 0; }

a {
  text-decoration: none;
  color: white; }

p {
  font-size: 16px;
  line-height: 30px; }

li {
  list-style: none; }

.clear {
  clear: both;
  visibility: hidden; }

.bgFade {
  background-color: white; }

input[type="text"], input[type="email"] {
  border: none;
  padding: 14px;
  font-size: 16px;
  border-radius: 3px;
  -webkit-border-radius: 3px;
  -o-border-radius: 3px;
  -moz-border-radius: 3px; }
  input[type="text"]:focus, input[type="email"]:focus {
    border-color: red;
    outline: none; }

.green-btn {
  background: url("http://printgram.noflagra.com/wp-content/themes/Printgram/css/images/comofunciona-bg.png") repeat scroll 0 0 transparent;
  color: white;
  padding: 16px;
  font-weight: bold;
  display: inline-block;
  width: initial;
  border: none;
  border-radius: 3px;
  -webkit-border-radius: 3px;
  -o-border-radius: 3px;
  -moz-border-radius: 3px;
  transition: 0.2s all ease-out;
  -webkit-transition: 0.2s all ease-out;
  -moz-transition: 0.2s all ease-out;
  -o-transition: 0.2s all ease-out; }
  .green-btn:hover {
    background: #34da97; }
  .green-btn:active {
    background: #08b16d; }

::-webkit-scrollbar {
  width: 15px;
  margin-left: 10px;
  background: white;
  -webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.25); }

::-webkit-scrollbar-thumb {
  border: solid 0 transparent;
  border-right-width: 3px;
  border-left-width: 4px;
  -webkit-border-radius: 9px 6px;
  -webkit-box-shadow: inset 0 0 0 1px #a1a1a1, inset 0 0 0 6px #a1a1a1; }

::-webkit-scrollbar-thumb:hover {
  -webkit-box-shadow: inset 0 0 0 1px gray, inset 0 0 0 6px gray; }

::-webkit-scrollbar-track-piece {
  background: transparent none;
  border: solid 4px transparent;
  border-right-width: 8px;
  margin: 4px; }

@-webkit-keyframes fadeInUp {
  0% {
    opacity: 0;
    -webkit-transform: translateY(30px); }

  100% {
    opacity: 1;
    -webkit-transform: translateY(0); } }

@-moz-keyframes fadeInUp {
  0% {
    opacity: 0;
    -moz-transform: translateY(30px); }

  100% {
    opacity: 1;
    -moz-transform: translateY(0); } }

@-o-keyframes fadeInUp {
  0% {
    opacity: 0;
    -o-transform: translateY(30px); }

  100% {
    opacity: 1;
    -o-transform: translateY(0); } }

@keyframes fadeInUp {
  0% {
    opacity: 0;
    transform: translateY(30px); }

  100% {
    opacity: 1;
    transform: translateY(0); } }

@-webkit-keyframes fadeIn {
  0% {
    opacity: 0; }

  100% {
    opacity: 1; } }

@-moz-keyframes fadeIn {
  0% {
    opacity: 0; }

  100% {
    opacity: 1; } }

@-o-keyframes fadeIn {
  0% {
    opacity: 0; }

  100% {
    opacity: 1; } }

@keyframes fadeIn {
  0% {
    opacity: 0; }

  100% {
    opacity: 1; } }

.logo {
  font-family: "Pacifico", cursive;
  color: white;
  font-weight: normal;
  margin: 0; }

.content {
  width: 1000px;
  margin: 0 auto;
  padding: 100px 0px; }

.left {
  float: left; }

.right {
  float: right; }

header .content {
  padding: 0; }
header .language {
  float: right;
  margin-top: 15px; }
  header .language .social {
    float: left;
    margin-right: 10px; }
    header .language .social .fb, header .language .social .tw {
      float: left;
      margin: 0 5px; }
  header .language .select {
    float: left;
    background: white;
    border-radius: 3px;
    -webkit-border-radius: 3px;
    -o-border-radius: 3px;
    -moz-border-radius: 3px;
    padding: 1px 9px; }
    header .language .select a {
      font-weight: bold;
      font-size: 12px;
      color: #999999; }

.info {
  animation: fadeInUp 1s 1;
  -moz-animation: fadeInUp 1s 1;
  -webkit-animation: fadeInUp 1s 1;
  -o-animation: fadeInUp 1s 1;
  width: 910px;
  margin: 0 auto;
  padding: 120px 0px 190px 0px;
  text-align: center; }
  .info small {
    color: white;
    display: block;
    font-size: 15px;
    margin: 5px;
    text-shadow: 0px 1px 1px #353535;
    -webkit-text-shadow: 0px 1px 1px #353535;
    -o-text-shadow: 0px 1px 1px #353535;
    -moz-text-shadow: 0px 1px 1px #353535; }
  .info .logo {
    font-size: 70px; }
  .info h2 {
    color: white;
    font-size: 30px;
    font-weight: 300;
    text-align: center;
    margin: 40px 0px;
    text-shadow: 0px 1px 2px rgba(0, 0, 0, 0.3);
    -webkit-text-shadow: 0px 1px 2px rgba(0, 0, 0, 0.3);
    -o-text-shadow: 0px 1px 2px rgba(0, 0, 0, 0.3);
    -moz-text-shadow: 0px 1px 2px rgba(0, 0, 0, 0.3); }
  .info .field {
    margin: 50px 0px 10px 0px;
    animation: fadeInUp 1s 1;
    -moz-animation: fadeInUp 1s 1;
    -webkit-animation: fadeInUp 1s 1;
    -o-animation: fadeInUp 1s 1;
    width: 570px;
    margin: 0 auto; }
    .info .field input {
      width: 400px;
      margin: 10px 0px; }
    .info .field .btn {
      margin: 10px 0px; }
    .info .field .green-btn {
      width: initial; }
  .info .social {
    margin: 0px 0px 60px 0px; }

.about {
  background: url("http://printgram.noflagra.com/wp-content/themes/Printgram/css/images/comofunciona-bg.png") repeat scroll 0 0 transparent; }
  .about .logo {
    color: white;
    font-size: 50px; }
  .about p {
    font-weight: bold; }
  .about h2 {
    font-size: 22px; }
  .about .left {
    float: left;
    width: 50%;
    margin-top: 50px;
    text-align: center; }
  .about .right {
    width: 50%;
    float: right;
    color: white;
    font-weight: 300; }

.demo .content {
  padding: 130px 0px 150px 0px;
  text-align: center; }
.demo h2 {
  font-size: 30px; }
.demo .social {
  margin-top: 20px;
  display: inline-block; }
  .demo .social .fb, .demo .social .gp, .demo .social .tw {
    float: left;
    margin: 0 5px; }

.features {
  background: url("http://printgram.noflagra.com/wp-content/themes/Printgram/css/images/porque-bg.png") repeat scroll 0 0 transparent;
  overflow: hidden; }
  .features .content {
    padding: 100px 0px;
    margin: 0 auto; }
  .features .block {
    float: left;
    width: 30%;
    margin: 15px;
    text-align: center;
    position: relative; }
    .features .block h3 {
      font-size: 22px; }
    .features .block p {
      padding: 0px 20px; }
  .features .feature1, .features .feature2, .features .feature3, .features .feature4, .features .feature5, .features .feature6 {
    width: 152px;
    height: 153px;
    margin: auto; }

.features .feature1 {
    background: url("http://printgram.noflagra.com/wp-content/uploads/2012/08/2-tralha1.png") no-repeat scroll center center transparent;
}

.features .feature2 {
    background: url("http://printgram.noflagra.com/wp-content/uploads/2012/08/1-instagram1.png") no-repeat scroll center center transparent;
}

.features .feature3 {
    background: url("http://printgram.noflagra.com/wp-content/uploads/2012/08/3-foto1.png") no-repeat scroll center center transparent;
}

footer {
    background: url("http://printgram.noflagra.com/wp-content/themes/Printgram/css/images/footer-bg.png") repeat scroll 0 0 transparent;
    border-top: 10px solid #464646;
    color: white;
    height: 100%;
}

  footer .content {
    width: 600px;
    padding: 40px 0px;
    text-align: center; }
    footer .content .logo {
      font-size: 25px;
      font-weight: 300; }
    footer .content p, footer .content a {
      font-weight: 700; }
    footer .content ul {
      text-align: center;
      padding: 0px;
      display: block;
      margin-bottom: 50px; }
      footer .content ul li {
        display: inline-block; }
      footer .content ul a {
        border-radius: 3px;
        -webkit-border-radius: 3px;
        -o-border-radius: 3px;
        -moz-border-radius: 3px;
        background: #0cad6c;
        padding: 3px 7px;
        margin: 3px; }

@media only screen and (max-width: 480px) {
  header .content {
    padding: 0;
    margin-top: 0;
    margin-bottom: 0; }

  #bgMax {
    left: 50%;
    margin-left: -200px; }

  #wrapper {
    width: inherit; }

  .content, .info {
    margin: 20% auto;
    width: 85%;
    overflow: hidden; }

  .info {
    margin: 12% auto;
    padding-top: 50px;
    padding-bottom: 50px; }
    .info .logo {
      font-size: 55px; }
    .info h2 {
      font-size: 20px; }
    .info small {
      font-size: 11px; }
    .info .field {
      width: 100%; }
      .info .field input, .info .field .green-btn {
        padding: 12px;
        font-size: 12px;
        margin-top: 0px;
        margin-bottom: 5px; }
      .info .field input {
        width: 90%%; }

  .about {
    font-size: 12px;
    text-align: center; }
    .about .left, .about .right {
      width: auto; }
    .about .left {
      float: inherit;
      margin: 0; }
      .about .left h2 {
        font-size: 40px; }
    .about .right h2 {
      font-size: 18px; }
    .about .right p {
      font-size: 14px;
      line-height: 28px; }

  .demo .content {
    padding: 50px 0px; }
  .demo .social {
    width: 100px; }

  .features {
    font-size: 12px; }
    .features .content {
      width: 80%;
      padding: 50px 0px; }
    .features .block {
      width: auto;
      float: inherit;
      margin: 55px 0px; }
      .features .block h3 {
        font-size: 18px; }
      .features .block p {
        line-height: 28px;
        font-size: 14px; }

  footer .content {
    margin: 20% auto;
    width: 85%;
    overflow: hidden;
    margin: 5% auto; } }
@media only screen and (min-width: 481px) and (max-width: 1024px) {
  header .content {
    padding: 0;
    margin-top: 0;
    margin-bottom: 0; }

  #wrapper {
    width: inherit; }

  .content, .info {
    margin: 15% auto;
    width: 70%;
    overflow: hidden; }

  .info {
    margin: 8% auto;
    padding-top: 50px;
    padding-bottom: 50px; }
    .info .field {
      width: 420px; }
      .info .field input {
        width: 50%; }

  .about {
    text-align: center; }
    .about .left, .about .right {
      width: auto; }
    .about .left {
      float: inherit;
      margin: 0; }

  .demo .content {
    padding: 50px 0px; }

  .features .content {
    width: 80%;
    padding: 50px 0px; }
  .features .block {
    width: auto;
    float: inherit;
    margin: 55px 0px; }

  footer .content {
    margin: 15% auto;
    width: 70%;
    overflow: hidden;
    margin: 5% auto; } }
.error {
  color: white;
  text-shadow: 0px 1px 1px #353535;
  -webkit-text-shadow: 0px 1px 1px #353535;
  -o-text-shadow: 0px 1px 1px #353535;
  -moz-text-shadow: 0px 1px 1px #353535;
  animation: fadeInUp 1s 1;
  -moz-animation: fadeInUp 1s 1;
  -webkit-animation: fadeInUp 1s 1;
  -o-animation: fadeInUp 1s 1;
  font-weight: bold; }

.exist, .succesfull {
  color: #5f5f5f;
  font-size: 16px;
  font-weight: normal;
  width: 270px;
  padding: 12px 10px;
  margin: 0 auto;
  border-radius: 5px;
  background: white;
  animation: fadeInUp 1s 1;
  -moz-animation: fadeInUp 1s 1;
  -webkit-animation: fadeInUp 1s 1;
  -o-animation: fadeInUp 1s 1; }

.temp {
  display: none;
  color: #cccccc; }
于 2013-07-03T05:04:48.040 回答