首页 > 解决方案 > Internet Explorer - IE,线性渐变(linear-gradient)

问题描述

再会。

我在 IE 11 上测试线性渐变时遇到问题。在我测试过的所有其他浏览器中,包括 Chrome、FireFox、Edge 等。一切都按预期工作,但 IE 无法正确渲染。

在我寻找答案的过程中,我查看了多个堆栈溢出帖子——帖子一帖子二。尽管这些帖子和其他帖子提供了一些见解,但根据我的评论,我的 CSS 应该可以工作 - 见下文。

CSS{
  background-color: rgba(0, 0, 0, 0.6) 50%;
  background: -webkit-gradient(linear, left top, left bottom, from(rgba(0, 
  0, 0, 0.6) 50%), to(transparent));
  background: -webkit-linear-gradient(top, rgba(0, 0, 0, 0.6) 50%, 
  transparent);
  background: -moz-linear-gradient(top, rgba(0, 0, 0, 0.6) 50%, 
  transparent);
  background: -ms-linear-gradient(top, rgba(0, 0, 0, 0.6) 50%, 
  transparent);
  background: -o-linear-gradient(top, rgba(0, 0, 0, 0.6) 50%, 
  transparent);
  display: block;
  position: absolute;
  width: 100%;
  height: 100%;
  left: 0;
  top: 0;
  z-
}

在上面的 CSS 中,我假设我需要调整与 -ms-linear-gradient 线相关的内容。我还包括了一张图片以供审查;最上面的图片是我想要的东西在 IE 中的样子。

如果有人可以提供任何额外的观点或见解,将不胜感激。

示例图像

标签: cssinternet-explorer

解决方案


推荐阅读