IE9 中 TextAreas 行高的差异
我有一个 TEXTAREA,其中间距非常重要。我将其格式化如下:
TEXTAREA {
font-family: Tahoma, Arial;
font-size: 8pt;
letter-spacing: 0px;
line-height: 13px;
}
如果我输入一些文本,行高如何未正确应用:每个段落的最后一行(在 pessing Enter 或 shift-enter 之前)是高一个像素:
此问题仅出现在 Internet Explorer 9 中,不会出现在 Firefox 7 或 Chrome 14 中(到目前为止尚未测试旧版本)。
有没有办法摆脱它?
顺便说一句:文本区域的最后一行不会发生这种情况,除非后面有换行符。
问候, 史蒂芬
I have a TEXTAREA
where spacing is very important. I formatted it as follows:
TEXTAREA {
font-family: Tahoma, Arial;
font-size: 8pt;
letter-spacing: 0px;
line-height: 13px;
}
How, if I enter some text, the line height is not correctly applied: The last line of every paragraph (before pessing enter or shift-enter) is one pixel to high:
This problem only occurs in Internet Explorer 9, not in Firefox 7 or Chrome 14 (haven't tested older versions so far).
Is there a way to get rid of thad?
BTW: It does not happen for the last line of the textarea, unless there is a linebreak behind it.
Regards,
Steffen
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我知道这实际上可能没有完全帮助,也不是完整的答案,但可能值得阅读一下 CSS 中
!important
声明的使用。http://www.impressivewebs。 com/everything-you-need-to-know-about-the-important-css-declaration/
想到这一点的唯一原因是可能有另一种样式/声明应用后导致一些排序问题,这将确保您的文本区域应用了正确的样式。
您可能还想检查任何
CSS 声明是否不会导致与任何底部或顶部边距/填充发生冲突/问题?跨度或任何其他可能导致某种问题的样式也是如此。
就像我说的,我知道这可能没有丝毫帮助,但它可能是一种可能性。
I know this may not actually help entirely nor be the full answer, but it may be worth while reading up a little on the use of
!important
declaration within CSS.http://www.impressivewebs.com/everything-you-need-to-know-about-the-important-css-declaration/
The only reason why this springs to mind is there may be another style/declaration that is applied after which is causing some sort of problem and this will make sure your textarea has the correct styles applied to it.
You may also want to check that any
<p>
CSS declarations are not causing conflicts/problems with any bottom or top margin's/paddings? Same goes with span or any other styles that could potentially cause some sort of problems.Like I said, I'm aware this may not help in the slightest but it could be a possibility.
我在 IE8 中的文本区域的最后一行遇到了类似的问题。当我的文本区域的行高小于 18px 时,光标改变了行高。我提出这个问题的原因是你的 13px 行高相当小。您可能想要尝试更大的行高,看看问题是否消失。
I have had similar problems with the last line in a textarea in IE8. When my textarea had a line-height of less than 18px, the cursor changed the line-height. The reason I bring this up is your line-height of 13px is quite small. You may want to experiment with larger line-heights to see if the problem goes away.
我刚刚解决了这个问题很多很多次,最后发现 IE9 正在向文本区域添加额外的填充。线高、高度等没有影响。这做到了这一点:
I just went many many rounds with this issue and finally discovered that IE9 is adding extra padding to textareas. Line height, height, etc had no effect. This did the trick: