使用或在媒体查询?

时间:2013-02-13 03:05:14

标签: css

<link rel="stylesheet" type="text/css" href="css/mobile.css" media="screen and (max-height: 500px)" />
<link rel="stylesheet" type="text/css" href="css/mobile.css" media="screen and (orientation:portrait)" />

我有上面的媒体查询来定位肖像和窗口高度&lt; 500个用户,有没有办法在媒体查询中使用OR将它们合并为一个链接标记?

2 个答案:

答案 0 :(得分:1)

对OR运算符使用。

参考:CSS media queries

所以,你的代码将是:

<link rel="stylesheet" type="text/css" href="css/mobile.css" media="screen and (max-height: 500px), screen and (orientation:portrait)" />

答案 1 :(得分:0)

以下是MDN article on media queries的相关部分。

只需将它们与逗号结合使用:

media="screen and (max-height: 500px), screen and (orientation: portrait)"