html - How would I go about transforming like this in CSS? -
i want take this:
and shape this:
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
Post a Comment