I'm trying to create a rotated container, which can accept a background image.
The thing is, I'm trying to keep the original image proportions, so the image isn't skewed, but only cropped.
Here's a fiddle I've set up: http://jsfiddle.net/RyU9W/38/
HTML:
<div id="container" class="color-container">
<p>Colored Container</p>
</div>
<div class="sep"></div><div class="sep"></div>
<div id="container" class="image-container">
<p>Image Container</p>
</div>
CSS:
p {padding: 250px 0;}
.sep {margin: 250px 0;}
#container{background:none; position:relative;}
#container:before {
content: "";
position:absolute;
display:block;
width:100%;
height:100%;
padding: 100px 0;
z-index:-1;
-webkit-transform: skew(0deg, 4deg) translateZ(0);
transform: skew(0deg, 4deg) translateZ(0);
}
.color-container:before {background: royalblue;}
There's a colored container which is working perfectly, but with the image it wouldn't rotate correctly.
I'd appreciate any help!