【问题标题】:Linear gradient with stops does not work in IE11带停止的线性渐变在 IE11 中不起作用
【发布时间】:2018-11-06 15:31:32
【问题描述】:

我尝试在 IE11 中进行此背景工作。我看不出故障……有人知道这是怎么回事吗?

  background: linear-gradient(to right, red 1px, transparent 1px), linear-gradient(to bottom, red 1px, transparent 1px);
  background-size: 60px 30px;

小提琴:https://jsfiddle.net/201gyf6L/

谢谢

–––– 更新––––

我找到了 IE11 的解决方法。

background: linear-gradient(left, red 1px, transparent 1.1px), linear-gradient(top, red 1px, transparent 1.1px);

我将“to right”更新为“left”,将“to bottom”更新为“top”,重要的是,我写了 1.1px 而不是 1px。有点丑,但可以。

【问题讨论】:

标签: css internet-explorer-11 linear-gradients


【解决方案1】:

尝试使用以下代码:

<head>
    <meta charset="utf-8" />
    <title></title>
   <style type="text/css">
       div {
           width: 420px;
           height: 720px;
           background-color: white;
           background-image: linear-gradient(red 2px, transparent 2px), 
               linear-gradient(90deg, red 2px, transparent 2px), 
               linear-gradient(rgba(255,255,255,.3) 1px, transparent 1px), 
               linear-gradient(90deg, rgba(255,255,255,.3) 1px, transparent 1px);
           background-size: 60px 30px;
       }
   </style>
</head>
<body>
    <div>
    </div>
</body>

输出如下(使用IE 11.1.17134.0版本):

【讨论】:

  • 好吧,这很有趣。我用 2px 试过了,效果很好。但是对于 1px 则不然。可悲的是,我需要 1px。 background: linear-gradient(red 2px, transparent 2px), linear-gradient(90deg, red 2px, transparent 2px); background-size: 60px 30px;
猜你喜欢
  • 2016-12-18
  • 2019-09-21
  • 1970-01-01
  • 2017-10-17
  • 1970-01-01
  • 2020-05-30
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多