Home › Forums › CSS › [Solved] Anchor and image inside of div › Reply To: [Solved] Anchor and image inside of div
July 5, 2015 at 6:09 am
#204591
Member
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.