Fluid Means Flexible
Instead of fixed pixel widths that break on small screens, use flexible sizes that stretch and shrink.
max-width: 100% stops an image from being wider than its parent. height: auto keeps its shape.
min(), max() and clamp()
| Function | Meaning |
|---|---|
min(a, b) | The smaller value |
max(a, b) | The larger value |
clamp(min, ideal, max) | The ideal value, but never below min or above max |
h1 font size at 400px wide: 26px h1 font size at 700px wide: 33.5px h1 font size at 1000px wide: 41px
The heading grows smoothly with the screen: 1rem + 2.5vw is 16 + 10 = 26px at 400px wide. It stays between 24px (1.5rem) and 48px (3rem). No media query is needed.
rem part in the middle value, like 1rem + 2.5vw. Pure vw text does not grow when people zoom or change their text size.
srcset and sizes
- Create several sizes of each photo
srcsetlists the files and their real widthssizessays how wide the image will show on the page- The browser picks the smallest file that still looks sharp, which saves data on phones
Art Direction with picture
Use picture when you want a different crop on different screens, such as a wide image for desktops and a tight square one for phones.
Keep the Shape: aspect-ratio and object-fit
a 320px wide box with aspect-ratio 16 / 9 has a height of: 180
aspect-ratio or width and height attributes stop the page from jumping when images load.
Practice
- Make a heading that scales with clamp
- Add three image sizes with srcset and check the downloaded file in the Network tab
- Make equal looking thumbnails from photos of different shapes
Conclusion
Fluid layouts use relative sizes, max-width, clamp and flexible images. Serve smaller files to small screens.

