为什么输入字段使用font-style:italic减小宽度? [英] Why does an input field reduce width with font-style:italic?
本文介绍了为什么输入字段使用font-style:italic减小宽度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
将font-style: italic;
应用于HTML input
标记时,该字段比其他字段要窄(计算宽度较小).
When applying font-style: italic;
to an HTML input
tag, the field is narrower (less computed width) than it otherwise would be.
最小的可复制示例:
<!DOCTYPE html>
<html lang="en">
<body>
<input type="text" /><br>
<input type="text" style = "font-style: italic;" /><br />
</body>
</html>
当另存为HTML并在Chrome中呈现时,它看起来像这样:
在其他浏览器中也是如此.
When saved as an HTML and rendered in Chrome, it looks like this:
It's similar in other browsers.
注意:当上述HTML作为Stack Overflow上的代码段运行时,此问题不可见.
Note: This issue isn't visible when the above HTML is run as a code snippet on Stack Overflow.
这是为什么?
在浏览器中,一个比另一个常数窄的因素是吗?
Why is this?
Is the factor by which one is narrower than the other constant across browsers?
推荐答案
这是HTML5规范的作用.
This is the effect of the HTML5 specification.
查看全文