Forum Moderators: not2easy
#container {
margin:0 auto;
width:790px;
}
I want to position some text like this:
#positioned_text {
position:absolute;
left: 411px;
top: 119px;
}
But of course when the container div is auto centered then my left value is off and not positioned where I want.
Is there a trick to set the left using JS? Something like?
#positioned_text {
position:absolute;
left: (411 + (the_auto_margin_value)) px;
top: 119px;
}
[edited by: Demaestro at 3:34 pm (utc) on Mar. 23, 2009]
You were right.. adding position:relative to the container object did the trick.
The below now works and the positioned_text left and top values are relative to the containers position.
#container {
position:relative;
margin:0 auto;
width:790px;
}
#positioned_text {
position:absolute;
left: 411px;
top: 119px;
}