the max() function

Use max() to the width of #div1 to whicher value is largest 50% or 300px:

some text...

resize the browser window to see the effect.