Prevent children from inheriting rotate transformation in CSS

后端 未结 3 1261
误落风尘
误落风尘 2020-12-06 11:10

I am performing a CSS transform: rotate on a parent, yet would like to be able to negate this effect on some of the children - is it possible without using the reverse rotat

3条回答
  •  爱一瞬间的悲伤
    2020-12-06 11:57

    May be you have to write like this:

    .child {
        position: absolute;
        top: 30px;
        left: 50px;
        background-color: green;
        width: 70px;
        height: 50px;
        -webkit-transform: rotate(-30deg);
        -moz-transform: rotate(-30deg);
        -o-transform: rotate(-30deg);
        -ms-transform: rotate(-30deg);
        transform: rotate(-30deg);
    }
    

    Check this for more http://jsfiddle.net/XSHmJ/1/

    UPDATED

    You can sue :after & :before psuedo class for this.

    check this http://jsfiddle.net/XSHmJ/4/

提交回复
热议问题