Mobile media queries in CSS. Making our website change to fit different devices is crucial, since everyone uses their mobile and tablet devices.
/* Media query for mobile devices */
@media only screen and (min-width: 320px) {
body {
padding: 10px;
}
h1 {
font-size: 20px;
}
p {
font-size: 14px;
}
}
/* Media query for larger screens (tablets, desktops, etc.) */
@media only screen and (min-width: 768px) {
body {
padding: 30px;
}
h1 {
font-size: 28px;
}
p {
font-size: 18px;
}
}