The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS [Solved] Anchor and image inside of div Reply To: [Solved] Anchor and image inside of div


The only part that I didn’t understand in your edit of mine pen is that you added transform:translate(-50%,-50%); in .detail class. What does that do?

What it does is center the div based on it’s own width.

When you set top:50; left:50% on an object with position:absolute it puts the top-left corner of the div bang in the center of the div…which is not what is wanted.

The transform moves the element left (x) and up(y) by 50% of it’s own dimensions…regardless of the width / height of the element.