Modernizr 不会向我的 CSS 渐变添加前缀

发布于 2024-12-18 04:37:17 字数 313 浏览 5 评论 0原文

我正在尝试将 Modernizr 与 css 渐变一起使用。 我读到 Modernizr 现在可以添加前缀。 所以,我在我的 css 文件中设置了这个:

background-image: linear-gradient(top, #FFF, #AAA);

如果我理解这应该转换为:

background-image: -webkit-linear-gradient(top, #FFF, #AAA); 

但什么也没有发生,我的渐变也没有显示。这是一个错误还是我错过了什么?

I'm trying to use Modernizr with css gradients.
I've read that Modernizr is now capable to add prefixes.
So, I have set this in my css file:

background-image: linear-gradient(top, #FFF, #AAA);

And if I understand this should be transformed to:

background-image: -webkit-linear-gradient(top, #FFF, #AAA); 

But nothing happens and my gradient is not displayed. Is that a bug or am I missing something ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

探春 2024-12-25 04:37:17

Modernizr 是一个 JavaScript 库。它不会改变 CSS 的行为。如果运行它的浏览器需要的话,Modernizr 中的前缀内容会生成正确的前缀 CSS 属性名称。您的示例代码没有 JavaScript;它只是CSS; Modernizr 不会改变其行为。

Modernizr is a JavaScript library. It will not change the behavior of your CSS. The prefix stuff in Modernizr generates the correctly prefixed CSS property name if it is needed for the browser on which it is running. Your sample code has no JavaScript; it is just CSS; Modernizr won't change its behavior.

守护在此方 2024-12-25 04:37:17

Modernizr 不添加供应商前缀。它仅检查浏览器支持的内容。

您可以使用这个 jQuery 插件。
https://github.com/codler/jQuery-Css3-Finalize 它会自动添加供应商前缀。但它对线性渐变的支持有限。

Modernizr does not add vendor prefixes. It only checks what a browser supports.

You can use this jQuery plugin.
https://github.com/codler/jQuery-Css3-Finalize it will automatically add vendor prefixes. But it has limited supported for linear-gradient.

暮年慕年 2024-12-25 04:37:17

我认为您正在寻找的是 http://prefixr.com/index.php

I think what you're looking for is http://prefixr.com/index.php

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文