Forums

This topic is locked

How do I center a layer?

Posted 09 Jul 2008 12:04:27
1
has voted
09 Jul 2008 12:04:27 Josh Josh posted:
What do i put in here to center the layer?

#apDiv1 {
position:absolute;
width:548px;
height:574px;
z-index:1;
left: 239px;
top: 234px;
}

Replies

Replied 01 Aug 2008 15:37:30
01 Aug 2008 15:37:30 Miroslav Zografski replied:
Hi Josh,

if you really hang on on absolute positioning, then the story becomes too compicated. Here is centered div with absolute positioning:
<pre id=code><font face=courier size=2 id=code>
&lt;div style="position:absolute;width:100%;left:0;"&gt;
&lt;div style="width:200px;margin:10px auto"&gt;Content for New Div Tag Goes Here
&lt;/div&gt;
&lt;/div&gt;
</font id=code></pre id=code>
in this code you have a centered relative positioned div inside a container - absolute positioned div. In this case you have your content centered, but the draw back is that container has width =100% and overlaps, in this case entier row.
If you dont mind a relatively positioned div the only thing you need to care is it's container.

Regards,



M.Zografski

-----------------------------------
DMXZone.com Support Team
-----------------------------------

Reply to this topic