I have tried with the sample below from the url. What I trying is to apply css pseudo-element in inline attribute, style. Somehow, it seems not working. I would appreciate for any advice.
http://www.w3.org/TR/2001/WD-css-style-attr-20010305
<p style="{color: green; width: 10em} ::first-letter {float: left; font-size: 300%}">
This is an example of a paragraph with inline style attribute rules to create a spot effect, in this case, a drop-cap first letter.
</p>
It’s not possible. The working draft you are referring to is over 12 years old. Click on the link “Latest version” in it, and you’ll find the CSS Style Attributes, a W3C Recommendation (“W3C standard”). It was approved recently. It contains no changes to the style
attribute as in HTML specs, and this is indeed the message: the attribute has not been enhanced, and there are no plans to do so.
The conclusions depend on why you would use the construct. Normally, just assign an id
attribute to the element and use an id
selector in CSS.
Try to do it this way
<p style="color: green; width: 10em"><span style="float: left; font-size: 300%">L</span>orem Ipsum</p>
来源:https://stackoverflow.com/questions/20138454/css-pseudo-element-in-inline-attribute-style