Re: HTML or CSS -- clarification needed

On Wed, Jul 02, 2003 at 08:24:09PM +0100, Ramanan Selvaratnam wrote:
> Got a sudden doubt on what is valid HTML and what is CSS.
> Hope I got the correct list for this.
> 
> If I were to write
> <h1><font color="red"><center>Birkbeck College</center></font> </h1>
> as
> <h1 style="text-align: center; color: red">Birkbeck College</h1>
> 
> I am still writing good HTML, am I not?

The first example is not HTML at all. <center> elements are not allowed
within <font> elements.

The second example is HTML with inline CSS (but it is valid).

Neither can really be considered "good"[1], the former for its lack of
validity, the latter for its use of inline style (the use of the style
attribute is discouraged in favour of external style sheets).

> Is it not the case that the latter is more compliant with modernising 
> efforts of *HTML* or am I getting confused with CSS which is sepearte so 
> the latter is HTML and CSS.

The latter is more compliant with the modernising efforts on HTML, as those
efforts are (or for the HTML 4.01 Strict spec at least) focused on
removing presentational aspects in favour of CSS -- but the example does
include both HTML and CSS.

[1] OK, that isn't true. "Good" is highly subjective. _I_ wouldn't consider
either of them good.

--
David Dorward

Received on Thursday, 3 July 2003 03:36:55 UTC