CSS grid-auto-flow 属性的用法
htmlcssweb developmentfront end technology更新于 2024/10/19 10:52:17
使用 grid-auto-flow 属性在网格中包含自动放置的项目。
示例
您可以尝试运行以下代码,使用 CSS 实现 grid-auto-flow 属性 −
<!DOCTYPE html>
<html>
<head>
<style>
.container {
display: grid;
grid-auto-columns: 50px;
grid-auto-flow: column;
grid-gap: 10px;
background-color: red;
padding: 10px;
}
.container>div {
background-color: yellow;
text-align: center;
padding:10px 0;
font-size: 20px;
}
</style>
</head>
<body>
<div class = "container">
<div class = "ele1">1</div>
<div class = "ele2">2</div>
<div class = "ele3">3</div>
<div class = "ele4">4</div>
<div class = "ele5">5</div>
<div class = "ele6">6</div>
</div>
</body>
</html>
相关文章
有用资源
html 参考教程 - 该教程包含有关 html 的更多信息:https://www.cainiaomax.com/html/

