Centered div box

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View


First of all, I'm just starting to use CSS so I am by no means
experienced in this matter.
What I want is a "box" div element that always is centered on the page.
Now I just use the center tag around my boxes, but I'm pretty sure there
must be a way to include the center positioning into the style code.
Also I had some people complaining about the colours of my site. I'm
using red (#6B0000) links on a black background, and on my monitor it
absolutely looks fine, but some people seem te have difficulties reading
the text. Opinions please? Site is located at

Kind regards

Re: Centered div box

Quoted text here. Click to load it

Wrong group, stylesheet questions belong in
follow up set

Quoted text here. Click to load it /


Re: Centered div box

TomB wrote:

Quoted text here. Click to load it

<div style="width:60%;margin:0 20%">

comp.infosystems.www.authoring.stylesheets would have been a better place
for your query.

Toby A Inkster BSc (Hons) ARCS
Contact Me  ~

Re: Centered div box

TomB wrote:
Quoted text here. Click to load it

.box  { display: block;   /* box with visible border, background
white */
      margin-top: 1em;
      margin-left: auto; margin-right: auto;     /* to center it */
      width: 80%;
      background-color: #fff;
      border-color: #000;  
      border-style: solid;
      border-width: thin;
      padding: 2%;
      text-align: justify }

I would not have bothered since (as others point out), this is
really a question for comp.infosystems.www.authoring.stylesheets.
However, you also asked a colors question.  

You are specifying a dark red, not a true red (which would be
#ff0000).  Dark red text against a black background is indeed
difficult to see.  

Go to
<URL: .  Set
the Background to 000000 (black), Link to 6B0000 (your dark red),
and Active Link to ff0000 (true red).  Compare the Link with the
Active Link.  

In any case, if you define a color for Link, then you also need
contrasting colors for Visited Link and Active Link.  When
selecting colors, don't forget that a sizable population is
color-blind.  Don't put red text against a green background (or
vice versa), red-green being the most common form of
color-blindness (in which both appear gray).  Also, a lack of
contrast between the text and the background might cause problems
for someone who is dyslexic.  


David E. Ross

I use Mozilla as my Web browser because I want a browser that
complies with Web standards.  See <URL:>.

Re: Centered div box

David Ross wrote:
Quoted text here. Click to load it

You don't need to be dyslexic to have a problem with low-contrasting
colors. I see things like light gray text with a white background on
deezyner sites all the time. I don't know how *anyone* can read that
stuff. It's hard for me even at twice my normal text size. :(

Reply email address is a bottomless spam bucket.
Please reply to the group so everyone can share.

Re: Centered div box

kchayka wrote:
Quoted text here. Click to load it

Amen.  Poor quality monitors or bad lighting can make things difficult
to see even for those with perfect eyesight.  Using low contrast colours
for things that *should* stand out just adds to the problem.



Re: Centered div box

On Sun, 16 Oct 2005 11:56:02 +0200, TomB wrote:

Quoted text here. Click to load it

You are joking right?

There is no way I can read that unless I wind up the size so that there are
only seven words on the first line of text.

What's with all you Heavy metal nuts (no pun intended) black and red do not
go together!

Re: Centered div box

Rincewind wrote:
Quoted text here. Click to load it


That's really weird. I can read it without a problem. I must say however
that I calibrated my monitor with one of those test pattern DVDs, which
most likely causes my monitor to be set brighter than most people's.

Quoted text here. Click to load it

But it's so evil!!! :-)

Anyway, I'm gonna try some different colors now (suddenly I realize the
benefit of a stylesheet). I'll miss the red though...

Also thanks for the "box" suggestions. Sorry I asked it here, but I
wasn't aware that there is a seperate css ng...


Site Timeline