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,472
There are 1384 users currently browsing (tf).
 
  Our Partners:
 
  TalkFreelance     Design and Development     HTML/XHTML/DHTML/CSS :

Centering my content in CSS/XHTML

Thread title: Centering my content in CSS/XHTML
Closed Thread  
Page 1 of 3 1 2 3 >
    Thread tools Search this thread Display Modes  
10-17-2005, 05:07 PM
#1
At-Studios is offline At-Studios
At-Studios's Avatar
Status: Junior Member
Join date: Oct 2005
Location:
Expertise:
Software:
 
Posts: 35
iTrader: 0 / 0%
 

At-Studios is on a distinguished road

  Old  Centering my content in CSS/XHTML

Well I did some coding the other day. I did it all perfect as it seemed Valid, Tableless, Error free XHTML!

But then I viewed my work and I got my background image to center perfect, but for some reason I cant get my Content to center with it. I tired inputing my own "px" poistion and it works fine with my resoultion, but mucks up in other screen sizes.

I was wondering if anyone could take a look at it and tell me how to center my content with the background image?

Regards;
Justin

http://www.atstudios.roxr.com/sale/001/index.html
http://www.atstudios.roxr.com/sale/001/working.css

10-17-2005, 05:12 PM
#2
Aros is offline Aros
Aros's Avatar
Status: Lurker
Join date: Jul 2004
Location: the Netherlands
Expertise:
Software:
 
Posts: 1,074
iTrader: 2 / 100%
 

Aros is on a distinguished road

  Old

You're probably better off using 2 DIVs to center a content, one for the actual centering and 1 being the container;

HTML Code:
<div align="center">
<div class="container">
content
</div>
</div>
Although don't forget to set a width and text-align: left within the CSS selector of 'container'.

10-17-2005, 05:13 PM
#3
seen.to is offline seen.to
seen.to's Avatar
Status: unusual suspect ™
Join date: Feb 2005
Location: Lancaster, PA from London UK
Expertise:
Software:
 
Posts: 1,814
iTrader: 0 / 0%
 

seen.to is on a distinguished road

  Old

Use the search button at the top of the page... this has already been answered a few times.

10-17-2005, 05:14 PM
#4
Dray is offline Dray
Dray's Avatar
Status: Request a custom title
Join date: Sep 2005
Location: Texas
Expertise:
Software:
 
Posts: 1,139
iTrader: 0 / 0%
 

Dray is on a distinguished road

  Old

for #container use

position: absolute;
left: 213px;

instead of using margins.

10-17-2005, 05:22 PM
#5
At-Studios is offline At-Studios
At-Studios's Avatar
Status: Junior Member
Join date: Oct 2005
Location:
Expertise:
Software:
 
Posts: 35
iTrader: 0 / 0%
 

At-Studios is on a distinguished road

  Old

Originally Posted by seen.to
Use the search button at the top of the page... this has already been answered a few times.
ok, Sorry about that.

Thanks everyone for the help

10-17-2005, 06:42 PM
#6
derek lapp is offline derek lapp
Status: design rockstar
Join date: Jan 2005
Location: guelph, ontario
Expertise:
Software:
 
Posts: 2,246
iTrader: 0 / 0%
 

derek lapp is on a distinguished road

  Old

Originally Posted by Dray
for #container use

position: absolute;
left: 213px;

instead of using margins.
because 213 is center?

#container {
width: $width;
margin: 0 auto;
}

<div id="container">look at me i'm centered</div>

10-17-2005, 09:43 PM
#7
secondmode is offline secondmode
secondmode's Avatar
Status: Member
Join date: Oct 2005
Location: San Jose, CA
Expertise:
Software:
 
Posts: 433
iTrader: 0 / 0%
 

secondmode is on a distinguished road

Send a message via AIM to secondmode Send a message via MSN to secondmode

  Old

Originally Posted by Aros
You're probably better off using 2 DIVs to center a content, one for the actual centering and 1 being the container;

HTML Code:
<div align="center">
<div class="container">
content
</div>
</div>
Although don't forget to set a width and text-align: left within the CSS selector of 'container'.
HTML Code:
<div class="container" align="center">content</div>
would work better..

10-17-2005, 09:51 PM
#8
Aros is offline Aros
Aros's Avatar
Status: Lurker
Join date: Jul 2004
Location: the Netherlands
Expertise:
Software:
 
Posts: 1,074
iTrader: 2 / 100%
 

Aros is on a distinguished road

  Old

Originally Posted by KmXc14
HTML Code:
<div class="container" align="center">content</div>
would work better..
That won't work. You can't center a DIV element on it's own, you need a parent element to define the center alignment.

10-17-2005, 10:19 PM
#9
At-Studios is offline At-Studios
At-Studios's Avatar
Status: Junior Member
Join date: Oct 2005
Location:
Expertise:
Software:
 
Posts: 35
iTrader: 0 / 0%
 

At-Studios is on a distinguished road

  Old

Another question. I've done all of the things you guys recommened; And, it doesnt seem to work =/

10-17-2005, 10:27 PM
#10
Aros is offline Aros
Aros's Avatar
Status: Lurker
Join date: Jul 2004
Location: the Netherlands
Expertise:
Software:
 
Posts: 1,074
iTrader: 2 / 100%
 

Aros is on a distinguished road

  Old

Originally Posted by At-Studios
Another question. I've done all of the things you guys recommened; And, it doesnt seem to work =/
My suggestion can't not work, I always use it and has never failed for me. You don't need any margin or relative/absolute positioning;

HTML Code:
<div align="center">
<div style="width:200px;border:1px solid #000000;text-align:left">Try it for yourself</div>
</div>

Closed Thread  
Page 1 of 3 1 2 3 >


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

  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