1

我已尝试使用以下网址中的示例。我尝试的是在内联属性样式中应用 css 伪元素。不知何故,它似​​乎不起作用。我将不胜感激任何建议。

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>
4

2 回答 2

0

这是不可能的。您所指的工作草案已超过 12 年。单击其中的“最新版本”链接,您将找到CSS Style Attributes,一个 W3C 推荐(“W3C 标准”)。最近被批准了。它不包含styleHTML 规范中对属性的更改,这确实是消息:属性尚未增强,也没有计划这样做。

结论取决于您为什么要使用该构造。通常,只需为元素分配一个属性并在 CSS 中id使用选择器。id

于 2013-11-22T06:37:26.053 回答
-1

尝试这样做

<p style="color: green; width: 10em"><span style="float: left; font-size: 300%">L</span>orem Ipsum</p>
于 2013-11-22T06:35:18.363 回答