day09

A我今天学习到了什么

1温习day08的知识点

1.公共样式的提取
样式文件,分层:
1.1  base:底层样式,
      a.样式重置,
      b.封装的样式,像浮动,伪元素清除浮动,定位,居中,宽度,伪元素设置边框等;
//就是将常用的样式进行自己的一个封装,从而简化代码
1.2  common:公共样式,一个项目中共同使用的样式,比如色调等;
//单个项目组多次运用的样式,组合
1.3  page:就是每个页面使用的样式,在其他的页面不使用的样式;
(参考bootstraps)
2.css 2d转换(transform)
transform:translate(x,y) rotate(30deg)
2.1 位移:translate(x,y)  
//translateX,translateY同理
2.2 旋转: rotate(30deg)
2.3 倾斜:skew(x,y)
2.4缩放:scale(x,y)
//X,Y值设置一个则默认为两个值一样,同理
3、垂直水平居中
垂直水平居中margin:auto
//HTML
<div class="one">
    <div class="two">

    </div>
</div>
//css
.one{
            width:400px;
            height:400px;
            background-color: red;
            position: relative;
        }
        .two{
            width:100px;
            height:100px;
            background-color: pink;
            position: absolute;
            margin:auto;
            left:0;
            top:0;
            bottom:0;
            right:0;}
垂直水平居中margin:left/right
 position: absolute;
            margin-left:-50%width;
            margin-top:-50%height;
            left:50%;
            top:50%;
垂直水平居中transform:translate(x,y)
position: absolute;
            top:50% ;
            left:50%;
            transform:translate(-50%,-50%)
4.过渡(transition)
代码如下:
<style>
        div{
            background: #333;
            height: 200px;
            width: 200px;
        }
        .box:hover{
            transform: translateX(100px) rotate(360deg);
            background: pink;
            transition: all 2s linear 2s;
            /*属性 动作需要时间 过渡的效果 延迟时间*/
        }
    </style>
</head>
<body>
    <div class="box">
    </div>
</body>

2.拓展day09的知识点

1、动画animation
1.定义@keyframes 

A.@keyframes myfirst
{
    from {background: red;}
    to {background: yellow;}
}
div{
 animation:myfirst 2s;
}
B.@keyframes myfirst
{
    0%   {background: red;}
    25%  {background: yellow;}
    50%  {background: blue;}
    100% {background: green;}
}
div{
 animation:myfirst 2s infinite;  //无限循环
}
//css
 div{
            width: 100px;height: 100px;
            background: red;
            animation: myFirst 4S infinite;
        }
        @keyframes myFirst {
            0%{
                width: 200px;
                height: 200px;
            }
            25%{
                width: 100px;
                height: 50px;
            }
            50%{
                width: 400px;
                height: 200px;
            }
            100%{
                width: 200px;
                height: 400px;
            }
        }
// infinite:无限循环

B我掌握了的

1、动画animation
1.定义@keyframes 

A.@keyframes myfirst
{
    from {background: red;}
    to {background: yellow;}
}
div{
 animation:myfirst 2s;
}
B.@keyframes myfirst
{
    0%   {background: red;}
    25%  {background: yellow;}
    50%  {background: blue;}
    100% {background: green;}
}
div{
 animation:myfirst 2s infinite;  //无限循环
}
//css
 div{
            width: 100px;height: 100px;
            background: red;
            animation: myFirst 4S infinite;
        }
        @keyframes myFirst {
            0%{
                width: 200px;
                height: 200px;
            }
            25%{
                width: 100px;
                height: 50px;
            }
            50%{
                width: 400px;
                height: 200px;
            }
            100%{
                width: 200px;
                height: 400px;
            }
        }
// infinite:无限循环

C我没掌握的

没怎么去运用,不太会实现,要多练

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 在iOS中随处都可以看到绚丽的动画效果,实现这些动画的过程并不复杂,今天将带大家一窥ios动画全貌。在这里你可以看...
    每天刷两次牙阅读 8,579评论 6 30
  • 在iOS中随处都可以看到绚丽的动画效果,实现这些动画的过程并不复杂,今天将带大家一窥iOS动画全貌。在这里你可以看...
    F麦子阅读 5,147评论 5 13
  • A今天学了什么 1.animation 动画 2.使用动画animation B我掌握好的地方 1.animat...
    执念念不直阅读 201评论 0 0
  • 选择qi:是表达式 标签选择器 类选择器 属性选择器 继承属性: color,font,text-align,li...
    love2013阅读 2,342评论 0 11
  • 天上月亮落泪 地上的人儿微醉 说是隔着遥远的距离 说是无声的思念掩藏 远方的人儿在心里 在我甜甜的梦乡 月亮,将我俩捆绑
    伶子风阅读 187评论 0 0