internet-explorer - 字体行高IE浏览器兼容性问题
问题描述
下面的 CSS 代码在 IE 11 版本的浏览器中有问题,行高应该是 36px,我漏掉了什么?
它在chrome中显示正常。
input {
display:block;
width:100%;
background:#fbfbfb;
color:#666;
font-size:.875rem;
line-height:2;
box-sizing:border-box;
border:solid .0625rem #ccc;
padding:.1875rem .5rem;
margin-bottom:.875rem;
}
<form action="demo_form.asp">
First name: <input type="text" name="fname" placeholder="First">
Last name: <input type="text" name="lname" placeholder="Last">
<input type="submit" value="Submit">
</form>
解决方案
尝试为输入文本元素添加高度属性。
代码如下:
<style>
input {
display: block;
width: 100%;
background: #fbfbfb;
color: #666;
font-size: .875rem;
line-height: 2;
box-sizing: border-box;
border: solid .0625rem #ccc;
padding: .1875rem .5rem;
margin-bottom: .875rem;
height:2.2rem; /*height:36px;*/ /*You could also set the height property to 36px*/
}
</style>
在 IE 浏览器(IE 11 版本)中的结果如下:
推荐阅读
- flutter - Flutter:更改 URL 策略会导致应用重新加载
- javascript - 反应:更改上下文(useContext)的状态后无法使用路由器导航视图
- javascript - AsyncIterator 突然退出“for await-of”循环
- python - pd.json_normalize() 给出“str object has no attribute 'values'”
- python - 在python中显示图像的连续变化
- mysql - Ubuntu启动mysql/mysql服务器
- go - 调用的语法 (object).function 是什么?它是如何在引擎盖下工作的?
- javascript - Swift 的 @dynamicMemberLookup 是否有 JavaScript 等价物?
- php - 将文本(标签)分配给 SQL 查询结果中的值
- python - arima 函数的 Python 代码在函数内部返回时不起作用,但在函数外部使用时工作正常