运行 ❯
获取您的
自己的
网站
×
更改方向
保存代码
更改主题,深色/浅色
前往 Spaces
<!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <style> .container { background-color: red; position: relative; width: 100%; padding-top: 66.66%; /* 3:2 Aspect Ratio */ } .text { position: absolute; top: 0; left: 0; bottom: 0; right: 0; text-align: center; font-size: 20px; color: white; } </style> </head> <body> <h2>Maintain Aspect Ratio 3:2</h2> <p>Resize the window to see the effect.</p> <div class="container"> <div class="text">3:2 Aspect ratio</div> </div> </body> </html>