Re: Why is the style tag restricted to the head?

The following excerpt works in current browsers: (browsers apply the correct
[green] style because of the cascade)

        <style type="text/css">P {color: red}</style>
        <style type="text/css">P {color: green}</style>
        <p>This is green text ...

The following excerpt also works in current browsers:

    <p>This is the default paragraph style</p>
    <div id="tOne">
        <script type="text/javascript">
        document.getElementById('tOne').style.color = "green";
        <p>This text is green</p>

So why can't I do this:

    <p>This is the default paragraph style</p>
    <div id="tOne">
        <style type="text/css">
        #tOne {color:green;}
        <p>This text should be green</p>

Someone replied stating that this would force browsers to keep a representation
of the document in memory.  It would also result in flashing content when the
browser loads content and then comes across another <style> element later in the
document that causes previous content to have to be redrawn.  Those are

The main reason that I'd like something like this is because:
- I don't have access to the <head> of my documents.  For example, when I'm
posting on a UBB-style bulletin board or when I'm using a blogger tool I'd like
to be able to modify document style without being restricted to inline style=""
elements that don't allow for selectors.
- and Javascript syntax is clumsy for changing styles

Received on Thursday, 8 August 2002 17:22:34 UTC