View Full Version : absolute positioning
11-02-2006, 10:36 AM
how do I set absolute positioning for a span but only within the div I am in?
without it looking to where it is the actual whole page
11-02-2006, 10:57 AM
I hope I understand this right: You want to position a span absolutely but it must stay within the borders of the containing div?
In that case you need to set position: relative for the div and then the span will be positioned according to the div's position.
11-02-2006, 11:00 AM
i want to position multiple span in 1 div all absolutely -- but in the next div again do the same thing but to that div and not to the whole page.
so i do position:relative for the div - but what about the span? (of do I just set the pixel amount in the span?) Is there anyway to easiily measure where something would go if I have a backround image and want to fill in set places?
11-02-2006, 11:22 AM
I tried but it didn't work - I set the div to be relative and then the span to be
but it just stayed in teh top corner and ignored teh postiining of the span. why?
11-02-2006, 02:36 PM
Yeah of course it stayed there because that only works in conjunction with positon: absolute/relative;. You almost got ist. Just apply position: absolute; to your spans and it should work.
In a nutshell:
div needs position: relative;
span needs position: absolute; and a specific position (top, left, right, bottom)
11-02-2006, 05:57 PM
thanks for your help -- this is what i needed to know.
one more thing --
if i have
date is here<br>
This is site info<br>
and the class is
for some reason the first line of the thml is indented more then the rest.
11-02-2006, 06:56 PM
You should learn about positioning, I guess, because there are some traps that especially inexperienced people always fall for.
Haven't read all through these sources but I think they will give you an idea:
You probably don't need any positioning at all and should rather work with floats and margins to position your elements.
11-06-2006, 11:13 AM
I have my div with postion:relative;
then i have a span with the css of
but when i add text or another span to the same div. the span moves over a bit - I want it to be always positioned in the same place in the div - no matter if things are added or not? how do i do this?
11-07-2006, 12:55 PM
Make the span position: absolute;?
Powered by vBulletin® Version 4.2.2 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.