只能通过html或媒体查询来定位Chrome吗? [英] Is it possible to target chrome by html or media query only

查看:136
本文介绍了只能通过html或媒体查询来定位Chrome吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是媒体查询:

 < link rel =stylesheetmedia =screen and(min-device -width:1024px)href =desktop.css/> 

< link rel ='stylesheet'media ='screen and(min-width:1023px)and(max-width:1025px)'href ='ipad.css'/>

这样我就可以在1024像素的大小中获得不同的样式,但是这适用于所有浏览器,除了Chrome新样式出现在1041px的大小

有没有什么办法可以定位chrome,只给它不同大小的ipa样式

解决方案

以下内容可用于针对Chrome(和Safari,因为它们都基于WebKit)的CSS:

  @media屏幕和(-webkit-min-device-pixel-ratio:0){
/ * CSS规则* /
}

请参阅关于webkit-min-device-pixel-ratio的问题


this is the media query:

<link rel="stylesheet" media="screen and (min-device-width: 1024px)" href="desktop.css"/> 

<link rel='stylesheet' media='screen and (min-width: 1023px) and (max-width: 1025px)' href='ipad.css' />

so that i get different style in size of 1024px but this worked on all browsers except chrome the new style appears in size of 1041px

is there any way to target chrome only to give it ipa style in different size

解决方案

The following can be used to target CSS for Chrome (and Safari, as both are WebKit based):

@media screen and (-webkit-min-device-pixel-ratio:0) {
   /* CSS rules */
}

See Question on webkit-min-device-pixel-ratio

这篇关于只能通过html或媒体查询来定位Chrome吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆