[英]How to add background linear-gradient to iOS Safari, Mac Safari, Edge, and IE11?
We are attempting to use background: linear-gradient()
to get the following output.我们正在尝试使用
background: linear-gradient()
来获得以下 output。 However, we are running into a problem where the css is not being applied to the following browsers.但是,我们遇到了一个问题,css 没有应用于以下浏览器。
Question:问题:
How can we get it to work on all browsers?我们怎样才能让它在所有浏览器上工作?
Browsers with issues有问题的浏览器
What we tried我们尝试了什么
.box { padding:20px; display:inline-block; border-right:2px solid #000; border-left:2px solid #000; background: linear-gradient(to left,#000 10px,transparent 10px 30px,#000 0) top, linear-gradient(to right,#000 10px,transparent 10px 30px,#000 0) bottom; background-size:100% 2px; background-repeat:no-repeat; }
<div class="box"> Some text inside </div>
Double position color stops are not supported in IE/Edge and Safari < v13. IE/Edge 和 Safari < v13 中不支持双 position 色标。
https://developer.mozilla.org/en-US/docs/Web/CSS/linear-gradient https://developer.mozilla.org/en-US/docs/Web/CSS/linear-gradient
Simply change your code as such:只需像这样更改您的代码:
background:
linear-gradient(to left ,#000 10px,transparent 10px, transparent 30px, #000 0) top,
linear-gradient(to right,#000 10px,transparent 10px, transparent 30px, #000 0) bottom;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.