COMP 126: Practical Web Design & Development for Everyone
<meta name="viewport"
content="width=device-width,initial-scale=1.0"/>
Add this to your <head> (not <header>) element:
Translation:
"Please check the width of the viewport before rendering this page in the browser and scale/display the page's contents according to that width."
@media media type and (media feature/condition: breakpoint) {
// CSS rules that kick in when the feature is present or the condition is met
}
all: check for and apply styles to all media types
print: check for and apply styles to be used when printing
screen: check for and apply styles based on the size of the screen
speech: check for and apply in the case of screen readers that “read” the page out loud
Some typical breakpoints are
...but these are flexible. Some systems/orgs have their own. Or just set breakpoints where your design "breaks"!
@media screen and (max-width: 480px) {
.text {
font-size: 16px;
}
}
media/device type
operator
condition
breakpoint