A simple webpage that changes spacing and font size when the screen is smaller than 600px, making it easier to read on phones.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Responsive Design Example</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<header>My Website</header>
<main>
<section>Content goes here</section>
</main>
<footer>Footer info</footer>
</body>
</html>body {
font-family: Arial, sans-serif;
margin: 1rem;
}
header, footer {
background-color: #4CAF50;
color: white;
padding: 1rem;
text-align: center;
}
main {
background-color: #f0f0f0;
padding: 1rem;
margin-top: 1rem;
}
/* Responsive layout for small screens */
@media (max-width: 600px) {
body {
margin: 0.5rem;
}
main {
padding: 0.5rem;
}
header, footer {
font-size: 1.2rem;
}
}