Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

<input> doesn't inherit the font from <body>

Tags:

css

I have input and label fields:

<label class="adm" for="UserName">User name</label> <input class="adm" id="UserName" name="UserName" size="30" type="text" value="" /> 

and CSS:

body,html { font-family: Verdana,Arial,Helvetica,sans-serif; margin:0; padding:0; color: #111;} label.adm  { font-size:0.9em; margin:0 0 3px 3px; display: block;} input.adm  { font-size:0.9em; margin:0 0 3px 3px; } 

When the code opens up in Firefox the fonts are not the same. Firebug shows that both "should" inherit and when I look at computed it shows the label uses Verdana. However the input shows it uses "MS Shell Dlg".

Can anyone explain what's happening and why it doesn't seem to obey the normal CSS rules?

like image 538
Judy R Avatar asked May 21 '11 07:05

Judy R


People also ask

Is font style inherited?

thts true but font is inherited by default .

Do buttons inherit font-family?

Buttons have their own font-family, so don't inherit from the cascade unless you tell it to.

How do I change the input font in HTML?

To change the font size in HTML, use the style attribute. The style attribute specifies an inline style for an element. The attribute is used with the HTML <p> tag, with the CSS property font-size. HTML5 do not support the <font> tag, so the CSS style is used to add font size.


1 Answers

It does not inherit by default but you can set it to inherit with css

input, select, textarea, button{font-family:inherit;} 

demo: http://jsfiddle.net/gaby/pEedc/1/

like image 108
Gabriele Petrioli Avatar answered Oct 13 '22 10:10

Gabriele Petrioli