Reputation: 46919
Instead of image how to include a text saying required
<label class="req">Name:</label>
.req
{
//background-image:url(img/mandatory.jpg);
background-position:top right;
background-repeat:no-repeat;
padding-right:10px;
font-weight:bold;
}
Upvotes: 0
Views: 848
Reputation: 723618
If you don't want the background image at all, remove it, and use the :after
pseudo-element to insert the text:
.req:after {
content: '*';
}
If you need the background image as a fallback for older browsers (because IE7 and older don't recognize :after
), you'll have to resort to some CSS hack or something to apply it for older browsers (or just put the background image in a separate stylesheet with a conditional comment).
Upvotes: 2