nil nil - 10 months ago 70
HTML Question

Centering a div?

For some reason, whatever I try, I can't get this div to center. I've been researching probably for about an hour and can't seem to find something that will get it to center.

Here's what it looks like right now:

and here's the CSS:

.primary-container {
position: absolute;
width: 294px;
min-height: 110px;
background: #transparent;
z-index: 300000;
left: 50%;
top: 50%;
margin-left: auto;
margin-right: auto;

EDIT: Guess I didn't research hard enough. Sorry!


Try to add this to your css:

-webkit-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);