Current location: Hot Scripts Forums » General Web Coding » CSS » div positioning


div positioning

Reply
  #1 (permalink)  
Old 05-16-05, 08:09 PM
koncept
Guest
 
Posts: n/a
Post div positioning

I have a background image in a div that i want to have centered but i also have two to three divs that go on top of it i need them to stay in the same place on the image, is there any way to do this using css positioning??

thanks in advance
Reply With Quote
  #2 (permalink)  
Old 05-17-05, 11:12 AM
kjmatthews kjmatthews is offline
Wannabe Coder
 
Join Date: Jun 2004
Location: Boston, MA
Posts: 134
Thanks: 0
Thanked 0 Times in 0 Posts
Yes. Set "position: relative" for the large div with the background image (which I assume contains the three smaller divs - if I'm wrong let me know). Then, you should be able to position the smaller divs precisely using position: absolute. Since their containing element is relatively positioned, they should not overflow its boundaries unless you set negative values for the absolute position.
Reply With Quote
  #3 (permalink)  
Old 05-17-05, 11:30 AM
koncept
Guest
 
Posts: n/a
Talking

would the same work if i only wanted to use a div on the left and right side using the same setup?

edit: thanks that works great.

Last edited by koncept; 05-17-05 at 11:52 AM.
Reply With Quote
  #4 (permalink)  
Old 05-17-05, 12:34 PM
kjmatthews kjmatthews is offline
Wannabe Coder
 
Join Date: Jun 2004
Location: Boston, MA
Posts: 134
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
would the same work if i only wanted to use a div on the left and right side using the same setup?
If I'm understand what you mean, then yes. You would position them as
Code:
div.left {position: absolute; left: 0; top: 0;}
div.right {position: absolute; right: 0; top: 0;}
Glad it's working!
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Div Scrolling dwoody CSS 2 12-28-06 07:59 PM
semi-dynamic div height changes koncept JavaScript 2 05-03-05 10:20 AM
Change width of div if another div is not present hockeykid JavaScript 2 12-08-04 07:27 PM
More problems with scrollable div Goon JavaScript 1 09-24-04 04:39 AM
Background positioning help please! Iriel CSS 1 07-23-04 08:30 AM


All times are GMT -5. The time now is 01:35 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.