tags:

views:

46

answers:

1

i would like to center a popup div how can i do that browser friendly????

this is the original a bit to the left.

<div class="popLayerWrapper">
    <div id="addBookmarksLayer" class="popLayer" style="left:260px; padding:30px;">
        <div class="closeLayer" >close</div>
        <div class="layerContent"></div>
    </div>
</div>
+1  A: 

Not sure I understand which part you want to center, but assuming the whole thing:

.popLayerWrapper {
   position: absolute;
   width: 40%;  /* could be anything */
   left: 50%;
   margin-left: -20%;  /* half of width */
   height: 40%;    /* again, could be anything */
   top: 50%;
   margin-top: -20%;  /* half of height */
}
Tim Hoolihan
thanks! position top isn't working in chrome
loo
to make sure it's on top, you may want to put something like:z-index: 10; in there too
Tim Hoolihan