css technique to apply to a character within a matching tag
Given I have the following tag:
<label>Hello world *&l开发者_开发技巧t;/label>
Is there a way to apply a css to the "*" in all label tags?
In order you want to add anything after your label-element you could also use the following pseudo-element:
label:after {
content: "*";
}
To style the *
, you must wrap it in something:
<label>Hello world <span>*</span></label>
The CSS is simple:
label span {
color: red
}
If you don't need to support older versions of IE, then go with @Dude's answer.
Try putting it in a span with a class, yes just the *.
Since you can't style plain text, the common technique is just to put what you want in a span and give the span a name/id/class.
You can also do this inline with:
<label>Hello world <span style="position:absolute;font-family:blah">*</span></label>
精彩评论