Last Updated: February 25, 2016
· grant

Rotating Images/Divs

I'm currently rebuilding my portfolio and as part of that I'm pulling in 3 images from Instagram, it then positions the UL relative and all the LI's absolute so the sit on top of each other.

To get a stacked image effect I rotate each of those images separability using :nth-child()

.instagram li:nth-child(1) {
    -webkit-transform: rotate(20deg);
    -moz-transform: rotate(20deg)
    -ms-transform: rotate(20deg);
    -o-transform: rotate(20deg)
    filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=3);

The problem is the support for :nth-child() in Firefox 3. If this in a problem simply use a unique class instead on to these 3 list items and use that instead of nth-child.

Here is the result


This is my first coderwall post, hope you enjoy the tip.

5 Responses
Add your response

Psst, it should be -webkit-transform: rotate(20deg); not webkit-transform: rotate(20deg);

over 1 year ago ·

@rachelnabors Oops, thank you very kindly :)

over 1 year ago ·

Nice one :)

over 1 year ago ·

I could be wrong, but :nth-child() also does not appear to be supported in IE <= 8, so filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=3); might not matter here, unless you also want to use the same fix for FF3.

over 1 year ago ·

Didn't think of "stacking" images like CDs, thanks for the tip and the inspiration.

over 1 year ago ·