Swiftor277 Swiftor277 - 9 months ago 38
CSS Question

can you change content of a website for each broswer using media query?

My website looks fine on my firefox browser etc but when i go to like firefox and edge, it looks totally different like the container is shifted up and etc etc. I've been searching about this for at least 1-2 hours and i can't find a solution. I am basically trying to change the content or css of the website based on the browser. Here is my css and rest is in codepen'

Demo:
https://codepen.io/anon/pen/wJdGLQ

The html code:

<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>

Answer Source

You can use a number of CSS browser selector "hacks" by checking Browser CSS Hacks by Paul Irish. I've posted the available selectors below:

Selector 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; }

Attribute Hacks

/* 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 Specifically

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