主頁
CSS
RWD 媒體查詢
Tryit:在不同螢幕尺寸下隱藏元素
執行 ❯
建立您
自己的
網站
×
更改方向
儲存程式碼
更改主題,深色/淺色
前往 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>