"Matthias Hullin" <ne*******@matthiasREMOVETHIS.hullin.net> wrote in message
news:dc**********@news.uni-kl.de...
Hi,
I'm programming some PHP discussion board that is supposed to appear
inside
the content area of a proprietary CMS. As I need some more styles than the
standard stylesheet provides, I just added a <style> tag inside my HTML
code. It works fine in all the browsers I tested, but it seems to be more
of
a hack than a valid solution.
Of course I did some research, but without success. So here is my question
to you:
Do the HTML+CSS standards allow <style> tags inside the <body>?
<disclaimer>
I'm not a CSS or HTML guru so the following may contain errurs.
</disclaimer>
I did a test page with a <style> block in the <head> and another within the
<body> then tried to validate it as HTML4.01-Strict and received the
following results:
===================
Line 20, column 22: document type does not allow element "STYLE" here
<style type="text/css">
The element named above was found in a context where it is not allowed. This
could mean that you have incorrectly nested elements -- such as a "style"
element in the "body" section instead of inside "head" -- or two elements
that overlap (which is not allowed).
===================
Having said that, the browsers I use seem to allow <style> within the <body>
and the DOM explorer of Firefox1.0.6 shows two <style> blocks within the
<head> rather than one in the <head> and one in the <body>.
If you want to add styles within the <body> you use inline styles.
eg: <p style="font-style:italic">This is ITALIC, if your font supports
it.</p>