...

View Full Version : absolute positioning



esthera
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

VIPStephan
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.

esthera
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?

esthera
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

.x{

left:50px;
top:100px;
}

but it just stayed in teh top corner and ignored teh postiining of the span. why?

VIPStephan
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)

esthera
11-02-2006, 05:57 PM
thanks for your help -- this is what i needed to know.

one more thing --

if i have

<span class=three>
date is here<br>
This is site info<br>
and more

</span>

and the class is
.three{
position: relative;
left:360px;
top:148px

}

for some reason the first line of the thml is indented more then the rest.
why?

VIPStephan
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:

http://www.webreference.com/html/tutorial18/
http://www.brainjar.com/css/positioning/default2.asp

You probably don't need any positioning at all and should rather work with floats and margins to position your elements.

esthera
11-06-2006, 11:13 AM
I have my div with postion:relative;

then i have a span with the css of

.three{
position: relative;
left:360px;
top:148px

}

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?

VIPStephan
11-07-2006, 12:55 PM
Make the span position: absolute;?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum