Tsallaka zuwa abun ciki
Justice Tech School

Media Queries

Media queries apply CSS by screen features: min-width, max-width, orientation, prefers-color-scheme and print. Combine with and, or and not.

Example
<style>
.m { padding: 10px; background: #0f766e } @media (max-width: 500px) { .m { background: #b45309 } } @media (orientation: landscape) { .m { border: 2px solid #fff } }
</style>
<div class="m">Resize the window</div>

Exercise

Narrow screens.

@media (max-: 500px)

Quiz Test

Which feature detects dark mode?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.