html - 仅对 chrome 应用 css
问题描述
我在我的网页中添加了一些 CSS 代码,我希望这个 CSS 代码只适用于 chrome。在 IE 上它已经在正确的位置。
@media only screen and (min-width:1280px) {
#x07ad3a0adb92619cc table tbody tr td img {
max-width: 185% !important;
}
#xcfad3a0ad9619c9 table tbody tr td img {
max-width: 155% !important;
}
#x0fa3a0adb9219cf table tbody tr td img {
max-width: 165% !important;
}
}
我已尝试以下媒体仅将 CSS 应用于 chrome
@media and (-webkit-min-device-pixel-ratio:0){
@media only screen and (min-width:1280px) {
#x07ad3a0adb92619cc table tbody tr td img {
max-width: 185% !important;
}
#xcfad3a0ad9619c9 table tbody tr td img {
max-width: 155% !important;
}
#x0fa3a0adb9219cf table tbody tr td img {
max-width: 165% !important;
}
}
}
但是网页图片的原始位置被折叠了。上面的代码不适用于 chrome。此外,这部分代码以红色显示。min-device-pixel-ratio:
我不明白我的代码有什么问题:-(
谁能帮我?
提前致谢!!
解决方案
你应该试试这段代码
/* Chrome 29+ */
@media screen and (-webkit-min-device-pixel-ratio:0) and (min-resolution:.001dpcm) {
// your code here
}
推荐阅读
- python - 使用 Python 在 Heroku 上入门时遇到问题
- php - 试图在 Laravel 脚本中获取非对象的属性“服务”
- wpf - 将复选框值与 xaml 上的文本块文本绑定
- python - 如何将数据框拆分为 x 和 y
- javascript - 如何在 for-in 循环中使用 If 语句?
- java - 创建从所有链接到再次重定向的定时页面的重定向链接 - 减速带
- ios - 嵌入式 UIVIewController 在触摸或滚动时意外水平扩展
- android - 在android中加载本地html文件
- ruby - 我的 Sinatra API 应用程序是否需要类声明?
- python - 使用 python 实现 MDP - 维度