主頁
CSS
CSS MQ 示例
試一試:使用媒體查詢的示例
執行 ❯
建立您
自己的
網站
×
改變方向
儲存程式碼
更改主題,深色/淺色
前往 Spaces
<!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <style> div.example { background-color: yellow; padding: 20px; } @media screen and (max-width: 600px) { div.example { display: none; } } </style> </head> <body> <h2>Hide elements on different screen sizes</h2> <div class="example">Example DIV.</div> <p>When the browser's width is 600px wide or less, hide the div element. Resize the browser window to see the effect.</p> </body> </html>