|
|
|
|
Thread title: Centering my content in CSS/XHTML |
|
|
|
|
|
Thread tools
Search this thread
Display Modes
|
|
10-17-2005, 05:07 PM
|
#1
|
Status: Junior Member
Join date: Oct 2005
Location:
Expertise:
Software:
Posts: 35
|
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
|
Status: Lurker
Join date: Jul 2004
Location: the Netherlands
Expertise:
Software:
Posts: 1,074
|
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
|
Status: unusual suspect ™
Join date: Feb 2005
Location: Lancaster, PA from London UK
Expertise:
Software:
Posts: 1,814
|
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
|
Status: Request a custom title
Join date: Sep 2005
Location: Texas
Expertise:
Software:
Posts: 1,139
|
for #container use
position: absolute;
left: 213px;
instead of using margins.
|
|
10-17-2005, 05:22 PM
|
#5
|
Status: Junior Member
Join date: Oct 2005
Location:
Expertise:
Software:
Posts: 35
|
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
|
Status: design rockstar
Join date: Jan 2005
Location: guelph, ontario
Expertise:
Software:
Posts: 2,246
|
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
|
Status: Member
Join date: Oct 2005
Location: San Jose, CA
Expertise:
Software:
Posts: 433
|
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
|
Status: Lurker
Join date: Jul 2004
Location: the Netherlands
Expertise:
Software:
Posts: 1,074
|
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
|
Status: Junior Member
Join date: Oct 2005
Location:
Expertise:
Software:
Posts: 35
|
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
|
Status: Lurker
Join date: Jul 2004
Location: the Netherlands
Expertise:
Software:
Posts: 1,074
|
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>
|
|
|
|
|
|
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
|
|
|
|