What is a good way to overcome the unfortunate fact that this code will not work as desired:
You can achieve the desired result by encapsulating the HTML code in a div tag which contains the "required' class followed by the "form-group" class. *however this works only if you have Bootstrap.
<div class="form-group required">
<div class="required">
<label>Name:</label>
<input type="text">
</div>
<div>
.required label {
font-weight: bold;
}
.required label:after {
color: #e32;
content: ' *';
display:inline;
}
Fiddle with your exact structure: http://jsfiddle.net/bQ859/
To put it exactly INTO input as it is shown on the following image:
I found the following approach:
.asterisk_input::after {
content:" *";
color: #e32;
position: absolute;
margin: 0px 0px 0px -20px;
font-size: xx-large;
padding: 0 5px 0 0; }
<form>
<div>
<input type="text" size="15" />
<span class="asterisk_input"> </span>
</div>
</form>
Site on which I work is coded using fixed layout so it was ok for me.
I'm not sure that that it's good for liquid design.
I think this is the efficient way to do, why so much headache
<div class="full-row">
<label for="email-id">Email Address<span style="color:red">*</span></label>
<input type="email" id="email-id" name="email-id" ng-model="user.email" >
</div>