COMP 126: Practical Web Design &
Development for Everyone
@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;
}
}
Text
media/device type
operator
condition
breakpoint
@media () {
// CSS rules that kick in when the
// condition is met
}
@media media type and (condition: value) {
// CSS rules that kick in when the
// condition is met
}