gpt4 book ai didi

css - Webkit CSS-hack 已弃用?

转载 作者:技术小花猫 更新时间:2023-10-29 11:15:49 24 4
gpt4 key购买 nike

我正在使用 @media screen (-webkit-min-device-pixel-ratio:0) hack 专门针对 Webkit 浏览器。

但它似乎不起作用,有人知道这个 hack 是否已被弃用吗?

还有其他方法可以针对 Webkit 浏览器吗?

更新: 未弃用,我忘了在“screen”后面加上“and”。

最佳答案

以下示例将在 Chrome 和 Safari 中的 #box 上显示彩色背景,但不会在 Firefox 和 Opera 中显示。

<!DOCTYPE html>
<html>
<head>
<style type="text/css">
@media screen and (-webkit-min-device-pixel-ratio:0) {
#box { background: #f0f; }
}
</style>
</head>
<body>
<div id="box">
I'll have a background in Webkit browsers.
</div>
</body>
</html>

如果这还不够,您可以查看 this article about browser-specific CSS hacksWebmonkey .它包括 Internet Explorer、Firefox、Safari 和 Opera 以及上述示例的解决方法。

关于css - Webkit CSS-hack 已弃用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8154289/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com