以下是我的移动网站样式表:
<META name="viewport" content="width=320; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;" />
<META name="HandheldFriendly" content="true" />
<link type="text/css" rel="stylesheet" media="screen and (min-device-width: 481px)" href="css/smartmobile.css" />
<link type="text/css" rel="stylesheet" media="only screen and (max-device-width: 480px)" href="css/smartmobile.css" />
<link type="text/css" rel="stylesheet" media="handheld" href="css/mobile.css" />
我在 iPhone 中加载了该页面,它看起来应该如此。但是,当我在 Blackberry 中加载页面时,它并没有使用“handhled”样式表,而是尝试使用其他样式表。任何人都知道为什么会发生这种情况?
最佳答案
是的,大多数手机甚至更多,所以旧手机会简单地忽略“媒体”类型,如果您需要不同手机类型的 css 不同,我建议使用一些来自服务器端的检测.
关于css - 网页 |移动和 CSS 媒体类型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3249337/