gpt4 book ai didi

css - 针对 Windows 7 的条件 CSS

转载 作者:行者123 更新时间:2023-12-04 19:19:10 25 4
gpt4 key购买 nike

我可以在网上找到很多这样的讨论,但是我找不到任何人专门针对我的问题:

我在网站上使用 Google Webfonts。在除 Windows 7 之外的所有平台上,字体看起来都不错。但在 Windows 7 上,我需要调整某些字体版本的字体粗细。我可以成功地使用 IE 9 的条件语句,但我如何仅在 Windows 7 中实际定位 FF 和 Chrome? Win XP(IE 8及以下,还有FF、Chrome)字体渲染完美,Mac OS也很好(FF、Safari、Chrome)。

我发现了很多 hack,但没有一个可以改变特定 Windows 版本的 CSS 而不管浏览器...???

提前致谢!

最佳答案

没有 JavaScript 是做不到的。具体来说,您需要检查 navigator.userAgent 的值。如果它包含NT 6.1,则表示客户端运行的是Windows 7。NT 6.0适用于Windows Vista,NT 5.1适用于Windows XP .不幸的是,没有办法使用纯 CSS 来做到这一点。

示例:

var usAg = navigator.userAgent;
if(usAg.indexOf("NT 6.1") != -1) {
//Windows 7, apply styles here, for instance:
var el = document.getElementById("your_id");
el.style.fontWeight = "700";
}

希望对您有所帮助!

关于css - 针对 Windows 7 的条件 CSS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12195080/

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