码迷,mamicode.com
首页 > 其他好文 > 详细

格式布局

时间:2018-10-07 20:25:02      阅读:137      评论:0      收藏:0      [点我收藏+]

标签:style   nbsp   inf   alt   布局   black   div   har   href   

效果图:

技术分享图片

代码:

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;
  }

 

格式布局

标签:style   nbsp   inf   alt   布局   black   div   har   href   

原文地址:https://www.cnblogs.com/QQBOSS/p/9751128.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!