如何使用@media查询仅针对默认Android浏览器编写CSS规则?

时间:2017-02-02 10:22:10

标签: android css

我需要使用 @media 查询仅对默认Android浏览器应用 CSS 规则。不适用于Chrome,但适用于Android中的默认浏览器。

这样的查询是否存在?

重要的是,有太多不同的Android设备具有不同的场景大小。因此,在max-width中使用@media无法解决我的问题。

提前致谢!

1 个答案:

答案 0 :(得分:0)

基于CSS3 media query specs,仅使用媒体查询无法检测到它。

然而,使用javascript可以使用以下代码段

检测默认的android浏览器(不是chrome)
structure(list(rok = c(2016, 2016, 2016, 2016, 2016, 2016, 2016, 
2016, 2016, 2017, 2017), miesiac = c(4, 5, 6, 7, 8, 9, 10, 11, 
12, 1, 2), ile = c(80.1, 87.5, 159, 104, 125.3, 74.2, 84.9, 74.4, 
75.3, 81.8, 2.4), kwartal = c(2, 2, 2, 3, 3, 3, 4, 4, 4, 1, 1
), miesiac2 = c("1", "2", "3", "1", "2", "3", "1", "2", "3", 
"1", "2"), kwartal2 = structure(c(1L, 1L, 1L, 2L, 2L, 2L, 3L, 
3L, 3L, 4L, 4L), .Label = c("Q2 2016", "Q3 2016", "Q4 2016", 
"Q1 2017"), class = "factor"), miesiac3 = c("Kwiecień", "Maj", 
"Czerwiec", "Lipiec", "Sierpień", "Wrzesień", "Październik", 
"Listopad", "Grudzień", "Styczeń", "Luty"), limit = c(308, 308, 
308, 300, 300, 300, 245, 245, 245, 244, 244), serwis = c("Sport", 
"Sport", "Sport", "Sport", "Sport", "Sport", "Sport", "Sport", 
"Sport", "Sport", "Sport"), typ = c("odslony", "odslony", "odslony", 
"odslony", "odslony", "odslony", "odslony", "odslony", "odslony", 
"odslony", "odslony"), ile2 = c(326.6, 326.6, 326.6, 303.5, 303.5, 
303.5, 234.6, 234.6, 234.6, 84.2, 84.2), ile_proc = c(25, 27, 
49, 34, 41, 24, 36, 32, 32, 97, 3), lp = c(1, 1, 1, 2, 2, 2, 
3, 3, 3, 4, 4)), class = "data.frame", .Names = c("rok", "miesiac", 
"ile", "kwartal", "miesiac2", "kwartal2", "miesiac3", "limit", 
"serwis", "typ", "ile2", "ile_proc", "lp"), row.names = c(NA, 
-11L))