W3C home > Mailing lists > Public > www-validator-css@w3.org > November 2006

Re: text-align

From: Jukka K. Korpela <jkorpela@cs.tut.fi>
Date: Mon, 20 Nov 2006 10:09:26 +0200 (EET)
To: Paul McLeod <pcmack@alltel.net>
cc: www-validator-css@w3.org
Message-ID: <Pine.GSO.4.64.0611200953380.16286@mustatilhi.cs.tut.fi>

On Sun, 19 Nov 2006, Paul McLeod wrote:

> I have the following statement in my css style sheet:

It's called a "rule", to use the CSS term.

> H2 {
> text-align:center;
> font-size:12pt;
> color:black;
> font-family:arial,sans-serif,helvetica;
> vertical-align:middle;
> font-weight:bold;
> padding:0 10px;
> }
> It will validate as shown.

Yes, it will "validate", i.e. no syntax errors are detected. There's a 
(useful) warning, though: "You have no background-color with your color : 
H2". In my opinion, there _should_ be a warning about using the 
vertical-align property for a block element and about a value like 12pt 
for the font-size property. For example, warnings like those you get from 
the WDG's CSS checker http://www.htmlhelp.com/tools/csscheck/
"Warning: The vertical-align property only applies to inline and 
table-cell elements."
"Warning: Absolute length units should not generally be used on the Web, 
since the physical properties of the output medium are almost always 

(There should be warnings about
too. Since specific font names are case-sensitive in principle, arial and 
helvetica should probably be spelled Arial and Helvetica. Moreover, there 
is no point in specifying Helvetica after sans-serif, since the sans-serif 
font name is generic. If there is no match for it, there is surely no 
Helvetica font available in the system. - But checking CSS becomes more 
and more complex as we move from purely syntactic checks to such issues.)

> However, if I put the text-align statement anywhere else in the 
> statement it will not.

If I move it past the font-size declaration for example, the style sheet 
still "validates". You must be doing something non-obvious. Posting the 
URL of a CSS document (or an HTML document referring to a CSS document) is 
generally a good idea when reporting suspected problems.

It's also a good idea to use a little more spaces than formally required 
in CSS, for readability. While color:blue and color: blue are equivalent, 
most people probably find the latter more readable.

> Also, if I add a color statement it will not validate.

If I add a color declaration into your style sheet, it still "validates", 
though (quite adequately) with a warning like
"Redefinition of color : H2"

Jukka "Yucca" Korpela, http://www.cs.tut.fi/~jkorpela/
Received on Monday, 20 November 2006 08:09:40 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:40:42 UTC