浮动无法覆盖我的整个背景。这是为什么?

时间:2019-11-07 12:34:29

标签: html css

我的html文件中有两个div,宽度均为50%。左边的位置是固定的,右边的位置必须是scrollong。我将其设置为浮动。问题是,我的div浮动背景周围有空白:

我的代码:

for (i = 0; i < 100; i++) {
  document.write(" <br>");
}
.left {
  flex: 1;
  left: 0;
  width: 50%;
  background-color: #ffc30b;
  height: 100vh;
  position: fixed;
  top: 0;
}

.left p {
  margin: 0;
  position: absolute;
  top: 50%;
  left: 50%;
  -ms-transform: translate(-50%, -50%);
  transform: translate(-50%, -50%);
}

.right {
  background-size: cover;
  width: 50%;
  background-color: black;
  float: right;
}
<body>
  <section id="about">
    <div class="left">
      <p class="header">ABOUT</p>
    </div>

    <div class="right">
      <div class="aboutimg"><img src="img.png" alt="me|Jessa" width="200" height="200" /></img>
      </div>

    </div>
  </section>
</body>

enter image description here

1 个答案:

答案 0 :(得分:-1)

尝试添加此内容

library(dplyr)
data(iris)

iris%>% filter(Species =="virginica")%>%
        arrange(desc(Petal.Length))%>%
        head(20)

# Sepal.Length Sepal.Width Petal.Length Petal.Width   Species
# 1           7.7         2.6          6.9         2.3 virginica
# 2           7.7         3.8          6.7         2.2 virginica
# 3           7.7         2.8          6.7         2.0 virginica
# 4           7.6         3.0          6.6         2.1 virginica
# 5           7.9         3.8          6.4         2.0 virginica
# 6           7.3         2.9          6.3         1.8 virginica
# 7           7.2         3.6          6.1         2.5 virginica
# 8           7.4         2.8          6.1         1.9 virginica
# 9           7.7         3.0          6.1         2.3 virginica
# 10          6.3         3.3          6.0         2.5 virginica
# 11          7.2         3.2          6.0         1.8 virginica
# 12          7.1         3.0          5.9         2.1 virginica
# 13          6.8         3.2          5.9         2.3 virginica
# 14          6.5         3.0          5.8         2.2 virginica
# 15          6.7         2.5          5.8         1.8 virginica
# 16          7.2         3.0          5.8         1.6 virginica
# 17          6.9         3.2          5.7         2.3 virginica
# 18          6.7         3.3          5.7         2.1 virginica
# 19          6.7         3.3          5.7         2.5 virginica
# 20          6.3         2.9          5.6         1.8 virginica