You are here: Re: CSS will not center « HTML « IT news, forums, messages
Re: CSS will not center

Posted by Jukka K. Korpela on 07/21/07 20:54

Scripsit alice:

> Can someone tell me why, or for that matter how it's even possible,
> that text placed between this span with this class would not be
> centered?

The text-align property applies to block elements only. You could set
display: block, but...

> .heading {

.... since you really seem to have a heading, please read a good book on web
design, in order to get cured from SPANitis and DIVitis. When you then use
proper markup, such as <h1>...</h1> for the main heading, the problem
vanishes in a puff of logic (as a side effect, since h1 is block level by
default).

> font: small-caps normal 18px Georgia, "Times New Roman", Times,
> serif;

Did you know that browsers don't really use small-caps? They just fake it by
changing font size, making typographers aggravated.

The good book on web design will tell you why px is a wrong unit for
font-size. Use something like font-size: 140% instead.

> text-transform: uppercase;

Did you know that all-uppercase text is less readable and often ignored as
SHOUTING?

> text-decoration: underline;

The good book will tell you why should not underline anything that is not a
link.

> background: #232323;

What happens when the text color is #232323? Hint: It could be. You are
apparently not doing anything to prevent that.

> margin-right: auto;
> margin-left: auto; }

Horizontal margins have no effect on non-replaced inline elements, by CSS
specs.

> All the other attributes are working,

They are not attributes, and they mostly "work" for some odd values for
"work" only.

> What am I doing wrong?

To be honest, in this case, pretty much everything*). But it's curable.
There are many good books on web design. Hanging around in Usenet groups may
help a little, too.

*) However, the problem you regard as problem is easily fixable, as
mentioned. It's actually one of the _small_ problems.

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация