I find it difficult to understand how I can calculate the extra height of the div container caused by skew. I mask the image inside the container and resize it using a plugin .
Containers will not always have the same height and width, so using fixed sizes will not work. I am not very good at math, so I would appreciate any direction or help.
See the demo. http://jsfiddle.net/RyU9W/6/
HTML
<div id="profiles" class="container"> <div class="profile"> <div class="image"> <img src="http://placekitten.com/g/750/750" alt=""> </div> <div class="detail"> </div> </div> <div class="profile"> <div class="image"> <img src="http://placekitten.com/g/750/750" alt=""> </div> <div class="detail"> </div> </div> <div class="profile"> <div class="image"> <img src="http://placekitten.com/g/750/750" alt=""> </div> <div class="detail"> </div> </div> <div class="profile"> <div class="image"> <img src="http://placekitten.com/g/750/750" alt=""> </div> <div class="detail"> </div> </div> <div class="profile"> <div class="image"> <img src="http://placekitten.com/g/750/750" alt=""> </div> <div class="detail"> </div> </div> <div class="profile"> <div class="image"> <img src="http://placekitten.com/g/750/1200" alt=""> </div> <div class="detail"> </div> </div> </div>
CSS
#profiles { margin-top: 300px; transform:skewY(-30deg); -ms-transform:skewY(-30deg); -webkit-transform:skewY(-30deg); } .profile { cursor: pointer; float: left; width: 32.25%; margin: 0.5%; position: relative; } .profile .image { position: relative; overflow: hidden; height: 400px; background: #000; backface-visibility:hidden; -webkit-backface-visibility:hidden; -moz-backface-visibility:hidden; -ms-backface-visibility:hidden; } .profile .image * { position: relative; transform:skew(0deg,30deg); -ms-transform:skew(0deg,30deg); -webkit-transform:skew(0deg,30deg); }
source share