纯css实现瀑布流布局

代码语言:html

所属分类:瀑布流

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">

<style>
/* CSS reset */
*,
*::after,
*::before {
  box-sizing: inherit;
  margin: 0;
  padding: 0;
}

body {
  box-sizing: border-box;
  position: relative;
}

html {
  font-size: 62.5%;
}

/* Typography --------------------------------------------*/

body {
  font-family: 'Helvetica Neue', sans-serif;
  font-size: 2rem;
  text-align: center;
}

.heading {
  margin-bottom: 3rem;
}

.body-text {
  font-size: 1.6rem;
  line-height: 2.5rem;
  margin: 0 auto;
  width: 70%;
}

.footer-text {
  color: #fff;
  font-size: 1.5rem;
}

/* Header --------------------------------------------*/

.header {
  margin: 0 auto;
  padding: 3rem 0;
  width: 65%;
}

/* Footer --------------------------------------------*/

.footer {
  background-color: #333;
   margin-top: 3rem;
  padding: 2rem 0;
  width: 100%;
}

/* Grids --------------------------------------------*/

.container {
  display: grid;
  grid-gap: 2rem;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(12, 150px);
  margin: 0 auto;
  max-width: 90%;
  padding: 3rem 0;
}

/* Grid images --------------------------------------------*/

.img {
  border-radius: 1rem;
  height: 100%;
  width: 100%;
  object-fit: cover;
}

.........完整代码请登录后点击上方下载按钮下载查看

网友评论0