CSS3中transform屬性

來源:互聯網
上載者:User

在CSS3中,可以利用transform功能來實現文字或映像的旋轉、縮放、傾斜、移動這四種類型的變形處理。

一.rorate(旋轉)

用法:transform: rorate(45deg);

共一個參數“角度”,單位deg為度的意思,正數為順時針旋轉,負數為逆時針旋轉,上述代碼作用是順時針旋轉45度。

二.scale(縮放)

用法:transform: scale(0.5,3);

第一個參數表示水平方向上的縮放,第二個參數表示垂直方向的縮放倍數。

三.skew(傾斜)

用法:transform: skew(30deg, 30deg);

skew的預設原點是transform-origin是這個物件的中心點。

第一個參數表示水平方向上的傾斜角度,第二個參數表示垂直方向上的傾斜角度。

四.translate(移動)

用法:transform: translate(45px, 150px);

第一個參數表示在水平方向上移動45像素的距離,第二個參數表示在垂直反向上移動150像素的距離。

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.