In this example, the width will be at most 300px, but will be smaller (use 50%) if the viewport width is smaller than 600px wide.
Resize the browser window to see the effect.