美文网首页
CSS动画一

CSS动画一

作者: qianxun0921 | 来源:发表于2018-09-13 11:46 被阅读0次

框架集

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title></title>
    </head>
    <frameset cols="30%,*,30%">
        <frame src="1.html">
        <frame src="zuoye.html">
        <frame src="3.html">
    </frameset>>
</html>

显示效果如下:

框架集.PNG

IE6PNG图片的修复问题

让IE6浏览器兼容PNG格式的图片,可以使用png-8格式的图片
使用png-8格式的图片,但是使用这种格式的图片也有一定的弊端,它虽然体积小,但整体像素并不好。

条件Hack

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>条件Hack</title>
    <link rel="stylesheet" type="text/css" href="css/style-normal.css">
    <!--[if IE 8]>
        <link rel="stylesheet" type="text/css" href="css/style-ie8.css">
    <![endif]-->
</head>
<body>
    <!-- 
    有一些情况,有一些特殊的代码我们只需要在某些特殊的浏览器中执行,而在其他的浏览器中不需要执行,这时就可以使用CSS Hack来解决该问题
    CSS Hack实际上指的是一种特殊的代码,这段代码只在某些浏览器中可以识别,而其他浏览器不能识别,通过这种方式,来为一些浏览器设置特殊的代码
     -->

    <!-- 
    条件Hack
        它只对IE浏览器有效,其它的浏览器都会将它识别为注释
        IE10及以上的浏览器已经不支持这种方式
     -->

    <!-- 以下内容只会出现在IE6中 -->
    <!--[if IE 6]>
        <p>为了您和家人的健康,请远离IE6!!</p>
    <![endif]-->

    <!--[if IE 8]>
        <p>当前浏览器是IE8!!</p>
    <![endif]-->

    <!--[if lt IE 9]>
        <p>该标签会在IE9以下的浏览器中显示</p>
    <![endif]-->

    <!--[if gte IE 9]>
        <p>该标签会在IE9及以上的浏览器中显示</p>
    <![endif]-->

    <!--[if lte IE 9]>
        <p>该标签会在IE9及以下的浏览器中显示</p>
    <![endif]-->

    <!--[if ! IE 6]>
        <p>你的浏览器不是IE6</p>
    <![endif]-->
</body>
</html>

属性Hack

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>属性Hack</title>
    <style type="text/css">
        body{
            background-color: #bfa;
            /*
            假设在IE6中需要将背景颜色设置为黄色才能达到和其它浏览器相同的效果
            */
            /*
            希望黄色背景只在IE6中生效
                在样式前添加一个下划线,则该样式只有IE6及以下的浏览器才可以识别
            */
            /*_background-color: yellow;*/

            /*添加了*的样式只有IE7及以下的浏览器认识*/
            /**background-color: yellow;*/

            /*在样式最后添加一个\0,则只有IE8及以上的浏览器才能识别*/
            /*background-color: yellow\0;*/

            /*
            CSS Hack不到万不得已的情况尽量不要使用
            */
        }
    </style>
</head>
<body>
</body>
</html>

CSS3过渡动画

示例代码:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>CSS3过渡动画</title>
    <style type="text/css">
        .box{
            width: 100px;
            height: 100px;
            background-color: gold;
            /*在哪产生动画、动画的时间、运动曲线、延迟*/
            /*transition: border-radius 500ms ease,width 500ms ease 500ms,height 500ms ease 1s,background-color 500ms ease 1.5s;*/
            transition: all 500ms ease;
        }
        .box:hover{
            width: 500px;
            height: 300px;
            background-color: red;
            border-radius: 50px;
        }
    </style>
</head>
<body>
    <div class="box"></div>
</body>
</html>

css3圆角 阴影 透明度

圆角属性:
例如

border-top-left-radius:设置左上角为椭圆圆角

border-top-right-radius: 设置左、右上角为正圆圆角

border-radius:40px; 设置曲率半径为40的圆角矩形

border-radius:20%; 最大200px,20%即40px

border-radius: 50%; 设置为正圆

阴影属性:

/*水平偏移 垂直偏移 羽化大小 扩展大小 颜色 是否内阴影*/
box-shadow: 0px 0px 20px 2px red inset;

透明度属性:

/*透明度30%*/
opacity: 0.3;
/*背景色变透明,但文字不会透明*/
background-color: rgba(255,215,0,0.3);
/*边框透明*/
border: 2px solid rgba(0,0,0,0.3);
filter: alpha(opacity=30);/*兼容IE*/

这句话是用来兼容IE浏览器

运动曲线

示例代码:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>运动曲线</title>
    <style type="text/css">
        div{
            width: 50px;
            height: 50px;
            background-color: gold;
            margin-bottom: 20px;
        }
        div:nth-child(1){
            /*匀速*/
            transition: all 1s linear;
        }
        div:nth-child(2){
            /*开始和结束慢速,中间加速*/
            transition: all 1s ease;
        }
        div:nth-child(3){
            /*开始慢速,结尾突然停止*/
            transition: all 1s ease-in;
        }
        div:nth-child(4){
            /*突然开始,结束时慢速*/
            transition: all 1s ease-out;
        }
        div:nth-child(5){
            /*开始和结束时慢速*/
            transition: all 1s ease-in-out;
        }
        div:nth-child(6){
            /*贝塞尔(贝兹)曲线*/
            /*transition: all 1s cubic-bezier(0.250,0.250,0.750,0.750);匀速*/
            /*超出再缩回的弹性效果*/
            transition: all 1s cubic-bezier(0.470, -0.485, 0.460, 1.435);
        }
        div:hover{
            width: 1000px;
        }
    </style>
</head>
<body>
    <div>linear</div>
    <div>ease</div>
    <div>ease-in</div>
    <div>ease-out</div>
    <div>ease-in-out</div>
    <div>bezier</div>
</body>
</html>

相关文章

  • CSS-3D知识

    1.CSS动画 1.1 CSS动画属性-animation animation:为CSS动画属性,使用该属性可以替...

  • Css动画 小球横移

    学习css 动画,建立小球左右横移的动画原料:html5 Css3html CSS css 动画属性介绍 其中an...

  • 网页高级知识点(三)

    CSS3 transition动画 CSS3 transform变换 CSS3 animation动画

  • 10.React中CSS动画19-04-30

    一.React中实现CSS过渡动画 App.js style.css 一.React中使用CSS动画 style....

  • 有用的Vue第三方库

    Animate.css - CSS动画库 Velocity.js - JS动画库 TweenJS - 状态过渡动画...

  • 23 动画

    css动画 1 .css定义一些动画样式 2 .直接和本来的css样式定义 3 .x6操作属性发生动画,trans...

  • 动画类文章

    css3常用动画+动画库 vue2使用animate css

  • Vue.js 过渡动画

    1. css实现过度 transition 动画 css-transform动画 动态组件 上述动画,如果设置mo...

  • 前端开发入门到实战:CSS动画@keyframes的用法

    CSS动画 CSS动画允许大多数HTML元素的动画,而无需使用JavaScript或Flash! 动画浏览器支持 ...

  • 2018-06-13

    Css动画: css3动画主要包括Transform、Transition、Animation 区别 transi...

网友评论

      本文标题:CSS动画一

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