美文网首页
过渡模块

过渡模块

作者: Jackson_yee_ | 来源:发表于2017-06-14 19:10 被阅读0次

a标签的伪类选择器

  • 1.通过我们的观察发现a标签存在一定的状态

  • 1.1默认状态, 从未被访问过

  • 1.2被访问过的状态

  • 1.3鼠标长按状态

  • 1.4鼠标悬停在a标签上状态

  • 2.什么是a标签的伪类选择器?

  • a标签的伪类选择器是专门用来修改a标签不同状态的样式的

  • 3.格式

  • :link 修改从未被访问过状态下的样式

  • :visited 修改被访问过的状态下的样式

  • :hover 修改鼠标悬停在a标签上状态下的样式

  • :active 修改鼠标长按状态下的样式

<style>
        /*
        a:link{
            color: tomato;
        }
        a:visited{
            color: green;
        }
        a:hover{
            color: orange;
        }
        a:active{
            color: pink;
        }
        */
        a{
            // 简写格式
            color: green;
        }
        /*a:link{*/
            /*color: green;*/
        /*}*/
        /*a:visited{*/
            /*color: green;*/
        /*}*/
        a:hover{
            color: orange;
        }
        a:active{
            color: pink;
        }

  • 4.注意点
  • 4.1a标签的伪类选择器可以单独出现也可以一起出现
  • 4.2a标签的伪类选择器如果一起出现, 那么有严格的顺序要求
  • 编写的顺序必须要个的遵守爱恨原则 love hate
  • 4.3如果默认状态的样式和被访问过状态的样式一样, 那么可以缩写

过渡模块

  • 1,过渡三要素

  • 1.1必须要有属性发生变化

  • 1.2必须告诉系统哪个属性需要执行过渡效果

  • 1.3必须告诉系统过渡效果持续时长

  • 2.注意点

  • 当多个属性需要同时执行过渡效果时用逗号隔开即可

  • transition-property: width, background-color;

  • transition-duration: 5s, 5s;

  • 示例代码
<style>
        *{
            margin: 0;
            padding: 0;
        }
        div{
            width: 100px;
            height: 50px;
            background-color: red;
            /*告诉系统哪个属性需要执行过渡效果*/
            transition-property: width, background-color;
            /*告诉系统过渡效果持续的时长*/
            transition-duration: 5s, 5s;

            /*transition-property: background-color;*/
            /*transition-duration: 5s;*/
        }
        /*:hover这个伪类选择器除了可以用在a标签上, 还可以用在其它的任何标签上*/
        div:hover{
            width: 300px;
            background-color: blue;
        }
    </style>
<style>
        *{
            margin: 0;
            padding: 0;
        }
        div{
            width: 100px;
            height: 50px;
            background-color: red;
            /*告诉系统哪个属性需要执行过渡效果*/
            transition-property: width, background-color;
            /*告诉系统过渡效果持续的时长*/
            transition-duration: 5s, 5s;

            /*transition-property: background-color;*/
            /*transition-duration: 5s;*/
        }
        /*:hover这个伪类选择器除了可以用在a标签上, 还可以用在其它的任何标签上*/
        div:hover{
            width: 300px;
            background-color: blue;
        }
    </style>

过渡模块的其他属性

<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>89-过渡模块-其它属性</title>
    <style>
        *{
            margin: 0;
            padding: 0;
        }
        div {
            width: 100px;
            height: 50px;
            background-color: red;
            transition-property: width;
            transition-duration: 5s;
            /*告诉系统延迟多少秒之后才开始过渡动画*/
            /*transition-delay: 2s;*/
        }
        div:hover{
            width: 300px;
        }
        ul{
            width: 800px;
            height: 500px;
            margin: 0 auto;
            background-color: pink;
            border: 1px solid #000;
        }
        ul li{
            list-style: none;
            width: 100px;
            height: 50px;
            margin-top: 50px;
            background-color: blue;
            transition-property: margin-left;
            transition-duration: 10s;
        }
        ul:hover li{
            margin-left: 700px;
        }
        ul li:nth-child(1){
            /*告诉系统过渡动画的运动的速度*/
            transition-timing-function: linear;
        }
        ul li:nth-child(2){
            transition-timing-function: ease;
        }
        ul li:nth-child(3){
            transition-timing-function: ease-in;
        }
        ul li:nth-child(4){
            transition-timing-function: ease-out;
        }
        ul li:nth-child(5){
            transition-timing-function: ease-in-out;
        }
    </style>
</head>
<body>
<!--<div></div>-->
<ul>
    <li>linear</li>
    <li>ease</li>
    <li>ease-in</li>
    <li>ease-out</li>
    <li>ease-in-out</li>
</ul>
</body>
</html>
image.png

过渡模块连写

  • 1.过渡连写格式

  • transition: 过渡属性 过渡时长 运动速度 延迟时间;

  • 2.过渡连写注意点

  • 2.1和分开写一样, 如果想给多个属性添加过渡效果也是用逗号隔开即可

  • 2.2连写的时可以省略后面的两个参数, 因为只要编写了前面的两个参数就已经满足了过渡的三要素

  • 2.3如果多个属性运动的速度/延迟的时间/持续时间都一样, 那么可以简写为
    transition:all 0s;

  • 1.编写过渡套路

  • 1.1不要管过渡, 先编写基本界面

  • 1.2修改我们认为需要修改的属性

  • 1.3再回过头去给被修改属性的那个元素添加过渡即可

相关文章

  • # 过渡模块transition

    # 过渡模块transition # 过渡模块-其他属性 # 过渡模块-弹性效果 # 过渡模块-手风琴效果 # 什...

  • day21-CSS-动画模块

    动画模块 过渡模块和动画模块的异同 不同点 1.过渡模块需要人为触发(例如hover)才会执行动画 --- 过渡三...

  • 过渡模块

    过渡效果三要素: 1.hover这个伪类选择器除了可以用在a标签上,还可以用在其他的任何标签上。 div:hove...

  • 过渡模块

    a标签的伪类选择器 1.通过我们的观察发现a标签存在一定的状态 1.1默认状态, 从未被访问过 1.2被访问过的状...

  • 过渡模块

    过渡模块的使用 例如: transition-property:width,background-color;(不...

  • CSS过渡模块

    过渡三要素 必须要有属性发生变化 必须告诉系统哪个属性需要执行过渡效果 必须告诉系统过渡效果持续时长 注意点当多个...

  • CSS过渡模块

    a标签的伪类选择器 a标签的伪类选择器是专门用来修改a标签不同状态下的样式的 格式::link 修改从未被访问过状...

  • CSS3 特性

    1.过渡模块 transition 1.需要过渡的属性 transition-property: width,ba...

  • 12-CSS过渡模块

    过渡模块 1.过渡三要素1.1必须要有属性发生变化1.2必须告诉系统哪个属性需要执行过渡效果1.3必须告诉系统过渡...

  • 章节 (19) 过渡模块

    一. a标签的伪类选择器 a标签 1.通过我们的观察发现a标签存在一定的状态 1.1默认状态, 从未被访问过 1....

网友评论

      本文标题:过渡模块

      本文链接:https://www.haomeiwen.com/subject/htjeqxtx.html