内联属性样式中的CSS伪元素 [英] CSS pseudo-element in inline attribute style

查看:1321
本文介绍了内联属性样式中的CSS伪元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经尝试从下面的示例从url。我试图在内联属性,样式应用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%} 

这是一个带有内联样式属性规则的段落示例,用于创建点效果(spot effect),在这种情况下,是点滴式第一个字母。

< / p>


解决方案

这是不可能的。你所指的工作草案是12岁以上。点击链接最新版本,您会发现 CSS样式属性,W3C推荐(W3C标准)。它最近获得批准。它不像在HTML规范中那样改变 style 属性,这确实是消息:属性没有被增强,并且没有计划这样做。 / p>

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


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.

这篇关于内联属性样式中的CSS伪元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆