<!DOCTYPE html>
<html>
<head>
<title>网格布局</title>
<style type="text/css">
.grid-container {
display: grid;
grid-template-columns: 100px 100px 150px;
grid-template-rows: 1fr 2fr 1fr;
grid-column-gap: 50px;
grid-row-gap: 20px;
justify-content: center;
grid-auto-rows: 250px;
background-color: #2196F3;
padding: 10px;
}
.grid-item {
background-color: rgba(255, 255, 255, 0.8);
border: 1px solid rgba(0, 0, 0, 0.8);
padding: 20px;
font-size: 30px;
text-align: center;
}
.item1 {
grid-column-start: 1;
grid-column-end: 3;
grid-column: 1 / 3;
grid-row-start: 1;
grid-row-end: 4;
grid-row: 1 / 4;
}
</style>
<script type="text/javascript" src="jquery-3.1.1.min.js"></script>
</head>
<body>
<div class="grid-container">
<div class="grid-item item1">1</div>
<div class="grid-item">2</div>
<div class="grid-item">3</div>
<div class="grid-item">4</div>
<div class="grid-item">5</div>
<div class="grid-item">6</div>
<div class="grid-item">7</div>
<div class="grid-item">8</div>
<div class="grid-item">9</div>
<div class="grid-item">10</div>
</div>
</body>
<script type="text/javascript">
</script>
</html>
参考资料
https://www.ruanyifeng.com/blog/2019/03/grid-layout-tutorial.html
|