运行 ❯
获取您自己的网站
×
更改方向
保存代码
更改主题,深色/浅色
前往 Spaces
<!DOCTYPE html> <html> <head> <style> #container { width: 200px; aspect-ratio: 2/3; border: 1px solid black; display: grid; position: relative; justify-items: right; } #container > div { border: 1px solid black; padding: 10px; position: absolute; } .blue { background-color: lightblue; width: 50%; } .red { background-color: coral; width: 40%; top: 100px; } .green { background-color: lightgreen; width: 60%; top: 200px; } </style> </head> <body> <h2>justify-items: right, on positioned items</h2> <div id="container"> <div class="red">RED</div> <div class="blue">BLUE</div> <div class="green">GREEN</div> </div> </body> </html>