The min() Function

Use min() to set the width of the div to whichever value is smallest, 50% or 300px:

This div has a width of min(50%, 300px). Resize the browser window to see the effect.