html - How would I go about transforming like this in CSS? -


i want take this:

original

and shape this:

enter image description here

using css. i'm aware of css transforms, i'm not sure use. skew doesn't seem right, neither translate.

i recommend using combination of rotatex, perspective , scaley properties css3 transform:

img {     -moz-transform: perspective(600px) rotatex(45deg) scaley(1.3);     -o-transform: perspective(600px) rotatex(45deg) scaley(1.3);     -webkit-transform: perspective(600px) rotatex(45deg) scaley(1.3);     transform: perspective(600px) rotatex(45deg) scaley(1.3); } 

to adjust how slanted sides are, can increase or decrease extent of rotation along x axis.

the scaley property needed, if don't want image appear flat because being tilted away viewer.

see fiddle here - http://jsfiddle.net/teddyrised/gszve/

[edit]: sake of completeness, due fact using perspective cause image element transformed such spills out of original boundary, might want set margin/padding around element not obstruct surrounding content.


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -