Centering absolutely positioned things

Recently I found that I needed a different way to center some elements that were absolutely positioned with in a div.

I found an article on CSS Tricks that allowed me to do just what I needed. I only need it centered horizontally.

Play with this gist on SassMeister.

The transform: translateX(-50%); is where the goodies are.

In the case I was solving for, there was a sibling div that was being used as the separator and was positioned absolutely as well.

Ray Pierce

Web Developer, RetailMeNot, Mentor, NodeBot builder, Texan

Austin, TX Ya'll http://digitalpierce.com
comments powered by Disqus