CSS transform中的rotate的旋转中心怎么设置 您所在的位置:网站首页 css文字位置不变旋转怎么设置 CSS transform中的rotate的旋转中心怎么设置

CSS transform中的rotate的旋转中心怎么设置

2024-05-21 00:03| 来源: 网络整理| 查看: 265

2D的变形中的transform-origin属性可以是一个参数值,也可以是两个参数值。如果是两个参数值时,第一值设置水平方向X轴的位置,第二个值是用来设置垂直方向Y轴的位置。

3D的变形中的transform-origin属性还包括了Z轴的第三个值。其各个值的取值简单说明如下:

x-offset:用来设置transform-origin水平方向X轴的偏移量,可以使用和值,同时也可以是正值(从中心点沿水平方向X轴向右偏移量),也可以是负值(从中心点沿水平方向X轴向左偏移量)。 offset-keyword:是top、right、bottom、left或center中的一个关键词,可以用来设置transform-origin的偏移量。 y-offset:用来设置transform-origin属性在垂直方向Y轴的偏移量,可以使用和值,同时可以是正值(从中心点沿垂直方向Y轴向下的偏移量),也可以是负值(从中心点沿垂直方向Y轴向上的偏移量)。 x-offset-keyword:是left、right或center中的一个关键词,可以用来设置transform-origin属性值在水平X轴的偏移量。 y-offset-keyword:是top、bottom或center中的一个关键词,可以用来设置transform-origin属性值在垂直方向Y轴的偏移量。 z-offset:用来设置3D变形中transform-origin远离用户眼睛视点的距离,默认值z=0,其取值可以,不过在这里将无效。

看上去transform-origin取值与background-position取值类似。为了方便记忆,可以把关键词和百分比值对比起来记:

top = top center = center top = 50% 0 right = right center = center right = 100%或(100% 50%) bottom = bottom center = center bottom = 50% 100% left = left center = center left = 0或(0 50%) center = center center = 50%或(50% 50%) top left = left top = 0 0 right top = top right = 100% 0 bottom right = right bottom = 100% 100% bottom left = left bottom = 0 100%


【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有