This could be another way to solve the same problem:
<style>
label + input[required] + span:after { content: " * "; }
</style>
<label for="name1">Name</label>
<input id="name1" type="text" required><span> </span>
However, the above does not work on IE6 (attribute selectors).
So the id/class suggested by Chris is actually the most cross-browser
solution.
Diego
On Sat, Aug 21, 2010 at 3:26 PM, Chris Cressman <[email protected]>wrote:
> > Why not make "required" an acceptable attribute for the label element?
>
> The class or title attribute can solve your problem:
>
> <label class="required">
> label.required:after {content:"*"}
>
> <label title="required">
> label[title~="required"]:after {content:"*"}
>