CSS3特效----图片动态提示效果

摘要:
需掌握的知识点:1.掌握两个HTML5新标签figure以及figcaption的用法2.掌握transform的属性特点,并能熟练运用3.学会通过transition及transform配合,制作动画4.学会简单的媒体查询应用figure,HTML5语义化标签:用于规定独立的流内容(图像、图表、照片、代码等)figcaption,HTML5语义化标签:与figure配套使用,用于标签定义figu

需掌握的知识点:

1.掌握两个HTML5新标签figure以及figcaption的用法

2.掌握transform的属性特点,并能熟练运用

3.学会通过transition及transform配合,制作动画

4.学会简单的媒体查询应用

figure ,HTML5语义化标签:

用于规定独立的流内容(图像、图表、照片、代码等)

figcaption,HTML5语义化标签:

与figure配套使用,用于标签定义figure元素的标题或注解

结构和用法:

CSS3特效----图片动态提示效果第1张

transform属性:
1、translate(平移)-- transform:translate(10px,10px);
2、rotate(旋转) -- transform:rotate(90deg);
3、scale(缩放) -- transform:scale(0.5,0.5);
4、skew(扭曲)- - transform:skew(50deg,0deg);

transition属性:
1、property:检索或设置对象中的参与过渡属性(all,transform...)
2、duration:过渡动画的持续时间
3、timing-function:检索火设置对象中过渡的动画类型
4、delay:检索或设置对象延迟过渡的时间
-- transition: property duration timing-function delay;
-- transition: all 2s ease-in 1s;

效果图:

CSS3特效----图片动态提示效果第2张

html代码:

<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title></title>
    <link href="demoCSS.css"type="text/css"rel="stylesheet" />
</head>
<body>
<figure class="test1">
    <img src="img/1.jpg" />
    <figcaption>
        <h2>平移动画-多条文字</h2>
        <p>多条图片简介文字</p>
        <p>逐一飞入动画</p>
        <p>利用动画延时达到效果</p>
    </figcaption>
</figure>
<figure class="test2">
    <img src="img/2.jpg" />
    <figcaption>
        <h2>旋转动画</h2>
        <p>飞来飞去,飞来飞舞</p>
        <div></div>
    </figcaption>
</figure>
<figure class="test3">
    <img src="img/3.jpg" />
    <figcaption>
        <h2>图片标题</h2>
        <p>图片注解</p>
    </figcaption>
</figure>
<figure class="test4">
    <img src="img/4.jpg" />
    <figcaption>
        <h2>缩放动画</h2>
        <p>图片注解</p>
        <div></div>
    </figcaption>
</figure>
</body>
</html>

css代码:

*{margin:0;padding:0;
}figure{position:relative;width:33%;height:350px;float:left;overflow:hidden;
}figcaption{position:absolute;top:0px;left:0px;color:#fff;font-family:"微软雅黑";
}@media screen and (max- 600px){figure{width:100%}}
@media screen and (min- 601px) and (max- 1000px){figure{width:50%}}
@media screen and (min- 1001px){figure{width:33%}}
figure figcaption p,h2,span,div{transition:all 0.35s;}figure img{opacity:0.8;transition:all 0.35s;}.test1{background:#2F0000;}.test1 figcaption p{background:#fff;color:#333;margin:5px;text-align:center;transform:translate(-240px,0px);
}.test1 figcaption{padding:20px;}.test1:hover figcaption p{transform:translate(0px,0px);}.test1 figcaption p:nth-of-type(1){transition-delay:0.05s;}.test1 figcaption p:nth-of-type(2){transition-delay:0.1s;}.test1 figcaption p:nth-of-type(3){transition-delay:0.15s;}.test1:hover img{opacity:0.5;transform:translate(-50px,0px);}.test2{background:#030;}.test2 figcaption{width:100%;height:100%;}.test2 figcaption div{border:2px solid #fff;width:80%;height:80%;position:absolute;top:10%;left:10%;transform:translate(0px,-350px) rotate(0deg);
}.test2 figcaption h2{margin-top:15%;margin-left:15%;
}.test2 figcaption p{margin-left:15%;transform:translate(0px,50px);opacity:0;
}.test2:hover figcaption div{transform:translate(0px,0px) rotate(360deg);
}.test2:hover img{opacity:0.5;}.test2:hover figcaption p{transform:translate(0px,0px);opacity:1;
}.test3{background:#000;
}.test3 figcaption{top:30%;left:15%;
}.test3 figcaption h2{-webkit-transform:skew(90deg);/*导致chrome卡死的原因是90deg无限大*/
}.test3 figcaption p{-webkit-transform:skew(90deg);transition-delay:0.1s;
}.test3:hover figcaption h2{-webkit-transform:skew(0deg);
}.test3:hover figcaption p{-webkit-transform:skew(0deg);
}.test3:hover img{opacity:0.5;
}.test4{background:#000;
}.test4 figcaption{width:100%;height:100%;}.test4 figcaption h2{margin-top:15%;margin-left:15%;transform:scale(1.2,1.2);opacity:0;
}.test4 figcaption p{margin-top:5px;margin-left:15%;transform:scale(1.2,1.2);opacity:0;
}.test4 figcaption div{border:2px solid #fff;width:80%;height:80%;position:absolute;top:10%;left:10%;transform:scale(1.2,1.2);opacity:0;
}.test4:hover figcaption div{transform:scale(1,1);opacity:1;
}.test4:hover img{opacity:0.5;transform:scale(1.2,1.2);
}.test4:hover figcaption h2{transform:scale(1,1);opacity:1;
}.test4:hover figcaption p{transform:scale(1,1);opacity:1;
}

免责声明:文章转载自《CSS3特效----图片动态提示效果》仅用于学习参考。如对内容有疑问,请及时联系本站处理。

上篇并发管理Qt中 .pro 文件和 .pri 文件简介下篇

宿迁高防,2C2G15M,22元/月;香港BGP,2C5G5M,25元/月 雨云优惠码:MjYwNzM=

相关文章

css3实现小米商城鼠标移动图片上浮阴影效果

今天在编程爱好者编码库看见一个好玩的程序,代码如下。 <!DOCTYPE html> <html> <head>     <meta charset="UTF-8">     <meta name="viewport"content="width=device-width, initial-sca...

前端全链路优化总结

减少http请求 http请求每次都需要建立通信链路,进行数据传输,在服务端每个http都需要启动独立的线程去处理,这些开销很昂贵,减少请求的数量可有效的提高访问性能。例如: 合并公用的小css/js块 雪碧图、字体图标、base64图标 使用http2.0及其以上版本 使用浏览器缓存 通过设置http头中的cache-control和expire...

Bootstrap 点击按钮切换内容

<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title></title> <!-- CSS --> <!-- 最新版本的 Boots...

利用CSS三角形实现的冒泡框

请用CSS实现如下图的样式,相关尺寸如图示,其中dom结构为:<div id=”demo”></div> 这是一道去年的百度笔试题。 涉及定位、三角形、伪元素。 下面是我的解答以及一些知识概述,都在程序里了。 <!DOCTYPE html> <html lang="en"> <head>...

CSS3之边框图片border-image

CSS3中有关border的属性,还有很多,今天我将为大家介绍一个很好玩的属性——Border-image。有了CSS3之边框图片Border-image,我们可以轻松搞定圆角,轻松搞定很多之前难搞的东东。 一、border-image的语法 1、border-image-source border-image-source:url(image);/*im...

CSS 控制滚动条样式

在360浏览器中设置滚动条隐藏样式 以下 可直接实现隐藏功能 1 ::-webkit-scrollbar {/*隐藏滚轮*/ 2   display:none; 3 } 如果要兼容 PC 其他浏览器(Firefox 、IE6、IE8、Google等)设置滚动条隐藏样式,在容器(div)外面再嵌套一层overflow:hidden内部边框宽高限制尺寸和外...