在响应模式下另一个div

时间:2017-05-02 13:59:07

标签: html css responsive-design division

我在一个jsfiddle项目上工作,无法找到解决方案,将我的左侧背景图像div放在我的右侧菜单div的响应模式下。

此时,我的背景图片div保持在我的菜单div下面。

以下是我的链接:Jsfiddle

SCREENSHOT

(1)这就是我所拥有的和(2)我想要的东西

enter image description here enter image description here

html,
body {
  height: 100%;
  margin: 0px;
  padding: 0px;
}

.total {
  box-sizing: border-box;
  height: 100%
}

.dessus {
  width: 30%;
  min-height: 100%;
  float: right;
  background: #EEF;
}

.spaceone {
  margin: 0px 50px 0px 50px;
  display: block
}

.sub-spaceone {
  margin: 0px 50px 50px 50px;
  display: block;
}

.space {
  margin: 0px 50px 0px 50px;
  display: block
}

.pos {
  position: fixed;
  bottom: 50px;
  float: left;
}

.dessous {
  width: 70%;
  min-height: 100%;
  float: left;
  background: url(http://www.work.booclin.ovh/wp-content/uploads/2017/04/Unknown-7.jpeg) no-repeat top center fixed;
  -webkit-background-size: cover;
  -moz-background-size: cover;
  -o-background-size: cover;
  background-size: cover;
}

@media screen and (max-width:1024px) {
  .total {
    width: 100%;
    text-align: center;
    overflow: hidden;
  }
  .dessous {
    width: 100%;
    text-align: center;
    overflow: hidden;
  }
  .dessus {
    width: 100%;
    min-height: 0px;
  }
  .pos {
    position: relative;
    bottom: 0px;
    float: none;
    margin: 30px 50px;
  }
  .spaceone {
    margin: 0px;
    float: left;
    display: block
  }
  .sub-spaceone {
    display: none
  }
  .space {
    margin: 0px 30px 30px 0px;
    display: inline;
    float: right;
  }
}

@media screen and (max-width:600px) {
  .pos {
    margin: 50px auto;
    display: block;
    float: none;
  }
  .spaceone {
    margin: 30px auto;
    display: block;
    float: none;
  }
  .space {
    margin: 10px 20px;
    display: inline;
    float: none;
  }
}

@media screen and (max-width:300px) {
  .pos {
    margin: 50px auto;
    display: block;
    float: none;
  }
  .spaceone {
    margin: 30px auto;
    display: block;
    float: none;
  }
  .space {
    margin: 10px auto;
    display: block;
    float: none;
    text-align: center;
  }
}
<div class="total">


  <div class="dessus">

    <div class="pos">
      <span class="spaceone">Title</span>
      <span class="sub-spaceone">Sub-Title</span>
      <span class="space">Menu 1</span>
      <span class="space">Menu 2</span>
      <span class="space">Menu 3</span>
    </div>

  </div>


  <div class="dessous"></div>
</div>

1 个答案:

答案 0 :(得分:2)

已删除已修复的.dessous:

.dessous {
    background: url(http://www.work.booclin.ovh/wpcontent/uploads/2017/04/Unknown-7.jpeg) no-repeat top center;
}

&#13;
&#13;
html,
body {
  height: 100%;
  margin: 0px;
  padding: 0px;
}

.total {
  box-sizing: border-box;
  height: 100%
}

.dessus {
  width: 30%;
  min-height: 100%;
  float: right;
  background: #EEF;
}

.spaceone {
  margin: 0px 50px 0px 50px;
  display: block
}

.sub-spaceone {
  margin: 0px 50px 50px 50px;
  display: block;
}

.space {
  margin: 0px 50px 0px 50px;
  display: block
}

.pos {
  position: fixed;
  bottom: 50px;
  float: left;
}

.dessous {
  width: 70%;
  min-height: 100%;
  float: left;
  background: url(http://www.work.booclin.ovh/wp-content/uploads/2017/04/Unknown-7.jpeg) no-repeat top center;
  -webkit-background-size: cover;
  -moz-background-size: cover;
  -o-background-size: cover;
  background-size: cover;
}

@media screen and (max-width:1024px) {
  .total {
    width: 100%;
    text-align: center;
    overflow: hidden;
  }
  .dessous {
    width: 100%;
    text-align: center;
    overflow: hidden;
  }
  .dessus {
    width: 100%;
    min-height: 0px;
  }
  .pos {
    position: relative;
    bottom: 0px;
    float: none;
    margin: 30px 50px;
  }
  .spaceone {
    margin: 0px;
    float: left;
    display: block
  }
  .sub-spaceone {
    display: none
  }
  .space {
    margin: 0px 30px 30px 0px;
    display: inline;
    float: right;
  }
}

@media screen and (max-width:600px) {
  .pos {
    margin: 50px auto;
    display: block;
    float: none;
  }
  .spaceone {
    margin: 30px auto;
    display: block;
    float: none;
  }
  .space {
    margin: 10px 20px;
    display: inline;
    float: none;
  }
}

@media screen and (max-width:300px) {
  .pos {
    margin: 50px auto;
    display: block;
    float: none;
  }
  .spaceone {
    margin: 30px auto;
    display: block;
    float: none;
  }
  .space {
    margin: 10px auto;
    display: block;
    float: none;
    text-align: center;
  }
}
&#13;
<div class="total">


  <div class="dessus">

    <div class="pos">
      <span class="spaceone">Title</span>
      <span class="sub-spaceone">Sub-Title</span>
      <span class="space">Menu 1</span>
      <span class="space">Menu 2</span>
      <span class="space">Menu 3</span>
    </div>

  </div>


  <div class="dessous"></div>
</div>
&#13;
&#13;
&#13;