简体   繁体   English

输入的字体粗细小于400

[英]Font-weight less than 400 on inputs

I'm trying to use a font-weight of 300 for my site, and the text inside an input refuses to go thinner than 400. Here's an example: 我正在尝试为我的网站使用300的字体粗细,并且输入中的文本拒绝比400细。这是一个示例:

http://jsfiddle.net/m8FZ6/3/ http://jsfiddle.net/m8FZ6/3/

<span style="font-weight: 300;">300 weight:</span> <input type="text" value="text" style="font-weight: 300;"></input><br />
<span style="font-weight: 400;">400 weight:</span> <input type="text" value="text" style="font-weight: 400;"></input><br />
<span style="font-weight: 700;">700 weight:</span> <input type="text" value="text" style="font-weight: 700;"></input>

I've noticed this in FF 25, Chrome 30.0.1599.69, and IE10. 我在FF 25,Chrome 30.0.1599.69和IE10中注意到了这一点。 Is there a way to make it work, or will I have to use a different element? 有没有办法使它起作用,还是我必须使用其他元素?

input elements (and others like textarea , etc.) do not inherit font from the parent element. input元素(以及其他诸如textarea等)不会从父元素继承字体。 They have their own default fonts. 它们具有自己的默认字体。

If you change your CSS selector to html, input , you can see it has the appropriate font weight in all inputs. 如果将CSS选择器更改为html, input ,则可以看到它在所有输入中都具有适当的字体粗细。

you need to explicitly set the font family for input boxes 您需要显式设置输入框的字体系列

http://jsfiddle.net/m8FZ6/5/ http://jsfiddle.net/m8FZ6/5/

input {font-family: 'Roboto';}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM