首页
CSS
CSS 网格容器
试用:使用 align-content: end
运行 ❯
获取您
自己
的网站
×
更改方向
保存代码
更改主题,深色/浅色
转到 Spaces
<!DOCTYPE html> <html> <head> <style> .grid-container { display: grid; height: 400px; align-content: end; grid-template-columns: auto auto auto; gap: 10px; background-color: #2196F3; padding: 10px; } .grid-container > div { background-color: rgba(255, 255, 255, 0.8); text-align: center; padding: 20px 0; font-size: 30px; } </style> </head> <body> <h1>The align-content Property</h1> <p>Use the <em>align-content</em> property to vertically align the grid inside the container.</p> <p>The value "end" will align the rows at the end of the container:</p> <div class="grid-container"> <div>1</div> <div>2</div> <div>3</div> <div>4</div> <div>5</div> <div>6</div> </div> </body> </html>