I was going to answer a question tagged JQuery which got closed(off-topic).I created a fiddle to answer it. It is working just as I wanted it to, but the rotated divs do not look as I wanted them to.
It looks like >

Instead of this >

I am using perspective and rotateY for the rotate effect I have achieved till now. I just need help in CSS for this.