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);

     

  • 相关阅读:
    Thinking Clearly about Performance
    国家统计局2018-10-30统计的最新的省市区
    Java 返回字符串中第一个不重复字符的下标 下标从0开始
    国际象棋的游戏规则
    Python语言之requests库
    VBS 自动发消息给对方
    Windows
    上海合计共有16个区一个县
    @RequestMapping中的注解
    Linux 中 /proc/kcore为啥如此之大
  • 原文地址:https://www.cnblogs.com/Nyan-Workflow-FC/p/10601266.html
Copyright © 2011-2022 走看看