|
|
|
|
Thread title: Absolute positioning within other DIVs |
|
|
|
|
|
Thread tools
Search this thread
Display Modes
|
|
06-14-2008, 09:19 AM
|
#1
|
Status: I'm new around here
Join date: May 2008
Location: Essex England
Expertise:
Software:
Posts: 7
|
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
|
Status: Junior Member
Join date: Jun 2008
Location:
Expertise:
Software:
Posts: 34
|
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
|
Status: I'm new around here
Join date: May 2008
Location: Essex England
Expertise:
Software:
Posts: 7
|
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
|
Status: Member
Join date: Jul 2006
Location: soundwave.
Expertise:
Software:
Posts: 379
|
HTML Code:
#div {
width: 101px; /* put real width there */
margin: 0 auto;
}
|
|
06-14-2008, 10:02 PM
|
#5
|
Status: Member
Join date: Jun 2008
Location: Buenos Aires, Argentina
Expertise: programming, wizardy
Software:
Posts: 165
|
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
|
Status: I'm new around here
Join date: Jun 2008
Location: New York, NY
Expertise:
Software:
Posts: 11
|
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
|
Status: Member
Join date: Jun 2007
Location:
Expertise:
Software:
Posts: 136
|
Originally Posted by MishieMoo
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
|
Status: I'm new around here
Join date: Sep 2006
Location: US
Expertise: html, css, photoshop
Software: photoshop, notepad, wordpress
Posts: 22
|
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!
|
|
|
|
|
|
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
|
|
|
|