这篇文章主要介绍了css3学习系列之移动属性详解,内容挺不错的,现在分享给大家,也给大家做个参考。
放缩
使用sacle方法实现文字或图像的放缩处理,在参数中指定缩放倍率,比如sacle(0.5)表示缩小50%,例子如下:
scale方法使用示例 p { width: 300px; margin: 150px auto; background-color: yellow; text-align: center; -webkit-transform: scale(0.5); -moz-transform: scale(0.5); -o-transform: scale(0.5); }示例文字
立即学习“前端免费学习笔记(深入)”;
另外,可以分别指定元素水平方向的放大倍率与垂直方向的放大倍率,例子如下:
scale方法使用示例 p { width: 300px; margin: 150px auto; background-color: yellow; text-align: center; -webkit-transform: scale(0.5,2); -moz-transform: scale(0.5,2); -o-transform: scale(0.5,2); }示例文字
立即学习“前端免费学习笔记(深入)”;
倾斜
使用skew方法来实现文字或图像的倾斜处理,在参数中分别指定水平方向上的倾斜角度与垂直方向上的倾斜角度,例如”skew(30deg,30deg)”表示水平方向上倾斜30度,垂直方向倾斜30度,例子如下:
skew方法使用示例 p { width: 300px; margin: 150px auto; background-color: yellow; text-align: center; -webkit-transform: skew(30deg, 30deg); -moz-transform: skew(30deg,30deg); -o-transform: skew(30deg,30deg); }示例文字
立即学习“前端免费学习笔记(深入)”;
旋转
使用rotate方法将元素进行旋转,共一个参数“角度”,单位deg为度的意思,正数为顺时针旋转,负数为逆时针旋转。例子如下:
对元素使用多重变形的示例 p { margin: 100px; width: 300px; background-color: yellow; text-align: center; -webkit-transform:rotate(30deg); -moz-transform:rotate(30deg); -o-transform:rotate(30deg); }示例文字
立即学习“前端免费学习笔记(深入)”;
移动
使用translate方法来将文字或图像进行移动,在参数中分别指定水平方向上的移动距离与垂直方向上的移动距离。例如:
translate方法使用示例 p { width: 300px; margin: 150px auto; background-color: yellow; text-align: center; -webkit-transform: translate(50px,50px); -moz-transform: translate(50px,50px); -o-transform: translate(50px,50px); }示例文字
立即学习“前端免费学习笔记(深入)”;
变形示例
示例1:
对元素使用多重变形的示例 p { width: 300px; background-color: yellow; text-align: center; -webkit-transform: translate(150px,200px) rotate(45deg) scale(1.5); -moz-transform: translate(50px,50px) rotate(45deg) scale(1.5); -o-transform: translate(50px,50px) rotate(45deg) scale(1.5); }示例文字
立即学习“前端免费学习笔记(深入)”;
这个例子是先移动,然后旋转,最后放缩
效果:

示例2:
对元素使用多重变形的示例 p { width: 300px; background-color: yellow; text-align: center; -webkit-transform:rotate(45deg) scale(1.5) translate(150px,200px); -moz-transform:rotate(45deg) scale(1.5) translate(150px,200px); -o-transform: rotate(45deg) scale(1.5) translate(150px,200px); }示例文字
立即学习“前端免费学习笔记(深入)”;
先旋转,然后在放缩,最后移动
效果:

从两个示例的运行结果中我们可以看出,元素在两个页面上所处于位置并不相同。我们来看看他们的的详细步骤:
第一个示例:
1) 首先向右移动150px,向下移动200px。
2) 然后旋转45度,并且放大1.5倍。
第二个示例:
1) 首先旋转45度,并且放大1.5倍。
2) 然后向右移动150px,向下移动200px。

以上就是本文的全部内容,希望对大家的学习有所帮助,更多相关内容请关注PHP中文网!
相关推荐:
CSS的table-layout属性的用法
关于css3的动画效果animate的使用说明及浏览器兼容的介绍
关于css的background-attachment属性的使用
以上就是css3中移动属性的分析的详细内容,更多请关注创想鸟其它相关文章!
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。
如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 chuangxiangniao@163.com 举报,一经查实,本站将立刻删除。
发布者:程序猿,转转请注明出处:https://www.chuangxiangniao.com/p/1610602.html
微信扫一扫
支付宝扫一扫