Source Code:
(back to article)
Submit
Result:
Report an issue
<!DOCTYPE html> <html> <head> <title>Title of the document</title> <meta name="viewport" content="width=device-width, initial-scale=1"> <style> .container { background-color: green; position: relative; width: 100%; padding-top: 56.25%;/* 16:9 Aspect Ratio */ } .text { position: absolute; top: 0; left: 0; bottom: 0; right: 0; text-align: center; font-size: 25px; color: black; } </style> </head> <body> <h2> Aspect Ratio 16:9</h2> <p>Resize the window to see the effect.</p> <div class="container"> <div class="text">16:9 Aspect ratio</div> </div> </body> </html>