Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to show asterisk sign before label start when label has fixed width

Tags:

html

css

I want to show asterisk sign before my label indicating it is a mandatory field. following is my css id code for label,

#label{
    float: left;
    height: 30px;
    padding-right: 4px;
    padding-top: 2px;
    position: relative;
    text-align: right;
    vertical-align: middle;
    width: 73px;
}

output of above is, * Label but I want it to be like, *Label Thanks

like image 612
Prasad Avatar asked Oct 31 '12 08:10

Prasad


1 Answers

Use :before pseudo class

     .label:before{
     content:"*" ;
     color:red   
     }

Or

    #req:before{
    content:"*" ;
    color:red    
    }
​

DEMO Updated

like image 120
Sowmya Avatar answered Sep 22 '22 04:09

Sowmya