我有两份样式表,一份用于移动设备,一份用于计算机。 我想默认使用我的移动表格。
我的标题检查:
<link rel='stylesheet' media='all' href='css/mobile.css' />
<link rel='stylesheet' media='screen and (min-width: 580px)' href='css/large.css' />
但当我检查移动浏览器时,我似乎仍在使用我的大型样式表! (iPhone 4)
最佳答案
尝试做这样的事情: (我的代码)
<link href="css/mobile_portrait.css" rel="stylesheet" type="text/css" media="only screen and (min-width: 320px) and (orientation: portrait)">
<link href="css/mobile_landscape.css" rel="stylesheet" type="text/css" media="only screen and (min-width: 480px) and (orientation: landscape)">
<link href="css/tablet.css" rel="stylesheet" type="text/css" media="only screen and (min-width: 769px)">
<link href="css/netbook.css" rel="stylesheet" type="text/css" media="only screen and (min-width: 1024px)">
<link href="css/desktop.css" rel="stylesheet" type="text/css" media="only screen and (min-width: 1224px)">
(只是例子)
关于 header 中的 css3 媒体查询不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25810973/