Click here to get back home

CSS simple question?

 HomeNewsGroups | Search | About
 comp.infosystems.www.authoring.html    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
CSS simple question? hzgt9b 11-21-2007
Posted by hzgt9b on November 21, 2007, 10:11 am
Please log in for more thread options
Using CSS I want to center a DIV on the page and always keep it 3px
from the top. Seems simple but I cannot find a cross-browser solution
to this problem. I can get to work in IE or FF but not both w/o
relaxing the 3px from the top constraint. Can someone offer a solution
to this problem?


Posted by Roderik on November 21, 2007, 11:19 am
Please log in for more thread options
hzgt9b schreef:
> Using CSS I want to center a DIV on the page and always keep it 3px
> from the top. Seems simple but I cannot find a cross-browser solution
> to this problem. I can get to work in IE or FF but not both w/o
> relaxing the 3px from the top constraint. Can someone offer a solution
> to this problem?
>

body {
text-align: center;
}
#container {
top: 3px;
width: 700px;
margin: 0 auto;
text-align: left;
}

Posted by Jonathan N. Little on November 21, 2007, 4:07 pm
Please log in for more thread options
Roderik wrote:
> hzgt9b schreef:
>> Using CSS I want to center a DIV on the page and always keep it 3px
>> from the top. Seems simple but I cannot find a cross-browser solution
>> to this problem. I can get to work in IE or FF but not both w/o
>> relaxing the 3px from the top constraint. Can someone offer a solution
>> to this problem?
>>
>
> body {
> text-align: center;
> }

This is incorrect. text-align property aligns *text* not block elements.
To center a block element within its container set a width to the block
element and set the right and left margins to auto...

> #container {
> top: 3px;
> width: 700px;
> margin: 0 auto;
> text-align: left;
> }

The problem most likely is IE's 3-pixel bug and your solution relies on
quirks mode so it is unlikely to solve the problem

--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com

Posted by Beauregard T. Shagnasty on November 21, 2007, 11:19 am
Please log in for more thread options
hzgt9b wrote:

> Using CSS I want to

..not multi-post. Cross-post only if absolutely necessary. You have
answers in alt.html (This is Usenet, not Google Groups.)

http://oakroadsystems.com/genl/unice.htm#xpost

--
-bts
-Motorcycles defy gravity; cars just suck

Similar ThreadsPosted
got a simple question on iframe and scrolling? October 21, 2004, 5:37 am
simple question but causing headaches? May 9, 2006, 7:42 pm
How to call a simple perl script from HTML without need of HTTPS but simple HTTP ? May 11, 2006, 4:36 am
Another FTP opinion" Simple FTP 2.0 October 5, 2005, 12:28 am
ASP simple explanation anyone March 10, 2005, 3:40 pm
simple height 20% February 6, 2006, 3:07 pm
Simple fix..validation errors at W3C... November 19, 2004, 5:14 am
No simple alternative to EMBED March 13, 2005, 6:38 pm
Not succeeding doing a simple thing ... April 3, 2005, 8:45 pm
Simple Open Source CMS January 23, 2006, 9:00 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap