css 帮助我跨越.five课程跨越两个领域......
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了css 帮助我跨越.five课程跨越两个领域......相关的知识,希望对你有一定的参考价值。
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<!-- Link the stylesheet -->
<link rel="stylesheet" href="main.css">
<!-- Link fontawesome -->
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.1.0/css/all.css" integrity="sha384-lKuwvrZot6UHsBSfcMvOkWwlCMgc0TaWr+30HWe3a4ltaBwTZhyTEggF5tJv8tbt" crossorigin="anonymous">
<!-- Link google fonts -->
<link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
<title>CodePenHack</title>
</head>
<body>
<ul class="main">
<li>
<div class="facebook">
<i class="fab fa-facebook fa-5x"></i>
<p>Facebook</p>
</div>
</li>
<li>
<div class="snapchat">
<i class="fab fa-snapchat-ghost fa-5x"></i>
<p>Snapchat</p>
</div>
</li>
<li>
<div class="instagram">
<i class="fab fa-instagram fa-5x"></i>
<p>Instagram</p>
</div>
</li>
<li>
<div class="github">
<i class="fab fa-github fa-5x"></i>
<p>GitHub</p>
</div>
</li>
<li>
<div class="reddit">
<i class="fab fa-reddit fa-5x"></i>
<p>Reddit</p>
</div>
</li>
</ul>
</body>
</html>
/* Some Resets */
html{
font-family: 'Roboto', sans-serif;
}
body, ul, li {
margin: 0;
padding: 0;
}
/* CSS grid */
.main {
display: grid;
color: white;
grid-template-columns: 1fr 1fr 1fr;
grid-template-rows: 1fr;
grid-template-areas:
"facebook snapchat instagram"
"github reddit reddit";
}
/* Alignment */
div {
display: grid;
align-content: center;
justify-content: center;
}
/* Alignment dhanish */
ul, li {
list-style: none;
}
body, ul {
display: grid;
justify-content: center;
}
ul {
margin-top: 5em;
}
li {
transition: transform .7s;
}
/* Styling of the div */
div {
margin: 1.2em;
width: 15em;
height: 15em;
position: relative;
border-radius: 12px;
}
/* Divs */
.facebook {
grid-area: facebook;
background: #0077b5;
}
.snapchat {
grid-area: snapchat;
background: #ffdd00;
}
.instagram {
grid-area: instagram;
background: #e4405f;
}
.github {
grid-area: github;
background: #181717;
}
.reddit {
grid-area: reddit;
background: #ff4500;
}
/* Hover */
li:hover {
transform: scale(1.1);
cursor: pointer;
}
/* Responsiveness */
@media (max-width: 850px) {
.main {
display: grid;
grid-template-columns: 1fr 1fr;
grid-template-rows: auto;
grid-template-areas:
"a b"
"c d"
"f f";
}
}
@media (max-width: 580px) {
.main {
display: grid;
grid-template-columns: 1fr;
grid-template-rows: auto;
grid-template-areas:
"a"
"b"
"c"
"d"
"f";
}
}
以上是关于css 帮助我跨越.five课程跨越两个领域......的主要内容,如果未能解决你的问题,请参考以下文章
如何让 <tr> 标签上的 css 背景颜色跨越整行
CSS Grid Layout:如何使背景颜色跨越多个单元格?
使用画布或 html、css 跨越任何设备并位于中心
如何在 CSS3 站点布局中将图像跨越多个列?
响应式网页设计:div 宽度 + 填充不会跨越包含 div,即使它们等于 100%
css 在不跨越字体下降的文本上加下划线(Safari样式)。