您可以使用媒体查询更改每个浏览器的网站内容吗?

时间:2017-03-11 09:25:41

标签: javascript jquery html css ajax

我的网站在我的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>

1 个答案:

答案 0 :(得分:0)

通过选中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专门

/* 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; }