簡體   English   中英

將div設置為固定在相對位置上的位置

[英]set div to position fixed on the relative location

是否可以將div fixed在繪制位置(它是標准的“ static / relative ”位置)?

因此,我希望將div .one.three.four固定在最初繪制的位置。 這樣它就不會滾動。 https://jsfiddle.net/sor8hntk/2/

是! https://jsfiddle.net/sor8hntk/7/

body {
  margin-top:40px;
}

.one {
  float:left;
  background-color:green;
  width:33%;
  height:50px;
  position: fixed;
}
.two {
  float:left;
  background-color:red;
  width:33%;
  height:500px;
  left: 33%;
  position: absolute;
}

.three {
  float:left;
  background-color:blue;
  width:33%;
  height:50px;
  position: fixed;
  left: 66%;
}

.four {
  width:33%;
  background-color:purple;
  height:10px;
  position: fixed;
}

.five {
  width:100%;
  background-color:pink;
  margin-top: 10px;
}

.six {
  width:100%;
  height:10px;
  background-color:yellow;
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM