HTML5动画和鼠标移动
2017-11-05 18:37
211 查看
鼠标移动上去字体变色 中间有图片
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style>
*{
margin: 0;
padding: 0;
}
ul,li{
list-style: none;
}
.clear:after{/*在每个.class之后插入新内容*/
content: "\200B";
display: block;/*使段落生成行内框,每个框是一个块级元素*/
height: 0;
clear: both;/*是图像的左侧和右侧均不出现浮动*/
}
/*定义最外层盒子*/
.box{
padding: 10px;
border: 1px solid #000;
}
/*定义左侧大图片的样式*/
.big_pic{
width: 400px;
height: 400px;
background: #999;
float: left;
margin: 5px 0;
}
/*定义小图片集合样式*/
.list{
float: left;
width: 700px;
}
/*定义每一个小图片集合样式*/
.list li{
width: 200px;
height: 200px;
background: red;
float: left;
margin:5px 5px 0;
text-align: center;
}
/*定义小图片下方文字样式*/
p{
color: #fff;
text-align: center;
margin-top: 30px;
}
/*定义每一小个图片样式*/
.btn{
display: inline-block;/*定义行内块元素*/
width: 70px;
height: 70px;
border-radius: 50%;/*向 块级 元素添加圆角边框*/
background: rgba(0,0,0,.5);/*rgba括号中前3个数字代表着 red green blue三种颜色的rgb值,0-255,最后一个是设定这个颜色的透明度即alpha值。范围从0到1,越接近1,代表透明度越低*/
margin-top: 50px;
opacity: 0;/*透明度*/
transition: all 1s ease;/*变形(transform)、转换(transition)和动画(animation)*/
}
li:hover .btn{
opacity: 1;
}
li:hover p{
color: blue;
}
</style>
</head>
<body>
<div class="box clear">
<div class="big_pic"></div>
<ul class="list clear">
<li><span class="btn"></span><p>大国外交</p></li>
<li><span class="btn"></span><p>大国外交</p></li>
<li><span class="btn"></span><p>大国外交</p></li>
<li><span class="btn"></span><p>大国外交</p></li>
<li><span class="btn"></span><p>大国外交</p></li>
<li><span class="btn"></span><p>大国外交</p></li>
</ul>
</div>
</body>
</html>
动画
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>无标题文档</title>
<style type="text/css">
#qw{
width:400px; height:300px;}
.div1{
width:200px; height:100px;
transform:translate(100px,20px);
background-color:#E90C10;}
.mydiv{
width:200px; height:100px;
background-color:#E90C10;
transform:rotate(-20deg);
}
.mydiv2{
width:200px; height:100px;
background-color:#E90C10;
transform:skew(20deg,15deg);
}
.mydiv3{
width:200px; height:100px;
background-color:#E90C10;
transform:scale(2,0.5);
}
#id{
text-align:center;
line-height:200px;
width:200px; height:200px;
border:1px solid #999;
padding:0 20px;
border-radius:100%;
box-shadow:3px 3px 4px 5px #18A15F;
text-shadow:7px 7px 5px #EF2A05;
font-size:28px;
background-color:#49ADD6;
}
</style>
</head>
<body>
<!--<div id="qw">
<div class="div1">位移</div>
<div class="mydiv">旋转</div>
<div class="mydiv2">扭曲</div>
<div class="mydiv3">缩放</div>
</div>-->
<div id="id">
文字
</div>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style>
*{
margin: 0;
padding: 0;
}
ul,li{
list-style: none;
}
.clear:after{/*在每个.class之后插入新内容*/
content: "\200B";
display: block;/*使段落生成行内框,每个框是一个块级元素*/
height: 0;
clear: both;/*是图像的左侧和右侧均不出现浮动*/
}
/*定义最外层盒子*/
.box{
padding: 10px;
border: 1px solid #000;
}
/*定义左侧大图片的样式*/
.big_pic{
width: 400px;
height: 400px;
background: #999;
float: left;
margin: 5px 0;
}
/*定义小图片集合样式*/
.list{
float: left;
width: 700px;
}
/*定义每一个小图片集合样式*/
.list li{
width: 200px;
height: 200px;
background: red;
float: left;
margin:5px 5px 0;
text-align: center;
}
/*定义小图片下方文字样式*/
p{
color: #fff;
text-align: center;
margin-top: 30px;
}
/*定义每一小个图片样式*/
.btn{
display: inline-block;/*定义行内块元素*/
width: 70px;
height: 70px;
border-radius: 50%;/*向 块级 元素添加圆角边框*/
background: rgba(0,0,0,.5);/*rgba括号中前3个数字代表着 red green blue三种颜色的rgb值,0-255,最后一个是设定这个颜色的透明度即alpha值。范围从0到1,越接近1,代表透明度越低*/
margin-top: 50px;
opacity: 0;/*透明度*/
transition: all 1s ease;/*变形(transform)、转换(transition)和动画(animation)*/
}
li:hover .btn{
opacity: 1;
}
li:hover p{
color: blue;
}
</style>
</head>
<body>
<div class="box clear">
<div class="big_pic"></div>
<ul class="list clear">
<li><span class="btn"></span><p>大国外交</p></li>
<li><span class="btn"></span><p>大国外交</p></li>
<li><span class="btn"></span><p>大国外交</p></li>
<li><span class="btn"></span><p>大国外交</p></li>
<li><span class="btn"></span><p>大国外交</p></li>
<li><span class="btn"></span><p>大国外交</p></li>
</ul>
</div>
</body>
</html>
动画
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>无标题文档</title>
<style type="text/css">
#qw{
width:400px; height:300px;}
.div1{
width:200px; height:100px;
transform:translate(100px,20px);
background-color:#E90C10;}
.mydiv{
width:200px; height:100px;
background-color:#E90C10;
transform:rotate(-20deg);
}
.mydiv2{
width:200px; height:100px;
background-color:#E90C10;
transform:skew(20deg,15deg);
}
.mydiv3{
width:200px; height:100px;
background-color:#E90C10;
transform:scale(2,0.5);
}
#id{
text-align:center;
line-height:200px;
width:200px; height:200px;
border:1px solid #999;
padding:0 20px;
border-radius:100%;
box-shadow:3px 3px 4px 5px #18A15F;
text-shadow:7px 7px 5px #EF2A05;
font-size:28px;
background-color:#49ADD6;
}
</style>
</head>
<body>
<!--<div id="qw">
<div class="div1">位移</div>
<div class="mydiv">旋转</div>
<div class="mydiv2">扭曲</div>
<div class="mydiv3">缩放</div>
</div>-->
<div id="id">
文字
</div>
</body>
</html>
相关文章推荐
- [js高手之路]html5 canvas动画教程 - 跟着鼠标移动消失的一堆炫彩小球
- unity3d实现一个人物跟随鼠标点击地面那点就移动那点,实现点击特效加人物动画方向的切换。
- html5跟随鼠标炫酷网站引导页粒子动画特效
- [js高手之路] html5 canvas动画教程 - 实时获取鼠标的当前坐标
- [JS实例] 跟随鼠标移动而发生视差动画的图片
- 在博客添加网页背景动画效果,跟随鼠标移动的线条
- CSS3实现鼠标移动到图片上图片变大(缓慢变大,有过渡效果,放大的过程是有动画过渡的,这个过渡的时间可以自定义)
- HTML5移动优先的响应式动画网格布局模板
- 使用JS实现气泡跟随鼠标移动的动画效果
- HTML5 Canvas火焰闪烁动画 火焰跟随鼠标
- html5学习-通过鼠标移动的圆球
- html5实现鼠标停在图片上出现动画效果
- HTML5 Canvas 获得鼠标的移动的坐标
- Unity3d当鼠标移动到按钮上,按钮做出响应动画
- 用仿ActionScript的语法来编写html5——第三篇,鼠标事件与游戏人物移动
- IE 下VML动画的奇怪现象:GWTCanvas基于定时器的图形动画当鼠标移动时停止动画效果(直接用VML写代码效果也一样)
- CSS3实现鼠标移动到图片上图片变大(缓慢变大,有过渡效果,放大的过程是有动画过渡的,这个过渡的时间可以自定义)
- 55-002-1 HTML5图片列表页面的制作 鼠标移动图片动态显示,文字动态阴影效果,渐变效果 列表前增加样式序列号
- javascript动画-鼠标移动到时隐藏块移出
- 基于css3的鼠标移动动画显示效果