W3C home > Mailing lists > Public > www-validator@w3.org > April 2005

Re: styles

From: Jukka K. Korpela <jkorpela@cs.tut.fi>
Date: Wed, 27 Apr 2005 08:30:59 +0300 (EEST)
To: Evan Clarke <evan@acfei.com>
Cc: www-validator@w3.org
Message-ID: <Pine.GSO.4.58.0504270827030.17344@korppi.cs.tut.fi>

On Tue, 26 Apr 2005, Evan Clarke wrote:

> I have been testing my site and there is a problem where the doctype
> does not allow styles to be set within the body tag.  Are styles only
> allowed to be set within the head tag or is there a way to keep the site
> w3c compliant while have styles set within the body tag?

Styles are allowed within the body tag:
<body style="font-family:Arial">

But you probably meant using a style element within the body _element_.
No, that's not allowed in any published DTD.

Usually the question arises in authoring environments where an
author cannot control what appears in the head element, only the body
element. The solution is to fix the environment.

Note that the really best way to use styles is to have a link element
(<link rel="stylesheet" type="text/css" href="...">) that refers to an
external style sheet, or several such elements. They need to appear in the
head element.

Jukka "Yucca" Korpela, http://www.cs.tut.fi/~jkorpela/
Received on Wednesday, 27 April 2005 05:31:07 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 1 March 2016 14:17:45 UTC