Media Queries allow CSS to adapt the layout and design depending on the device's screen size, resolution, or type (like print, screen, etc.).
@media media-type and (condition) {
/* CSS rules */
}
Change layout based on screen width:
@media (max-width: 600px) {
.box {
background-color: #ffc107;
font-size: 14px;
}
}
Resize your browser window to see the box color change when screen width is 600px or less:
max-width and min-widthorientation: portrait / landscaperesolutionhover, pointer, aspect-ratio, etc.Help others discover Technorank Learning by sharing your honest experience.
Your support inspires us to keep building!