0

I have a problem, I have this input text fields in a html form, this are wrapped for this div css properties:

.formRight240 { float: left; width: 240px; margin: 5px 12px 5px 0px; }

when I try to this

.field_required{ display: inline; color: red; } 
.field_required:after{ content: "*" }

the input text field stay the same and the asterisk jump to the next line, I know the reason, everything is aligned in order to the other elements around, but is there anything I can do to display the asterisk inline with the input text field by doing changes to the field_required class? if not, what I have to change to the .formRight240.

HTML

<div class="rowElem noborder">
    <label>Customer ID:</label>
    <div class="formRight240">
        <span class="field_required"><input type="text" name="p_cust_id_c" id="req" class="validate[required,maxSize[30]]"/></span>
    </div>
    <div class="fix"></div>
</div>
Milche Patern
  • 19,632
  • 6
  • 35
  • 52
Andy Chaves
  • 137
  • 1
  • 2
  • 9

1 Answers1

0

Check this answer, you can't add :before or :after to an input.

A solution could be to wrap your input in a span:

HTML

<span class="field_required"><input type="text" /><span>

CSS

.field_required input {
    display: inline;
    color: red;
} 
.field_required:after{ 
    content: "*";
}

DEMO

Community
  • 1
  • 1
GreyRoofPigeon
  • 17,833
  • 4
  • 36
  • 59