Skip to content

Instantly share code, notes, and snippets.

@xgqfrms-GitHub
Last active April 19, 2017 07:16
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xgqfrms-GitHub/60379c11ef1f5a2d584b4960323f491c to your computer and use it in GitHub Desktop.
Save xgqfrms-GitHub/60379c11ef1f5a2d584b4960323f491c to your computer and use it in GitHub Desktop.
transform & transition

transform

(only block element will have effect!)

https://developer.mozilla.org/en-US/docs/Web/CSS/transform

https://developer.mozilla.org/zh-CN/docs/Web/CSS/transform-function

https://developer.mozilla.org/zh-CN/docs/Web/CSS/transform-function/scale

** Multiple function values **

/* Keyword values */
transform: none;

/* Function values */
transform: matrix(1.0, 2.0, 3.0, 4.0, 5.0, 6.0);
transform: translate(12px, 50%);
transform: translateX(2em);
transform: translateY(3in);
transform: scale(2, 0.5);
transform: scaleX(2);
transform: scaleY(0.5);
transform: rotate(0.5turn);
transform: skew(30deg, 20deg);
transform: skewX(30deg);
transform: skewY(1.07rad);
transform: matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
transform: translate3d(12px, 50%, 3em);
transform: translateZ(2px);
transform: scale3d(2.5, 1.2, 0.3);
transform: scaleZ(0.3);
transform: rotate3d(1, 2.0, 3.0, 10deg);
transform: rotateX(10deg);
transform: rotateY(10deg);
transform: rotateZ(10deg);
transform: perspective(17px);

/* Multiple function values */
transform: translateX(10px) rotate(10deg) translateY(5px);

/* Global values */
transform: inherit;
transform: initial;
transform: unset;

/* div (block element) */

.add-fd-box {
    background: #2da2fc;
    border-radius: 2px;
    width: 140px;
    height: 40px;
    line-height: 40px;
    border-radius: 2px;
    margin-top: 5px;
    text-align: center;
    margin-left: calc(90% - 30px);
    cursor: pointer;
    .add-fd-btn {
        font-size: 16px;
        color: #ffffff;
        margin: 0 auto;
        text-decoration: none;
    }
    .add-fd-btn:hover{
        /* div (block element) */
        transform: scale(1.2) rotate(90deg);
        transition: all 1s 0.1s ease-in;
    }
    .add-fd-btn:before{
        content: '+';
    } 
}

OK

.add-fd-box {
    background: #2da2fc;
    border-radius: 2px;
    width: 140px;
    height: 40px;
    line-height: 40px;
    border-radius: 2px;
    margin-top: 5px;
    text-align: center;
    margin-left: calc(90% - 30px);
    cursor: pointer;
    .add-fd-btn {
        font-size: 16px;
        color: #ffffff;
        margin: 0 auto;
        text-decoration: none;
    }
    .add-fd-btn:hover{
        /* div (block element) */
        display: block;
        transform: scale(1.2) rotate(90deg);
        transition: all 1s 0.1s ease-in;
    }
    .add-fd-btn:before{
        content: '+';
    } 
}

transition

https://developer.mozilla.org/zh-CN/docs/Web/CSS/transition

CSS transform 属性 , 只对 block 级元素生效!

https://developer.mozilla.org/zh-CN/docs/Web/CSS/transform

@xgqfrms-GitHub
Copy link
Author

transform: scaleX(-1); & 左右翻转图片,镜像效果

https://gist.github.com/xgqfrms-GitHub/2cdd2244efed09e7be59dce8a90f3352

@xgqfrms-GitHub
Copy link
Author

Note: The size attribute works with the following input types: text, search, tel, url, email, and password.

注意:size属性适用于以下输入类型:文本,搜索,电话,网址,电子邮件和密码。

https://gist.github.com/xgqfrms-GitHub/41ef1ad64a7467c3d520ecadaaeaa5c8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment