html - Internet Explorer 中的渐变颜色

标签 html css internet-explorer background gradient

我知道 Internet Explorer 有一些专有扩展,因此您可以执行诸如创建具有渐变背景的 div 之类的操作。我不记得元素名称或它的用法。有没有人有一些例子或链接?

最佳答案

我用于所有浏览器渐变的代码:

background: #0A284B;
background: -webkit-gradient(linear, left top, left bottom, from(#0A284B), to(#135887));
background: -webkit-linear-gradient(#0A284B, #135887);
background: -moz-linear-gradient(top, #0A284B, #135887);
background: -ms-linear-gradient(#0A284B, #135887);
background: -o-linear-gradient(#0A284B, #135887);
background: linear-gradient(#0A284B, #135887);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#0A284B', endColorstr='#135887');
zoom: 1;

您需要指定高度或 zoom: 1 以将 hasLayout 应用于元素,以便在 IE 中使用。


更新:

这是为所有 LESS 用户准备的 LESS Mixin (CSS) 版本:

.gradient(@start, @end) {
    background: mix(@start, @end, 50%);
    filter: ~"progid:DXImageTransform.Microsoft.gradient(startColorStr="@start~", EndColorStr="@end~")";
    background: -webkit-gradient(linear, left top, left bottom, from(@start), to(@end));
    background: -webkit-linear-gradient(@start, @end);
    background: -moz-linear-gradient(top, @start, @end);
    background: -ms-linear-gradient(@start, @end);
    background: -o-linear-gradient(@start, @end);
    background: linear-gradient(@start, @end);
    zoom: 1;
}

关于html - Internet Explorer 中的渐变颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/213750/

相关文章:

powershell - 我如何在带有 powershell 的私有(private)模式下使用 IE 或 IE

css - 为 Internet explorer IE6+ 设置圆 Angular (Border radius)

javascript - 在 AngularJS 中选择选项返回对象而不是值

html - 如何去除HTML中的一些td边框

javascript - 根据内容动态改变div的高度

css - CSS 文件中的 IE 特定 css

asp.net - JQuery Overlay-wrapInner 方法

html - 如何链接到没有 .html 扩展名的页面?

javascript - 带有图例的多线图的工具提示单击 d3.js

html - Ruby on Rails ajax 弹出消息