【问题标题】:can you change content of a website for each broswer using media query?您可以使用媒体查询更改每个浏览器的网站内容吗?
【发布时间】:2017-08-01 16:36:36
【问题描述】:

我的网站在我的 firefox 浏览器等上看起来不错,但是当我喜欢 firefox 和 edge 时,它​​看起来完全不同,就像容器向上移动等等等等。我已经搜索了至少 1-2 小时我找不到解决方案。我基本上是在尝试根据浏览器更改网站的内容或 css。这是我的 css,其余的都在 codepen 中'

演示: https://codepen.io/anon/pen/wJdGLQ

html代码:

<div id="jobs-popup">
                    <img id="x-icon1" src="web%20x%20icon%20white.png">
                <div class="jobs-content">
                   <a href="mailto:support@magictouchapp.com" target="_top" class="email">Support@magictouchapp.com</a>

                    </div>
                </div>
                 <!--End Section for Jobs Popup -->

                <!-- Section for contact popup -->
                <div id="contact-popup">
                    <img id="x-icon2" src="web%20x%20icon%20white.png">
                    <div id="contact-content">
                   <a href="mailto:support@magictouchapp.com" target="_top" class="email">Support@magictouchapp.com</a>

                    </div> 
                </div>
                <!-- End Section for Contact Popup -->

                <!-- Section for Press popup -->
               <div id="press-popup">
                    <img id="x-icon3" src="web%20x%20icon%20white.png">
                    <div id="press-content">
                    <a href="mailto:support@magictouchapp.com" target="_top" class="email">Support@magictouchapp.com</a>

                    </div>
                </div>
                <!-- End section Press -->

                <!-- Section for legal popup -->
                <div id="legal-popup">
                    <img id="x-icon4" src="web%20x%20icon%20white.png">
                    <div id="legal-content">
                   <a href="mailto:support@magictouchapp.com" target="_top" class="email">Support@magictouchapp.com</a>

                    </div>
                </div>
                <!-- End section Legal -->
                <!-- Section for Support -->
                  <div id="support-popup">
                    <img id="x-icon5" src="web%20x%20icon%20white.png">
                    <div id="support-content">
                    <a href="mailto:support@magictouchapp.com" target="_top" class="email">Support@magictouchapp.com</a>
                    </div>
                </div>
                <div id="top-bar">
                    <a class="burger-nav"></a>
                    <div id="nav-bar">
                <ul>
                    <li><a class="nav-list" href="#" id="jobs" id="job-under">Jobs</a></li>
                    <li><a class="nav-list" href="#" id="contact" id="contact-under">Contact</a></li>
                    <li><a class="nav-list" href="#" id="press" id="press-under">Press</a></li>
                    <li><a class="nav-list" href="#" id="legal" id="legal-under">Legal</a></li>
                    <li><a class="nav-list" href="#" id="support" id="support-under">Support</a></li>


                    </ul>
                        </div> 

                </div>
            <div id="container">

                <ul id="menu">
                </ul>

                <h1 id="name">Magic Touch</h1>
                <ul class="bubbles">
                    <li id="firstCircle"></li>
                    <li id="secondCircle"></li>
                    <li id="thirdCircle"></li>
                    <li id="fourthCircle"></li>
                    <li id="fifthCircle"></li>
                    <li id="sixthCircle"></li>
            </ul>
            </div>

【问题讨论】:

    标签: javascript jquery html css ajax


    【解决方案1】:

    您可以通过检查Browser CSS Hacks by Paul Irish 来使用许多CSS 浏览器选择器“hacks”。我在下面发布了可用的选择器:

    选择器技巧

    /* IE6 and below */
    * html #id  { color: red }
    
    /* IE7 */
    *:first-child+html #id { color: red }
    
    /* IE7, FF, Saf, Opera  */
    html>body #id { color: red }
    
    /* IE8, FF, Saf, Opera (Everything but IE 6,7) */
    html>/**/body #id { color: red }
    
    /* Opera 9.27 and below, Safari 2 */
    html:first-child #id { color: red }
    
    /* Safari 2-3 */
    html[xmlns*=""] body:last-child #id { color: red }
    
    /* Safari 3+, Chrome 1+, Opera 9+, FF 3.5+ */
    body:nth-of-type(1) #id { color: red }
    
    /* Safari 3+, Chrome 1+, Opera 9+, FF 3.5+ */
    body:first-of-type #id {  color: red }
    
    /* Safari 3+, Chrome 1+ */
    @media screen and (-webkit-min-device-pixel-ratio:0) {
     #id  { color: red  }
    }
    
    /* iPhone / mobile webkit */
    @media screen and (max-device-width: 480px) {
     #id { color: red  }
    }
    
    /* Safari 2 - 3.1 */
    html[xmlns*=""]:root #id  { color: red  }
    
    /* Safari 2 - 3.1, Opera 9.25 */
    *|html[xmlns*=""] #id { color: red  }
    
    /* Everything but IE6-8 */
    :root *> #id { color: red  }
    
    /* IE7 */
    *+html #id {  color: red }
    
    /* IE 10+ */
    @media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {
       #id { color: red; }
    }
    
    /* Firefox only. 1+ */
    #id,  x:-moz-any-link  { color: red }
    
    /* Firefox 3.0+ */
    #id,  x:-moz-any-link, x:default  { color: red  }
    
    /* FF 3.5+ */
    body:not(:-moz-handler-blocked) #id { color: red; }
    

    属性破解

    /* IE6 */
    #id { _color: blue }
    
    /* IE6, IE7 */
    #id { *color: blue; /* or #color: blue */ }
    
    /* Everything but IE6 */
    #id { color/**/: blue }
    
    /* IE6, IE7, IE8, but also IE9 in some cases :( */
    #id { color: blue\9; }
    
    /* IE7, IE8 */
    #id { color/*\**/: blue\9; }
    
    /* IE6, IE7 -- acts as an !important */
    #id { color: blue !ie; } /* string after ! can be anything */
    
    /* IE8, IE9 */
    #id  {color: blue\0/;} /* must go at the END of all rules */
    
    /* IE9, IE10 */
    @media screen and (min-width:0\0) {
        #id { color: red}
    }
    

    火狐专用

    /* Firefox only. 1+ */
    #id,  x:-moz-any-link  { color: red }
    
    /* Firefox 3.0+ */
    #id,  x:-moz-any-link, x:default  { color: red  }
    
    /* FF 3.5+ */
    body:not(:-moz-handler-blocked) #id { color: red; }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-09-10
      • 2021-12-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-08-27
      相关资源
      最近更新 更多