gpt4 book ai didi

如果检测到移动设备,则 Html 加载 css

转载 作者:行者123 更新时间:2023-11-28 03:41:22 27 4
gpt4 key购买 nike

<link media="only screen and (min-device-width : 320px) and (max-device-width : 480px)" href="smartphone.css" type= "text/css" rel="stylesheet" />
<link media="only screen and (-webkit-min-device-pixel-ratio : 1.5), only screen and (min-device-pixel-ratio : 1.5)" href="iphone.css" type= "text/css" rel="stylesheet" />

我做对了吗?或者有更好的方法来做到这一点?

最佳答案

如 Cole 所述,您可以检查 userAgent。这是一些 javascript,您可以使用它来检测 userAgent 是否是 iPhone。 (Source)

<script language=javascript>
<!--
if ((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i))) {
//Change the css
}
-->
</script>

关于如果检测到移动设备,则 Html 加载 css,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10706270/

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