• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
osimly
博客园    首页    新随笔    联系   管理    订阅  订阅

CSS3:transform translate transition 这些都是什么?

transform:一个属性名称,即CSS3 2D转换 属性。

translate:一个属性函数,用法是translate(dx,dy)

1 div
2 {
3     transform: translate(50px,100px);
4 }

transition:一个属性名称,添加过渡效果。

1 div
2 {
3     width: 200px;
4     transition: width 2s;
5 }
6 
7 div:hover{
8     width: 300px;
9 }

还有动画animate:

 1 @keyframes myfirst
 2 {
 3     from {background: red;}
 4     to {background: yellow;}
 5 }
 6 
 7 div
 8 {
 9     animation: myfirst 5s;
10 }

把 transform 丢到 keyframe 的 from / to 里面就可以实现炫酷的效果。

posted @ 2016-09-05 15:59  osimly  阅读(297)  评论(0)    收藏  举报
刷新页面返回顶部
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3