Edit CSS in browsers with Media Query, no JavaScript required

Tram Ho

Hello friends!

Reading the title of this article, you probably understand what this article is about to write about. Perhaps anyone who is a developer will have a lot of headaches with fixing css bugs on different browsers? Actually, not only do you specialize in backend, even fontender like us specializing in UI also have a headache, there is a request that you will test on many browers, especially IE. Even though IE is considered as the root browser, in terms of its size, there is not much need for an introduction.

If before, when I did not know this tip, I used to use the way that is a bit silly : define browser by js then add the corresponding class for each browser into the body and then edit the css for each browser .

For example, how to use the following js to define browser (or it could be another js paragraph)

However, up to the present time, I have discovered that the tip is quite convenient and much lighter, can assist you to edit css in browsers via media query . And now let’s go into the details of what this tip includes. Let’s go!

1. Internet Explorer

Regarding IE, of course, until now, no one must be using versions of IE6, IE7 or even IE8, but the listing here should not be redundant.

IE 6

Or

IE 7

Or

IE 6 and 7

Or

Or

IE 6, 7 and 8

IE 8

Or

IE 8 Standards Mode Only

IE 8.9 and 10

IE 9 only

IE 9 and above

IE 9 and 10

IE 10 only

IE 10 and above

Or

IE 11 (and above ..)

Microsoft Edge

2. Firefox

Or

3. Webkit

Perhaps most deloperers are too familiar with browsers built on this -webkit- platform. No stranger to anything, there are two browsers Chrome and Safari . Microsoft Edge now also runs on -webkit- too .

I always code on Chrome, so I will set Chrome as default, taking Chrome as a standard measure, so I rarely use media query browsers to edit css. However, I will still list them here for completeness.

Chrome & Safari (any version)

Chrome 29+

Safari (7.1+)

Safari (10.1+)

Above is almost everything I have discovered about using media queries to edit css on different browsers. This list is not enough, but it is also extremely long and I have not used all of it. However successfully applied for IE10 & 11 and Firefox. Of course, it cannot be considered as complete because there will be countless other ways, if you know more, please comment below for me to learn more.

Wish you successful application!

Share the news now

Source : Viblo