Chrome CSS Hack 和媒体查询
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11525997/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Chrome CSS Hack and Media Queries
提问by Alex
I want to make a responsive site, but my attempt so far has some problems in chrome. The problem now - insert media queries into the chrome css hack?
我想制作一个响应式网站,但到目前为止我的尝试在 chrome 中存在一些问题。现在的问题 - 将媒体查询插入 chrome css hack?
@media screen and (-webkit-min-device-pixel-ratio:0) { #myid {position: absolute; top: 10px;} @media only screen and (max-width: 1024px) { #myid {position: absolute; top: 8px;} } }
Need it only in css, so no javascript or php. Anyone an idea how to solve that problem?
只在 css 中需要它,所以不需要 javascript 或 php。任何人都知道如何解决这个问题?
回答by thirtydot
The answer you want to hear, and that I hinted at in a comment, is:
你想听到的答案,我在评论中暗示的,是:
@media screen and (-webkit-min-device-pixel-ratio:0) {
#myid {position: absolute; top: 10px;}
}
@media screen and (-webkit-min-device-pixel-ratio:0) and (max-width: 1024px) {
#myid {position: absolute; top: 8px;}
}?
As much as I'd like to solve your underlying problem...
尽管我很想解决您的根本问题...
I′ve added a font via @font-face which is rendered differently in chrome and ie. All line-heights was "destroyed" so i used the hack.
我通过@font-face 添加了一种字体,它在 chrome 和 ie 中呈现不同。所有行高都被“破坏”了,所以我使用了黑客。
?!
?!