格式布局
Posted qqboss
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了格式布局相关的知识,希望对你有一定的参考价值。
效果图:
代码:
html:
<!DOCTYPE html>
<html>
<head>
<title>布局</title>
<meta charset="utf-8">
</head>
<body>
<link rel="stylesheet" type="text/css" href="buju.css">
<div class="container">
<div class="one">One</div>
<div class="two">Two</div>
<div class="three">Three</div>
<div class="four">Four</div>
<div class="five">Five</div>
<div class="six">Six</div>
</div>
</body>
</html>
CSS:
.container{
display: grid;
grid-template-columns: 60px 60px 60px;
grid-auto-rows: 60px 60px 60px 60px;
background: white;
color: white;
}
.one{
grid-column-start: 1;
grid-row-start: 1;
grid-row-end: 2;
grid-column-end: 4;
background: red;
}
.two{
grid-column-start: 1;
grid-row-start: 2;
grid-column-end: 2;
grid-row-end: 5;
background: green;
}
.three{
grid-column-start: 2;
grid-row-start: 2;
grid-column-end: 3;
grid-row-end: 3;
background: black;
}
.four{
grid-column-start: 2;
grid-row-start: 3;
grid-row-end: 4;
grid-column-end: 3;
background: yellow;
}
.five{
grid-column-start: 2;
grid-row-start: 4;
grid-column-end: 3;
grid-row-end: 5;
background: red;
}
.six{
grid-column-start: 3;
grid-row-start: 2;
grid-column-end: 4;
grid-row-end: 5;
background:blue;
}
以上是关于格式布局的主要内容,如果未能解决你的问题,请参考以下文章