CSS3元素旋转、缩放、移动或倾斜

代码:

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style type="text/css"> *{
margin: 0;
padding: 0;
}
.container{
width: 900px;
margin:0 auto;
}
header{
text-align: center;
line-height: 60px;
}
section{
width: 200px;
height: 200px;
border:2px solid #ddd;
float: left;
margin:10px;
border-radius: 10px;
background: #fff;
position: relative;
}
section h3{
width: 200px;
height: 200px;
text-align: center;
line-height: 120px;
color: blue;
background: rgba(0,0,0,0.1);
border-radius: 10px;
display: none;
position: absolute;
top:0;
left:0;
z-index: 9;
}
section:hover h3{
display: block;
} .content{
width: 100px;
height: 100px;
margin:50px;
border-radius: 10px;
background-image: linear-gradient(pink,gray);
transition: all 1s linear;
}
.box{
width: 100px;
height: 100px;
background: gray;
border-radius: 10px;
transition: all 1s linear;
}
.item:nth-of-type(1):hover .content{
transform:translate(50px,50px);
}
.item:nth-of-type(2):hover .content .box{
transform:translateX(50px);
}
.item:nth-of-type(3):hover .content .box{
transform:translateY(50px);
}
.item:nth-of-type(4):hover .content .box{
transform:perspective(300px) translateZ(-100px);
}
.item:nth-of-type(5):hover .content{
/*默认顺时针旋转,旋转中心为当前元素中心点*/
transform:rotate(360deg);
/*设置当前元素旋转中心点*/
/*transform-origin: 0 0;*/
}
.item:nth-of-type(6):hover .content{
transform:rotateX(360deg);
}
.item:nth-of-type(7):hover .content{
transform:rotateY(360deg);
}
.item:nth-of-type(8):hover .content{
transform:rotateZ(360deg);
}
.item:nth-of-type(9):hover .content{
transform:skew(60deg,60deg);
}
.item:nth-of-type(10):hover .content{
transform:scale(1.5,1.5);
}
.item:nth-of-type(11):hover .content{
transform:scaleX(2);
}
.item:nth-of-type(12):hover .content{
transform:scaleY(2);
}
.item:nth-of-type(13):hover .content{
/*在z轴上的位置已经按照z轴进行了缩放 - 它看起来更接近你,因此更大,但是实际的尺寸(宽度和高度)不变。*/
transform:perspective(300px) translateZ(-100px);
}
.item:nth-of-type(14):hover .content{
/*在z轴上的位置已经按照z轴进行了缩放 - 它看起来更接近你,因此更大,但是实际的尺寸(宽度和高度)不变。*/
transform:perspective(300px) scaleZ(10) translateZ(-100px);
}
.item:nth-of-type(15):hover .content{
transform:perspective(100px) rotateX(360deg);
}
.item:nth-of-type(16):hover .content{
transform:perspective(100px) rotateY(360deg);
}
</style>
</head>
<body> <div class="container"> <header>
<h2>transform属性</h2>
</header>
<section class="item">
<h3>translate平移2D</h3>
<div class="content"></div>
</section>
<section class="item">
<h3>translateX</h3>
<div class="content">
<div class="box"></div>
</div>
</section>
<section class="item">
<h3>translateY</h3>
<div class="content">
<div class="box"></div>
</div>
</section>
<section class="item">
<h3>translateZ</h3>
<div class="content">
<div class="box"></div>
</div>
</section>
<section class="item">
<h3>rotate旋转</h3>
<div class="content"></div>
</section>
<section class="item">
<h3>3D旋转 rotateX()</h3>
<div class="content"></div>
</section>
<section class="item">
<h3>3D旋转 rotateY()</h3>
<div class="content"></div>
</section>
<section class="item">
<h3>3D旋转 rotateZ()</h3>
<div class="content"></div>
</section>
<section class="item">
<h3>3D翻转 skew()</h3>
<div class="content"></div>
</section>
<section class="item">
<h3>放大 scloe()</h3>
<div class="content"></div>
</section>
<section class="item">
<h3>X轴放大 scaleX()</h3>
<div class="content"></div>
</section>
<section class="item">
<h3>Y轴放大 scaleY()</h3>
<div class="content"></div>
</section>
<section class="item">
<h3>Z轴放大缩小(右边对比图)</h3>
<div class="content"></div>
</section>
<section class="item">
<h3>Z轴放大缩小(越近越大,越远越小) scaleZ()</h3>
<div class="content"></div>
</section>
<section class="item">
<h3> 3D透视图perspective(n) X轴旋转</h3>
<div class="content"></div>
</section>
<section class="item">
<h3> 3D透视图perspective(n) Y轴旋转</h3>
<div class="content"></div>
</section>
</div>
</body>
</html>

实现效果:

【Demo】CSS3元素旋转、缩放、移动或倾斜的更多相关文章

  1. CSS3实现元素旋转

    -webkit-transform:rotate(30deg); 参数代表顺时针自旋转角度 这个元素还提供了文本倾斜的方法 - HTML5与CSS3 P299

  2. CSS3制作旋转导航

    慕课网学习CSS3时,遇到个习题,觉得有必要总结学习下:CSS3制作旋转导航 慕课网习题地址:http://www.imooc.com/code/1883 示例及源码地址:http://codepen ...

  3. css3制作旋转动画

    现在的css3真是强大,之前很多动画都是用jq来实现,但是css3制作的动画要比jq实现起来简单很多,今天呢,我自己也写了一个css旋转动画和大家分享.效果如下面的图片 思路:1.制作之前呢,我们先来 ...

  4. CSS3 3D旋转下拉菜单--兼容性不太好

    <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <m ...

  5. CSS3动画旋转——(图片360°旋转)

    今天在重构网页特效的时候,想着用到一个css3的旋转特效.简单来一个demo. html <div class="box"> <img src="./y ...

  6. osg矩阵变换节点-----平移旋转缩放

    osg矩阵变换节点-----平移旋转缩放 转自:http://www.cnblogs.com/ylwn817/articles/1973396.html 平移旋转缩放这个三个是osg矩阵操作中,最常见 ...

  7. 纯css3实现旋转的太极图

    效果图: 代码如下: <!DOCTYPE html> <html> <head lang="zh"> <meta charset=&quo ...

  8. osg中使用MatrixTransform来实现模型的平移/旋转/缩放

    osg中使用MatrixTransform来实现模型的平移/旋转/缩放 转自:http://www.cnblogs.com/kekec/archive/2011/08/15/2139893.html# ...

  9. CSS3实现旋转的太极图(二):只用1个DIV

    效果预览:   PS: 1.昨天用3个DIV实现了太极图(点击查看),,今天试着用1个Div来做. 2.公司刚忙过双10周年庆,最近空闲下来,闲着也是闲着,总得写点东西吧. 3.高手莫喷,小弟仅仅是没 ...

随机推荐

  1. rk3188 公板调试记录

    打开ccache后编译android果然快很多. make rk3188_sdk_defconfig 触摸屏有问题,然后再吧input底下的touchscreen 屏蔽掉     james@jame ...

  2. Crossed ladders---poj2507(二分+简单几何)

    题目链接:http://poj.org/problem?id=2507   题意就是给你x y c求出?的距离: h1 = sqrt(x*x-d*d); h2 = sqrt(y*y-d*d); (h1 ...

  3. Python开发【整理笔记】

    回顾笔记 学python半年,新知识不断填充,之前学的东西也忘的差不多,整理下笔记,把重点再加深下印象,算是读书拾遗吧.... 1.类继承.新式类.经典类 首先,新式类.经典类的概念只存在于Pytho ...

  4. java, android的aes等加密库

    https://github.com/scottyab/AESCrypt-Android https://github.com/PDDStudio/EncryptedPreferences       ...

  5. Openstack架构简介(一)

    1.1.1openstack介绍: openstack是(infrastructure as a service,基础设置即服务)IAAS架构的实现,OpenStack是一个由NASA(美国国家航空航 ...

  6. (转)二十三种设计模式及其python实现

    本文源码寄方于github:https://github.com/w392807287/Design_pattern_of_python 参考文献: <大话设计模式>——吴强 <Py ...

  7. [py]python中的==和is的区别

    is比较id id(a) == id(b) == id(c) a is d #false ==比较值 a==b #true 举个例子:a = 1 b = a c = 1 d = 1.0 这里有3个对象 ...

  8. R语言基本语法

    R语言基本语法 基本数据类型 数据类型 向量 vector 矩阵 matrix 数组 array 数据框 data frame 因子 factor 列表 list 向量 单个数值(标量)没有单独的数据 ...

  9. devise修改密码

    https://ruby-china.org/topics/1314 password/edit不是给你直接改密码用的 这个是忘记密码后,发送重置密码的邮件到你邮箱,同时生成一个token 然后你点那 ...

  10. Mybatis使用generatedKey在插入数据时返回自增id始终为1,自增id实际返回到原对象当中的问题排查

    今天在使用数据库的时候,遇到一个场景,即在插入数据完成后需要返回此数据对应的自增主键id,但是在使用Mybatis中的generatedKey且确认各项配置均正确无误的情况下,每次插入成功后,返回的都 ...