首页 > 解决方案 > 在 CSS 中隐藏矩形形状的某些部分

问题描述

我想实现

我想隐藏第二个矩形,宽度应该是 100% 并且响应迅速。我正在使用position: absolute;& right:-10%。我也试过body { max-width:100%; },但它不工作。你能解释一下为什么会发生这种情况以及如何解决这个问题吗?

.container2 {
    position: absolute;
    right: -10%;
    width: 35vmax;
    height: 90vmin;
    background-image: linear-gradient(to bottom,hsl(293, 100%, 63%),hsl(264, 100%, 61%));
    border-radius: 50% 50% 0% 0%;
}
<div class="container2"></div>

标签: htmlcss

解决方案


你试过这个吗?

body {
  overflow-x: hidden;
}

推荐阅读