Hey guys!
I'm writing code for a website project of mine, and the layout calls for many layers, all centered.
To do the layers, I'm trying to use a few <div> sections as containers (using "position: relative"), and then having the actual layers overlapping using seperate <div>'s and position:absolute. But when I try to keep properties from the relative div, it doesn't transfer to the absolute div, in this case the centering.
I posted my code below, so you can see whats up.
<div style="text-align: center; position:relative; top:0px;">
<img src="images/body.png">
<p style="position:absolute; top:0px; z-index:1; color:white;">TEXT
</p>
</div>
SO here's my question:
How do I get a position:absolute to be centered?
Thanks a lot!
-Daniel
I'm writing code for a website project of mine, and the layout calls for many layers, all centered.
To do the layers, I'm trying to use a few <div> sections as containers (using "position: relative"), and then having the actual layers overlapping using seperate <div>'s and position:absolute. But when I try to keep properties from the relative div, it doesn't transfer to the absolute div, in this case the centering.
I posted my code below, so you can see whats up.
<div style="text-align: center; position:relative; top:0px;">
<img src="images/body.png">
<p style="position:absolute; top:0px; z-index:1; color:white;">TEXT
</p>
</div>
SO here's my question:
How do I get a position:absolute to be centered?
Thanks a lot!
-Daniel