zoukankan      html  css  js  c++  java
  • 变形--位移 translate()

    translate()函数可以将元素向指定的方向移动,类似于position中的relative。或以简单的理解为,使用translate()函数,可以把元素从原来的位置移动,而不影响在XY轴上的任何Web组件。

    translate我们分为三种情况:

    1translate(x,y)水平方向和垂直方向同时移动(也就是X轴和Y轴同时移动)

     

    2translateX(x)仅水平方向移动X轴移动)

     

    3translateY(Y)仅垂直方向移动Y轴移动)

     

    实例演示:通过translate()函数将元素向Y轴下方移动50px,X轴右方移动100px

    HTML代码:

    <div class="wrapper">

      <div>我向右向下移动</div>

    </div>

    CSS代码:

    .wrapper {

       200px;

      height: 200px;

      border: 2px dotted red;

      margin: 20px auto;

    }

    .wrapper div {

       200px;

      height: 200px;

      line-height: 200px;

      text-align: center;

      background: orange;

      color: #fff;

      -webkit-transform: translate(50px,100px);

      -moz-transform:translate(50px,100px);

      transform: translate(50px,100px);

    }

    演示结果

     

     

  • 相关阅读:
    Mysql如何修改unique key
    centos 编译 安装 protobuf
    EasyNetQ简单使用
    微信发送模板消息
    Python删除开头空格
    代码积累-Common
    sql With(NoLock),With(ReadPast)
    webform 使用log4net配置
    log4net.dll添加报错
    js-小数计算问题
  • 原文地址:https://www.cnblogs.com/gulan/p/5819030.html
Copyright © 2011-2022 走看看