CSS动画一

框架集

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

推荐阅读更多精彩内容

  • 第一部分 HTML&CSS整理答案 1. 什么是HTML5? 答:HTML5是最新的HTML标准。 注意:讲述HT...
    kismetajun阅读 27,879评论 1 45
  • 1、属性选择器:id选择器 # 通过id 来选择类名选择器 . 通过类名来选择属性选择器 ...
    Yuann阅读 1,671评论 0 7
  • 国庆节在家的几天里,我妈给我做了很多好吃的,比如我最爱喝的面疙瘩汤、超喜欢吃的蒸饺、水饺,我哥也下厨做了大餐。还有...
    楚南风阅读 499评论 2 2
  • 《山音》是川端康成的一篇长篇小说,故事简单明了,人物平平淡淡,看不到波澜壮阔,听不到高潮迭起。有的只是阅读过...
    卡壳了阅读 983评论 1 1
  • 这儿的空气有点儿缺氧 这儿的人们有点儿惊慌 一天到晚总是忙又忙 那有心情观望――窗外的阳光 孤独的人儿四处流浪 爹...
    大唐逸民阅读 134评论 0 1