运行 ❯
获取您
自身
的网站
×
更改方向
保存代码
更改主题,深色/浅色
转到 Spaces
<!DOCTYPE html> <html> <head> <style> #div1 { background-color: yellow; height: 100px; width: min(50%, 300px); } </style> </head> <body> <h1>The min() Function</h1> <p>Use min() to set the width of #div1 to whichever value is smallest, 50% or 300px:</p> <div id="div1">Some text...</div> <p>Resize the browser window to see the effect.</p> </body> </html>