Garrit Schaap
Lecturer at the School of Engineering - Jönköping University.
2022
Named by Ethan Marcotte, May 25, 2010 on A List Apart
Rather than tailoring disconnected designs to each of an ever-increasing number of web devices, we can treat them as facets of the same experience. We can design for an optimal viewing experience, but embed standards-based technologies into our designs to make them not only more flexible, but more adaptive to the media that renders them.
The control which designers know in the print medium, and often desire in the web medium, is simply a function of the limitation of the printed page.
We should embrace the fact that the web doesn’t have the same constraints, and design for this flexibility. But first, we must 'accept the ebb and flow of things.
John Allsopp, “A Dao of Web Design”
You put water into a cup, it becomes the cup. You put water into a bottle, it becomes the bottle. You put water into a teapot, it becomes the teapot.
Bruce Lee, Be Water, My Friend
Surprise...
...we already know most of the things!
<meta name="viewport" content="width=device-width, initial-scale=1.0">
If you can, use relative units
Use the flow that html provides you for free
Use max- and min-sizes to make sure that your content stays readable
If you can, use vectors
Media queries are useful when you want to modify your site or app depending on a device's general type (such as print vs. screen) or specific characteristics and parameters (such as screen resolution or browser viewport width).
MDN Web Docs: Using media queries
@media screen and (min-width: 320px) and (max-width: 768px)
@ rule
media type
media feature
operator
media feature
operator
@media screen (max-width: 600px) {
.element {
/* Do something here */
}
}
<picture>
<source media="(max-width:1000px)" srcset="picture-lg.png">
<source media="(max-width:600px)" srcset="picture-mid.png">
<source media="(max-width:400px)" srcset="picture-sm.png">
<img src="picture.png" alt="picture">
</picture>
<img
srcset="
flower4x.png 4x,
flower3x.png 3x,
flower2x.png 2x,
flower1x.png 1x
"
src="flower-fallback.jpg"
>
By Garrit Schaap