使用 CSS 沿 y 轴变换元素

cssweb developmentfront end technology更新于 2025/4/5 6:04:17

使用 transformY(n) 方法沿 y 轴变换元素。

语法如下:

translateY(n)

其中 n 是表示平移向量横坐标的长度。

示例

示例如下 −

div {
   width: 50px;
   height: 50px;
   background-color: black;
}
.trans {
   transform: translateY(20px);
   background-color: orange;
}

相关文章


有用资源