0

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;
     }

1 Answer 1

2

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).

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.