运行 ❯
获取您的
自己的
网站
×
更改方向
保存代码
更改主题,深色/浅色
前往 Spaces
<!DOCTYPE html> <html> <head> <style> html { font-size:16px; } div { font-size: 3rem; border: 1px solid black; } #top-div { font-size: 2rem; border: 1px solid red; } </style> </head> <body> <p>The font-size of this document is 16px.</p> <div id="top-div"> The font-size of this div element is 2rem, which translates to 2 x the browser's font size. <div>The font-size of this div element is 3rem. It also shows that it does not inherit from its parent element font size.</div> </div> <p>The rem unit sets the font-size relative to the browsers base font-size, and will not inherit from its parents.</p> </body> </html>