当前位置: 动力学知识库 > 问答 > 编程问答 >

html - How to set media query for safari web browser

问题描述:

@media only screen and (min-width: 480px) and (max-width: 767px) {

}

Here is my media query how to fix it. how to set for safari web browser.

网友答案:

Media queries aren't made for browser detection. Use javascript instead, for example:

if (navigator.userAgent.search("Safari") >= 0 && navigator.userAgent.search("Chrome") < 0) 
{
   alert("Browser is Safari");          
}

More can be found here

网友答案:

Syntax is the same for all browsers.

So @media only screen and (min-width: 480px) and (max-width: 767px) { } will be fine for Safari

分享给朋友:
您可能感兴趣的文章:
随机阅读: