Home › CSS Tutorial › CSS max-width
CSS max-width
Flexible but capped.
max-width lets an element shrink on small screens yet never exceed a limit, which beats a fixed width.
Example code
<style>div{max-width:300px;background:#fde;padding:10px;margin:auto}</style>
<div>Resize the preview: this box shrinks but never passes 300px.</div>