Html+CSS transform屬性中的 translate屬性值

來源:互聯網
上載者:User

上一篇講了rotate,這一次我們再細講一下translate

 

下面我們從3個方面開始介紹:

 

1、translate(x,y)  水平方向和垂直方向同時移動

   取值x表示x軸過渡值  取值y表示y軸過渡值  ----如果沒有賦值,預設是0  預設以元素的中心點為基點,可以通過transform-origin進行基點的設定  x,y如果為負就反方向移動 Css代碼   translate(100px,200px);      
2、 translateX(<translation-value>)  通過給 x方向上的指定參數值,實現x軸方向上的移動。
Css代碼   translateX(100px);    

 

3、translateY(<translation-value>) 通過給y方向上的指定參數值,實現x軸方向上的移動。

 

Css代碼   translateY(200px);  

相關文章

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.