HTML(26)——平面转换-旋转-多重转换-缩放

旋转

属性:transform:rotate(旋转角度)

角度的单位是deg。

  • 取值为正,顺时针旋转
  • 取值为负,逆时针旋转

默认情况下,旋转的原点是盒子中心点

改变旋转的原点可以使用属性:**transform-origin:**水平原点位置 垂直原点位置

取值:

  • 方位名词(left,top,right,bottom,center)
  • 像素单位数值
  • 百分比

例如,要让图片绕右下角旋转

transfrom-origin: right bottom;

多重转换

多重转换技巧:先平移再转换

transfrom: translate() rotate();

复制代码
    .luntai {
      margin: 30px auto;
      width: 1100px;
      height: 200px;
      border: 3px solid #333;
    }

    img {
      transition: all 4s;
      width: 200px;
    }

    .luntai:hover img {
      transform: translate(700px) rotate(360deg);
    }

当鼠标移入盒子内,轮胎就会向右边滚动

缩放

写法:

transform:scale(缩放倍数);

transform: scale(X轴缩放倍数,y轴缩放倍数);

复制代码
    .box {
      width: 200px;
      height: 165.58px;
      margin: 100px auto;
      background-color: #333;
    }

    img {
      width: 100%;
      transition: all 1s;
    }

    img:hover {
      transform: scale(2);
    }

该方法是以中心为原点进行缩放,如果直接在hover里面改变图片的大小,则是以左上角为原点

倾斜

属性:transform:skew(xxdeg);

效果图:

相关推荐
lkbhua莱克瓦2411 小时前
JavaScript核心语法
开发语言·前端·javascript·笔记·html·ecmascript·javaweb
0思必得013 小时前
[Web自动化] Selenium中Select元素操作方法
前端·python·selenium·自动化·html
@大迁世界16 小时前
停止使用 innerHTML:3 种安全渲染 HTML 的替代方案
开发语言·前端·javascript·安全·html
大猫会长18 小时前
css中,由基准色提取其他变体
前端·javascript·html
@zulnger18 小时前
爬虫库之 requests_html,json
爬虫·html·json
seabirdssss1 天前
《bootstrap is not defined 导致“获取配置详情失败”?一次前端踩坑实录》
前端·bootstrap·html
我是伪码农1 天前
轮播图案例
css·html·css3
WordPress学习笔记2 天前
解决Bootstrap下拉菜单一级链接无法点击的问题
前端·bootstrap·html
0思必得02 天前
[Web自动化] Selenium元素定位
前端·python·selenium·自动化·html
0思必得02 天前
[Web自动化] Selenium元素属性和方法
前端·python·selenium·自动化·html