给定以下 HTML:
<div class="required">required only</div>
<div class="note">note only</div>
<div class="required note">required and note</div>
<div class="note required">note and required</div>
和 CSS:
.required:after { content: " *"; color: red; }
.note:after { content: " +"; color: red; }
Firefox 11 中的结果是:
required only *
note only +
required and note +
note and required +
如果提供了多个类(.required 和 .note),我希望将“*”和“+”都附加到元素上,这样:
required and note *+
note and required +*
这是否可能使用纯 CSS,如果可以,如何?
编辑:这是此示例的 jsfiddle 链接:http: //jsfiddle.net/xpZST/