运行 ❯
获取您
的
网站
×
更改方向
保存代码
更改主题,深色/浅色
转到 Spaces
<!DOCTYPE html> <html> <head> <style> #container { width: 80%; aspect-ratio: 2/1; margin: auto; border: solid black 2px; overflow-x: hidden; overflow-y: scroll; scroll-snap-type: y mandatory; } .blue { background-color: lightblue; width: 95%; aspect-ratio: 3/1; } .green { background-color: lightgreen; width: 80%; aspect-ratio: 4/1; } .blue, .green { margin: 2px; scroll-snap-align: end none; scroll-margin-inline-end: 20px; writing-mode: vertical-rl; } </style> </head> <body> <h3>CSS scroll-margin-inline-end property.</h3> <p>With the writing-mode property value set to vertical-rl, the end of the element in the inline direction is changed from right to bottom, and this also affects the scroll-margin-inline-end property.</p> <p>In this example, snap position is set to end in block direction. To make a margin between child elements and container in this snap position, with writing-mode vertical-rl, the scroll-margin-inline-end property value is set to 20px.</p> <div id="container"> <div class="blue">Blue</div> <div class="green">Green</div> <div class="blue">Blue</div> <div class="green">Green</div> <div class="blue">Blue</div> <div class="green">Green</div> <div class="blue">Blue</div> </div> </body> </html>