...

View Full Version : Embedding pseudo-element styles



darkmage784
12-01-2005, 03:41 AM
How can I embed pseudo-element styles? I had read somewhere that you can do something like this:


<p style="{}:first-line{color:#DD9900;}">
nicely colored
just regular
</p>

but that doesn't seem to work. What is the correct way to do this?

*Must work in FF and IE.
**Embedded child, sibling, adjacent, etc. would also be nice to know.

rmedek
12-01-2005, 06:42 AM
I had read somewhere that you can do something like this:


<p style="{}:first-line{color:#DD9900;}">
nicely colored
just regular
</p>



hrmmmmm... I've never heard of this. Where did you read this? I don't know that I would use it but it sounds like an interesting technique. You could always try


<p style="first-line{color:#DD9900;}">
nicely colored
just regular
</p>

…and see if that would work (thinking that the element part of the pseudo element wouldn't be needed).

My immediate thoughts are that as long as you are embedding styles you might as well just use spans:


<p>
<span style="color:#DD9900;">nicely colored</span>
just regular
</p>

jkd
12-01-2005, 06:58 AM
http://www.w3.org/TR/2002/WD-css-style-attr-20020515

Being just a Working Draft, it isn't implemented (or even recommended to be implemented) in any browser.

rmedek
12-01-2005, 07:05 AM
Yowsers. Thanks jkd... it's interesting, a working draft from 2002! Some pretty neat ways of integrating embedded styles, especially along the lines of this:


3. Setting properties on a source anchor for each of its dynamic states, using pseudo-classes:

<a href="http://www.w3.org/"
style="{color: #900}
:link {background: #ff0}
:visited {background: #fff}
:hover {outline: thin red solid}
:active {background: #00f}">...</a>

…but again I don't know how useful that would be given the benefits of an external stylesheet. (except for, say, CMS output?)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum