Today I Learned - Rocky Kev

TIL how to get what browser with just css

POSTED ON:

TAGS:

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:

TIL how to get what browser with just css

Today I learned about how to tell what browser you are using with just CSS.

TIL Considering Device Obsolescence with web development

I'm incredibly guilty of pushing to build for the latest tech. For good reason too - you can write less code, use more native functions, and things are just more likely to work.

TIL SpaceX ships run Chromium

HTML/CSS is good enough for space.