- From: Joshua Prowse <prowsej@fastmail.fm>
- Date: Thu, 8 Aug 2002 17:22:29 -0400
- To: <www-style@w3.org>
The following excerpt works in current browsers: (browsers apply the correct
[green] style because of the cascade)
<head>
<style type="text/css">P {color: red}</style>
<style type="text/css">P {color: green}</style>
</head>
<body>
<p>This is green text ...
The following excerpt also works in current browsers:
<body>
<p>This is the default paragraph style</p>
<div id="tOne">
<script type="text/javascript">
document.getElementById('tOne').style.color = "green";
</script>
<p>This text is green</p>
</div>
So why can't I do this:
<body>
<p>This is the default paragraph style</p>
<div id="tOne">
<style type="text/css">
#tOne {color:green;}
</style>
<p>This text should be green</p>
</div>
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
disadvantages.
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