<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style>
.animated {
-webkit-animation-duration: 1s;
animation-duration: 1s;
-webkit-animation-fill-mode: both;
animation-fill-mode: both;
}
.animated.infinite {
-webkit-animation-iteration-count: infinite;
animation-iteration-count: infinite;
}
@keyframes myShadow {
from{
box-shadow: 0 0 25px 4px #f00;
}
to{
box-shadow: 0 0 25px 4px #f00 inset;
}
}
.myShadow {
-webkit-animation-name: myShadow;
animation-name: myShadow;
}
.Site {
display: flex;
min-height: 100vh;
height: 100vh;
flex-direction: column;
background-color: rgba(86, 160, 177, 0.47);
}
.Site-content {
display: flex;
flex: 1;
text-align: center;
line-height: 100%;
justify-content:center;
/*先主轴上的对齐方式*/
align-items:center;
/*然后交叉轴上如何对齐
(元素所在位置垂直于主轴方向的位置画垂直线即为交叉轴)
*/
}
.Site-content div{
width: 200px;
height: 200px;
background-color: #a8a8b1;
color: red;
font-size: 18px;
text-align: center;
line-height: 200px;
/*box-shadow: 0 0 10px #f00;*/
/*box-shadow: 0 0 25px 4px #f00;*/
/*box-shadow: 0 0 25px 4px #f00 inset;*/
}
footer,header{
width: 100%;
height: 100px;
background-color: #2b2b2b;
}
header{
background-color: #00AA88;
}
</style>
</head>
<body class="Site">
<header>...</header>
<main class="Site-content">
<div class="animated infinite myShadow">此处编辑类容</div>
</main>
<footer>...</footer>
</body>
</html>
<!--小结用到的知识点:
1:flex只有一整屏时,固定底栏
2:flex的方式水平垂直居中一个元素 容器的flex属性:justify-content 和 align-items
3:box-shadow的使用 box-shadow: h-shadow:水平阴影位置 v-shadow:垂直阴影位置 [blur:模糊距离] [spread:阴影大小] [color:阴影颜色] [inset];
4:keyframes自定义动画
-->
网友评论