主頁
CSS
CSS 數學函式
試一試:使用 min() 函式
執行 ❯
建立您
自己的
網站
×
改變方向
儲存程式碼
改變主題,深色/淺色
前往 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>