[whatwg] required attribute in label
Diego Perini
diego.perini at gmail.com
Sat Aug 21 07:07:13 PDT 2010
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 <chris at chriscressman.com>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:"*"}
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.whatwg.org/pipermail/whatwg-whatwg.org/attachments/20100821/a75cf8c8/attachment-0002.htm>
More information about the whatwg
mailing list