如何制作背景渐变

How to make a background gradient

我需要有关我正在管理的网页的帮助。这是一些代码:

<body>
<div class="left">
</div>

这里是 css:

.left {
    position: fixed;
    width:50%;
    height: 100vh;
    top:0;
    background-image: url('../img/plakatm.jpg');
    background-size: 1164px,1000px;
    background-position: center;
    background-repeat: no-repeat;
}

问题是,我需要在它的右边缘做一个渐变。我无法将渐变添加到图像中,因为 .left 元素在较小的显示器上改变了大小并且渐变不会显示出来。 在这里你可以看到完整的网站(它是波兰语,但你不需要理解它)Click here 来查看它。 谢谢。
亚当

渐变有 css-属性。 That 应该有帮助。

下面是背景渐变的方法。

.left {
  background-image: linear-gradient(to top, #a18cd1 0%, #fbc2eb 100%);
  height: 100px;
  width: 100px;
}
<div class="left">
</div>

这是 link 可以找到好的梯度的地方:https://webgradients.com/

使用CSSlinear-gradient,像下面这样的东西对你有用,最好把它分开成一个不同的class,不要叫它.left,我在此示例中将其称为 .gradient

.left {
  position: fixed;
  width: 50%;
  height: 100vh;
  top: 0;
  background-image: url('http://weknownyourdreamz.com/images/jungle/jungle-04.jpg');
  background-size: 1164px, 1000px;
  background-position: center;
  background-repeat: no-repeat;
}

.left:after {
  position: absolute;
  content: '';
  top: 0;
  height: 100%;
  width: 100%;
  display: block;
  background: white;
  background: -webkit-linear-gradient(left, rgba(255, 255, 255, 0), rgba(255, 255, 255, 1));
  background: -o-linear-gradient(right, rgba(255, 255, 255, 0), rgba(255, 255, 255, 1));
  background: -moz-linear-gradient(right, rgba(255, 255, 255, 0), rgba(255, 255, 255, 1));
  background: linear-gradient(to right, rgba(255, 255, 255, 0), rgba(255, 255, 255, 1));
}
<body>
  <div class="left">
  </div>
</body>