Today's Posts Follow Us On Twitter! TFL Members on Twitter  
Forum search: Advanced Search  
Navigation
Marketplace
  Members Login:
Lost password?
  Forum Statistics:
Forum Members: 24,254
Total Threads: 80,792
Total Posts: 566,471
There are 816 users currently browsing (tf).
 
  Our Partners:
 
  TalkFreelance     Design and Development     HTML/XHTML/DHTML/CSS :

Absolute positioning within other DIVs

Thread title: Absolute positioning within other DIVs
Closed Thread    
    Thread tools Search this thread Display Modes  
06-14-2008, 09:19 AM
#1
Christopher is offline Christopher
Status: I'm new around here
Join date: May 2008
Location: Essex England
Expertise:
Software:
 
Posts: 7
iTrader: 0 / 0%
 

Christopher is on a distinguished road

Send a message via MSN to Christopher

  Old  Absolute positioning within other DIVs

Okay, so I have my website all coded out, im using Absolute positioning. How can I then center my website. I have tried putting a wrapper around to center, but im guessing as I am using absolute positioning, it positions everything from the left, and not from the left of the wrapper div. Im guessing I have to use floats etc, but im not too sure how to use them, any ideas?

06-14-2008, 07:00 PM
#2
Swerls is offline Swerls
Status: Junior Member
Join date: Jun 2008
Location:
Expertise:
Software:
 
Posts: 34
iTrader: 0 / 0%
 

Swerls is on a distinguished road

Send a message via AIM to Swerls Send a message via MSN to Swerls Send a message via Yahoo to Swerls Send a message via Skype™ to Swerls

  Old

what i do is use tables
<table width="1024">
<tr><td align="center">content you want aligned</td></tr>

but if your using divs like not me, im sure there is a better way

06-14-2008, 08:21 PM
#3
Christopher is offline Christopher
Status: I'm new around here
Join date: May 2008
Location: Essex England
Expertise:
Software:
 
Posts: 7
iTrader: 0 / 0%
 

Christopher is on a distinguished road

Send a message via MSN to Christopher

  Old

Got to keep up with the times! Tables are bad :P

Im sure floats are the way to go, just need a helping hand.

06-14-2008, 08:46 PM
#4
Wildcard is offline Wildcard
Wildcard's Avatar
Status: Member
Join date: Jul 2006
Location: soundwave.
Expertise:
Software:
 
Posts: 379
iTrader: 12 / 100%
 

Wildcard is on a distinguished road

Send a message via MSN to Wildcard

  Old

HTML Code:
#div {
   width: 101px; /* put real width there */
   margin: 0 auto;
}

06-14-2008, 10:02 PM
#5
Mauro.Casas is offline Mauro.Casas
Mauro.Casas's Avatar
Status: Member
Join date: Jun 2008
Location: Buenos Aires, Argentina
Expertise: programming, wizardy
Software:
 
Posts: 165
iTrader: 8 / 100%
 

Mauro.Casas is on a distinguished road

Send a message via Skype™ to Mauro.Casas

  Old

Remember, if you use WildCard example you need to set a width, either in Pixels or Percentage, but you need to set it, otherwise it won't center it at all...

06-14-2008, 11:28 PM
#6
MishieMoo is offline MishieMoo
MishieMoo's Avatar
Status: I'm new around here
Join date: Jun 2008
Location: New York, NY
Expertise:
Software:
 
Posts: 11
iTrader: 0 / 0%
 

MishieMoo is on a distinguished road

Send a message via AIM to MishieMoo Send a message via MSN to MishieMoo

  Old

If you put position:relative; in the css of the wrapper, all the positioning should stay the same relative to each other. Absolute positions aren't completely absolute when they're contained in a relatively positioned wrapper, so doing this should help =)

06-15-2008, 02:11 AM
#7
insub2 is offline insub2
Status: Member
Join date: Jun 2007
Location:
Expertise:
Software:
 
Posts: 136
iTrader: 1 / 100%
 

insub2 is on a distinguished road

Send a message via AIM to insub2

  Old

Originally Posted by MishieMoo View Post
If you put position:relative; in the css of the wrapper, all the positioning should stay the same relative to each other. Absolute positions aren't completely absolute when they're contained in a relatively positioned wrapper, so doing this should help =)
this guy is absolutely correct. (...sorry)

add something like <div id="wrapper"> ... </div> to your HTML and #wrapper {width: *your width*; margin:0 auto; position:relative;}
that should have your page centered without having to redo your absolute positioned layout.

06-15-2008, 01:41 PM
#8
Ethan is offline Ethan
Ethan's Avatar
Status: I'm new around here
Join date: Sep 2006
Location: US
Expertise: html, css, photoshop
Software: photoshop, notepad, wordpress
 
Posts: 22
iTrader: 0 / 0%
 

Ethan is on a distinguished road

  Old

For a long time I could never seem to get div's to center inside wrapping divs, but just today I FINALLY figured it out! And I had to do a little extra for cross browsing.

goodluck!

Closed Thread    


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

  Posting Rules  
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump:
 
  Contains New Posts Forum Contains New Posts   Contains No New Posts Forum Contains No New Posts   A Closed Forum Forum is Closed