-
-
Save Kilian/7fb4440b832d22351e656e15090ae3ba to your computer and use it in GitHub Desktop.
Beyond screen sizes, responsive design in 2020. Heart internet article
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@media (prefers-color-scheme: dark) { | |
:root { | |
background: #111; | |
filter: invert(1) hue-rotate(180deg); | |
} | |
img, | |
video { | |
filter: invert(1) hue-rotate(180deg); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@media (prefers-reduced-motion: reduce) { | |
body *, | |
body *::before, | |
body *::after { | |
animation: none !important; | |
transition: none !important; | |
transition-duration: none !important; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@media (environment-blending: opaque) { } | |
@media (environment-blending: additive) { } | |
@media (environment-blending: subtractive) { } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
body { | |
padding: | |
env(save-area-inset-top, 0px) | |
env(save-area-inset-right, 0px) | |
env(save-area-inset-bottom, 0px) | |
env(save-area-inset-left, 0px) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@media (hover: none) and (pointer: coarse) { | |
/* you're on a touch-only device */ | |
} | |
@media (hover: none) and (pointer: fine) { | |
/* you're on a device without hover but with a stylus | |
or other fine pointing device */ | |
} | |
@media (hover: hover) and (pointer: coarse) { | |
/* you're on a device with hover but a coarse pointer, | |
like a gamepad or wii remote*/ | |
} | |
@media (hover: hover) and (pointer: fine) { | |
/* you're on a device with a mouse or trackpad */ | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@media (inverted-colors: none) { | |
/* colors are normal */ | |
} | |
@media (inverted-colors: inverted) { | |
/* colors are inverted */ | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@media (light-level: dim) { } | |
@media (light-level: normal) { } | |
@media (light-level: washed) { } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* ms high contrast */ | |
@media (-ms-high-contrast: active) { } | |
@media (-ms-high-contrast: black-on-white) { } | |
@media (-ms-high-contrast: white-on-black) { } | |
/* forced colors */ | |
@media (forced-colors: none) { } | |
@media (forced-colors: active) { } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const connection = | |
navigator.connection || | |
navigator.mozConnection || | |
navigator.webkitConnection; | |
if ( | |
connection.saveData || | |
['slow-2g', '2g', '3g'].includes(connection.effectiveType) | |
) { | |
/* data-saving measures like not preloading videos */ | |
preloadVideo = false; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@media (prefers-color-scheme: dark) { | |
/* wants dark mode */ | |
} | |
@media (prefers-color-scheme: light) { | |
/* wants light mode */ | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@media (prefers-contrast: high) { } | |
@media (prefers-contrast: no-preference) { } | |
@media (prefers-contrast: low) { } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@media (prefers-reduced-data: reduce) { } | |
@media (prefers-reduced-data: no-preference) { } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@media (prefers-reduced-motion: reduce) { | |
/* wants reduced motion */ | |
} | |
@media (prefers-reduced-motion: no-preference) { | |
/* doesn't want reduced motion */ | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const video = document.createElement('video'); | |
const canAutoPlay = window.matchMedia('(prefers-reduced-motion: no-preference)').matches; | |
video.setAttribute('autoplay', canAutoPlay); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@media (prefers-reduced-transparency: reduce) { | |
/* wants reduced transparency */ | |
} | |
@media (prefers-reduced-transparency: no-preference) { | |
/* doesn't want reduced transparency */ | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<meta name="viewport" content="initial-scale=1, viewport-fit=cover" /> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment