Responsive Web Design

Media Queries

Media queries allow CSS to adapt styles based on screen size.

Example:

<!DOCTYPE html>
<html>
<head>
    <style>
        body {
            background-color: lightblue;
        }
        @media (max-width: 600px) {
            body {
                background-color: lightcoral;
            }
        }
    </style>
</head>
<body>
    <p>Resize the browser to see the background change.</p>
</body>
</html>