Forum Moderators: not2easy
I am having problems setting the font size for input, select, textarea etc. to look the same as the corresponding label but have noticed that if I use for example...
label, input {
font-size 0.9em;
}
<label for="example"><input type="text" name="example"></input></label>
The "input" font size appears smaller than the "label" font size. It seems like "input" has inherited the font size from "label" and scaled it down.
Is there a simple way round this without attaching an individual id/class to each input?
1) Reset the font-size of the input when it’s inside a label:
label, input { font-size: .9em; }
label input { font-size: 1em; } 2) Use explicit rather that implicit form association to get around nesting problems:
<label for="example">Example</label><input type="text" id="example" />