TIL how to get what browser with just css
POSTED ON:
Today I learned about how to tell what browser you are using with just CSS.
/** Internet Explorer */
@media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {
div {
display: block;
}
}
/** Microsoft Edge */
@supports (-ms-ime-align: auto) {
div {
display: block;
}
}
/** Mozilla Firefox */
@-moz-document url-prefix() {
div {
display: block;
}
}
/** Safari */
@media not all and (min-resolution: 0.001dpcm) {
div {
display: block;
}
}
/** Chrominum */
@media screen and (-webkit-min-device-pixel-ratio: 0) and (min-resolution: 0.001dpcm) {
div:not(*:root) {
display: block;
}
}
via How to Create Browser Specific CSS Code
Related TILs
Tagged: browsers