Flip / mirror an image horizontally + vertically with css

后端 未结 4 1453
后悔当初
后悔当初 2020-12-05 09:36

Im trying to flip an image to display it 4 ways : original (no changes), flipped horizontally, flipped vertically, flipped horizontally + verticly.

To do this Im do

4条回答
  •  一整个雨季
    2020-12-05 10:00

    Try this:

    .img-hor-vert {
        -moz-transform: scale(-1, -1);
        -o-transform: scale(-1, -1);
        -webkit-transform: scale(-1, -1);
        transform: scale(-1, -1);
    }
    

    Updated fiddle: https://jsfiddle.net/7vg2tn83/1/

    It wasn't working before because you were overriding the transform in your css. So instead of doing both, it just did the last one. Sort of like if you did background-color twice, it would override the first one.

提交回复
热议问题