css3学习笔记之2D转换
translate() 方法
translate()方法,根据左(X轴)和顶部(Y轴)位置给定的参数,从当前元素位置移动。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
<!DOCTYPE html> < html > < head > < style > div { width:100px; height:75px; background-color:red; border:1px solid black; } #div2 { transform:translate(50px,100px); } </ style > </ head > < body > < div >Hello. This is a DIV element.</ div > < div id = "div2" >Hello. This is a DIV element.</ div > </ body > </ html > |
rotate() 方法
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
<!DOCTYPE html> < html > < head > < style > div { width:100px; height:75px; background-color:red; border:1px solid black; } div#div2 { transform:rotate(45deg); } </ style > </ head > < body > < div >你好。这是一个 DIV 元素。</ div > < div id = "div2" >你好。这是一个 DIV 元素。</ div > </ body > </ html > |
scale() 方法
scale()方法,该元素增加或减少的大小,取决于宽度(X轴)和高度(Y轴)的参数:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
<!DOCTYPE html> < html > < head > < style > div { width:100px; height:75px; background-color:red; border:1px solid black; } div#div2 { margin:100px; transform:scale(2,4); } </ style > </ head > < body > < div >Hello. This is a DIV element.</ div > < div id = "div2" >Hello. This is a DIV element.</ div > </ body > </ html > |
skew() 方法
skew()方法,该元素会根据横向(X轴)和垂直(Y轴)线参数给定角度:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
<!DOCTYPE html> < html > < head > < style > div { width:100px; height:75px; background-color:red; border:1px solid black; } div#div2 { transform:skew(30deg,20deg) } </ style > </ head > < body > < div >Hello. This is a DIV element.</ div > < div id = "div2" >Hello. This is a DIV element.</ div > </ body > </ html > |
matrix() 方法
matrix()方法和2D变换方法合并成一个。
matrix 方法有六个参数,包含旋转,缩放,移动(平移)和倾斜功能。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
<!DOCTYPE html> < html > < head > < style > div { width:100px; height:75px; background-color:red; border:1px solid black; } div#div2 { transform:matrix(0.866,0.5,-0.5,0.866,0,0); } </ style > </ head > < body > < div >Hello. This is a DIV element.</ div > < div id = "div2" >Hello. This is a DIV element.</ div > </ body > </ html > |
新转换属性
以下列出了所有的转换属性:
Property | 描述 | CSS |
---|---|---|
transform | 适用于2D或3D转换的元素 | 3 |
transform-origin | 允许您更改转化元素位置 | 3 |
2D 转换方法
函数 | 描述 |
---|---|
matrix(n,n,n,n,n,n) | 定义 2D 转换,使用六个值的矩阵。 |
translate(x,y) | 定义 2D 转换,沿着 X 和 Y 轴移动元素。 |
translateX(n) | 定义 2D 转换,沿着 X 轴移动元素。 |
translateY(n) | 定义 2D 转换,沿着 Y 轴移动元素。 |
scale(x,y) | 定义 2D 缩放转换,改变元素的宽度和高度。 |
scaleX(n) | 定义 2D 缩放转换,改变元素的宽度。 |
scaleY(n) | 定义 2D 缩放转换,改变元素的高度。 |
rotate(angle) | 定义 2D 旋转,在参数中规定角度。 |
skew(x-angle,y-angle) | 定义 2D 倾斜转换,沿着 X 和 Y 轴。 |
skewX(angle) | 定义 2D 倾斜转换,沿着 X 轴。 |
skewY(angle) | 定义 2D 倾斜转换,沿着 Y 轴。 |
css3学习笔记之2D转换的更多相关文章
- css3学习总结7--CSS3 2D转换
CSS3 转换 通过 CSS3 转换,我们能够对元素进行移动.缩放.转动.拉长或拉伸. 2D 转换 在本次,您将学到如下 2D 转换方法: 1. translate() 2. rotate() 3. ...
- CSS3学习笔记(3)-CSS3边框
p{ font-size: 15px; } .alexrootdiv>div{ background: #eeeeee; border: 1px solid #aaa; width: 99%; ...
- 我的CSS3学习笔记
1.元字符使用: []: 全部可选项 ||:并列 |:多选一 ?: 0个或者一个 *:0个或者多个 {}: 范围 2.CSS3属性选择器: E[attr]:存在attr属性即可: E[attr=val ...
- CSS3学习笔记之linear-gradient
我觉得CSS3很不错,自己也稍微看过,并且尝试过一些属性.对我自己而言,我没有勇气说我学过CSS3,我觉得任何自己看来很小的事情,也只是站在自己的角度来评判.就算的是"简单的"HT ...
- CSS3 transform变形(2D转换)
transform 属性应用于2D 或 3D 转换.该属性允许我们对元素进行平移.旋转.缩放或倾斜. 一.translate(x,y).translateX(n).translateY(n)定义2D平 ...
- CSS3 学习笔记(边框 背景 字体 图片 旋转等)
边框 盒子圆角 border-radius:5px / 20%: border-radius:5px 4px 3px 2px; 左上,右上,右下,左下 盒子阴影 box-shadow:box-shad ...
- CSS3学习笔记1-选择器和新增属性
前言:之前自学了一些关于CSS3的知识,在学习过程中也遇到过坑,不过总算磕磕绊绊的学习完了关于CSS3的相关知识,于是最近把之前的笔记和代码整理了一下,也算是一个对CSS3知识的回顾复习吧,也希望能够 ...
- [CSS3] 学习笔记-CSS动画特效
在CSS3中,出现了很多出彩的效果,例如2D.3D以及过度.动画和多列等.这些效果为页面设计添加了很多的可选设计. 1.2D.3D转换 转换,是使元素改变尺寸.形状.位置的一种效果:通过CSS3转换, ...
- 十天精通CSS3学习笔记 part4
CSS3中的变形与动画(下) CSS3 Keyframes介绍 Keyframes 被称为关键帧,其类似于Flash中的关键帧.在CSS3中其主要以"@keyframes"开头,后 ...
随机推荐
- PP常用T-CODE
与BOM相关 CS00 BOM 菜单 BOM Menu CS01 生成物料 BOM Create Material BOM CS02 更改物料 BOM Change Material CS03 显示物 ...
- hdu 5533 Dancing Stars on Me 水题
Dancing Stars on Me Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.p ...
- Codeforces Round #318 [RussianCodeCup Thanks-Round] (Div. 1) A. Bear and Poker 分解
A. Bear and Poker Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/573/pro ...
- 使用VS2012 开发SharePoint 2013 声明式的action(activity) 综合实例
本文讲述使用VS2012 开发SharePoint 2013 声明式的action 综合实例. 需求同: http://blog.csdn.net/abrahamcheng/article/detai ...
- ios--uitextfield动态限制输入的字数(解决方式)
1.定义一个事件: -(IBAction)limitLength:(UITextField *)sender { bool isChinese;//推断当前输入法是否是中文 if ([[[UIText ...
- 元数据标签Embed
关于Embed外部资源的使用方法总结 Flex软件中经常需要使用一些外部的资源,如图片.声音.SWF或字体,虽然你也可以在软件运行的时候引入和载入,但是也可能经常需要直接将这些资源编译(Compile ...
- 用 Graphviz 可视化函数调用
http://www.ibm.com/developerworks/cn/linux/l-graphvis/
- 新一代 PHP 加速插件 Zend Opcache
参考:http://www.laogui.com/Zend-Opcache 大家知道目前PHP的缓存插件一般有三个:APC.eAccelerator.XCache,但未来它们可能都会消失,因为PHP ...
- 使用OPC的方式去连接PLC进行AB SLC-5_04数据的采集
1. 必备软件 Rslinx classic 2.57 .net framework 2.0 VS2013 OS: win7 enterprise x64 2. 软件安装 2.1.安装RSlinx ...
- 使用 MJ 自定义下拉刷新
// // ViewController.m // Refresh // // Created by Apple on 16/7/19. // Copyright © 2016年 mac. All r ...