Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Div next to div

Status
Not open for further replies.

gwar2k1

Programmer
Apr 17, 2003
387
GB
Im having trouble positioning two divs next to each other. I cant use position: absolute for this task, and relative doesn't work. Does any one have suggestions?

TIA

~*Gwar3k1*~
"To the pressure, everything's just like: an illusion. I'll be losing you before long..."
 
actually doesnt matter, i placed one ontop of another (the one on the bottom being width: 100%, the one ontop being width: 50% does the trick =)

But if any one knows a work around itd be nice


~*Gwar3k1*~
"To the pressure, everything's just like: an illusion. I'll be losing you before long..."
 
that was it! =) cheers. i asked this question many months ago and couldnt find it via search. since then ive also lost my source libraries so i had to ask. thanks =D

~*Gwar3k1*~
"To the pressure, everything's just like: an illusion. I'll be losing you before long..."
 

You could also use both position:absolute and position:relative to achieve the same goal.

Just so you know ;o)

Dan
 
yeah i know but i couldnt use the absolute on this page =P

~*Gwar3k1*~
"To the pressure, everything's just like: an illusion. I'll be losing you before long..."
 

To use position:absolute, sometimes you have to wrap your element inside another, and give that outer element either absolute or relative positioning... Not doing that could cause your absolute position to be relative to the window coordinates, not it's usual position.

Dan
 
good man =D when you saw wrap how to do you mean?

<div>
<div 2>
</div 2>
</div>

like that? thats how i normally do it

~*Gwar3k1*~
&quot;To the pressure, everything's just like: an illusion. I'll be losing you before long...&quot;
 
Hey my site made it as an example!

I could have set both divs to float left if I wanted and I can't really remember why I made one float left and one float right!

I think when I was experimenting with a layout using percentages it was easier to float it on the right than try to get it aligned on the left.

gwar3k1: your wrapping example is correct and thanks for spotting my bad grammer. You get a star!

MrBelfry
 
lol no problem, thanks for the star! my first ever woop! Ive been here almost 3 years now lol (cant log in as gwar3k1 so my 2k1 account will give a different length of time).

I cant believe it, star on tek-tips AND feedback + editing of a site based on a comment i made. woop! sorry i didnt mean to make you go to that extreme, it just chuckled me because its correct according to the rules but just isnt right lol

~*Gwar3k1*~
&quot;To the pressure, everything's just like: an illusion. I'll be losing you before long...&quot;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top