zoukankan      html  css  js  c++  java
  • CSS: transforms

    CSS 2D Transforms

    CSS Transforms

    CSS transforms allow you to translate, rotate, scale, and skew elements.

    A transformation is an effect that lets an element change shape, size and position.

    CSS supports 2D and 3D transformations.

    • translate()
    • rotate()
    • scale()
    • skewX()
    • skewY()
    • matrix()

    The translate() Method

    The translate() method moves an element from its current position (according to the parameters given for the X-axis and the Y-axis).

    The following example moves the <div> element 50 pixels to the right, and 100 pixels down from its current position:

    transform: translate(50px, 100px);

    The rotate() Method

    The rotate() method rotates an element clockwise or counter-clockwise according to a given degree.

    The following example rotates the <div> element clockwise with 20 degrees:

    transform: rotate(20deg);

    The scale() Method

    The scale() method increases or decreases the size of an element (according to the parameters given for the width and height).

    The following example increases the <div> element to be two times of its original width, and three times of its original height: 

      transform: scale(1.5, 2.5);
    
      transform: scale(0.5, 0.5);

    The skewX() skewY() skew()Method(倾斜)

    The skewX() method skews an element along the X-axis by the given angle.

    The following example skews the <div> element 20 degrees along the X-axis:

    transform: skewX(20deg);
    transform: skewY(20deg);
    transform: skew(20deg,30deg);

    The matrix() Method

    he matrix() method combines all the 2D transform methods into one.

    The matrix() method take six parameters, containing mathematic functions, which allows you to rotate, scale, move (translate), and skew elements.

    The parameters are as follow: matrix(scaleX(),skewY(),skewX(),scaleY(),translateX(),translateY())

     
    transform: matrix(1, -0.3, 0, 1, 0, 0);

     

  • 相关阅读:
    网络流与线性规划24题 之 餐巾计划问题
    待刷题目分类(一)
    bzoj1787 [Ahoi2008]Meet 紧急集合
    Hoj2634 How to earn more?
    poj3281 Dining
    浅谈数论(三)水仙花数
    poj1637 Sightseeing tour
    动态规划的思考(1)
    网络流-最大流问题 ISAP 算法解释(转自Renfei Song's Blog)
    poj1273 Drainage Ditches
  • 原文地址:https://www.cnblogs.com/Nyan-Workflow-FC/p/10601266.html
Copyright © 2011-2022 走看看