运行 ❯
获取您的
自有
网站
×
更改方向
保存代码
更改主题,深色/浅色
转到 Spaces
<!DOCTYPE html> <html> <head> <style> #container { width: 50%; aspect-ratio: 2/1; border: 1px solid black; display: grid; grid-template-columns: 1fr 1fr; justify-items: end; writing-mode: vertical-rl; } #container > div { border: 1px solid black; } .blue { background-color: lightblue; inline-size: 60%; } .red { background-color: coral; inline-size: 50%; } .green { background-color: lightgreen; inline-size: 70%; } </style> </head> <body> <h2>justify-items with writing-mode: vertical-rl</h2> <p>Grid items are aligned at the end of the grid container in the inline direction. Inline direction is moved from horizontal to downwards direction with the writing-mode property, so now the end of the contianer in the inline direction is at the bottom of the contianer instead of to the right of it.</p> <div id="container"> <div class="red">RED</div> <div class="blue">BLUE</div> <div class="green">GREEN</div> <div class="red">RED</div> </div> </body> </html>