运行 ❯
获取您
自己
的网站
×
更改方向
保存代码
更改主题,暗/亮
转到 Spaces
<!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <style> div.example { background-color: lightgrey; padding: 20px; } @media screen and (min-width: 601px) { div.example { font-size: 80px; } } @media screen and (max-width: 600px) { div.example { font-size: 30px; } } </style> </head> <body> <h2>Change the font size of an element on different screen sizes</h2> <div class="example">Example DIV.</div> <p>When the browser's width is 600px wide or less, set the font-size of DIV to 30px. When it is 601px or wider, set the font-size to 80px. Resize the browser window to see the effect.</p> </body> </html>