源代码贴出来
有帮助望采纳谢谢
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>grid布局</title>
<style>
ul {
list-style: none;
padding: 0;
margin: 0;
}
ul {
width: 320px;
height: 320px;
border: 1px solid red;
/* 开启grid */
display: grid;
/* 设置行高和列宽 */
grid-template-rows: repeat(2, 100px);
grid-template-columns: repeat(2, 155px);
/* 设置行间距和列间距 */
gap: 8px;
/*gap: 10px 5px; 设置两个值的时候,第一个值是行间距,第二个值表示列间距*/
text-align: center;
box-sizing: border-box;
}
ul::after {
content: "";
width: 1px;
height: 319px;
display: block;
background-color: red;
position: absolute;
left: 168px;
}
li {
background-color: orange;
}
</style>
</head>
<body>
<div class="content">
<ul>
<li>1</li>
<li>2</li>
<li>3</li>
<li>4</li>
<li>5</li>
<li>6</li>
</ul>
</div>
</body>
</html>