DEV Community

Cover image for How to Target Specific Browsers With CSS
Stephan Lamoureux
Stephan Lamoureux

Posted on β€’ Edited on

4 1

How to Target Specific Browsers With CSS

Web browsers are built with different rendering engines, and this causes small differences in the way your website appears between browsers. The sizing may be a little different, the colors aren't consistent, and many more things of that nature.

To counter this, we can use the following CSS to target and style specific browsers.

Chrome & Safari (Webkit)

@media screen and (-webkit-min-device-pixel-ratio:0) { 
    property: value;
}
Enter fullscreen mode Exit fullscreen mode

Firefox

@-moz-document url-prefix() {
    .class {
        property: value;
    }
}
Enter fullscreen mode Exit fullscreen mode

Microsoft Edge

@supports (-ms-ime-align:auto) {
    .selector {
        property: value;
    }
}
Enter fullscreen mode Exit fullscreen mode

IE11 and up

_:-ms-fullscreen, :root .ie11up { 
property: value; 
}
Enter fullscreen mode Exit fullscreen mode

Top comments (0)

nextjs tutorial video

Youtube Tutorial Series πŸ“Ί

So you built a Next.js app, but you need a clear view of the entire operation flow to be able to identify performance bottlenecks before you launch. But how do you get started? Get the essentials on tracing for Next.js from @nikolovlazar in this video series πŸ‘€

Watch the Youtube series

πŸ‘‹ Kindness is contagious

Engage with a wealth of insights in this thoughtful article, valued within the supportive DEV Community. Coders of every background are welcome to join in and add to our collective wisdom.

A sincere "thank you" often brightens someone’s day. Share your gratitude in the comments below!

On DEV, the act of sharing knowledge eases our journey and fortifies our community ties. Found value in this? A quick thank you to the author can make a significant impact.

Okay