Firefox和Chrome中修复Textarea底部边距不一致

Firefox和Chrome中修复Textarea底部边距不一致

本文介绍了如何在Firefox和Chrome中修复Textarea底部边距不一致?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图消除FF和Chrome似乎给Textareas的额外底部边距。令人惊讶的是IE似乎做到了正确。我想避免使用条件包含,但CSS3调整是可以的。



示例代码



.red-box {background-color:red; overflow:hidden;} textarea {border:solid 1px #ddd; margin:0px; / *没有效果* /}
 < div class =red-box> < textarea>没有保证金!!/ textarea>< / div>  

display:inline-block; 。在您的样式中设置 display:block ,您应该全部设置。


I'm trying to eliminate the extra bottom margin that both FF and Chrome seem to give to Textareas. Surprisingly IE seems to do it correctly. I would like to avoid using conditional includes but CSS3 tweaks are OK.

Sample Code

.red-box {
    background-color: red;
    overflow: hidden;
}
textarea {
    border: solid 1px #ddd;
    margin: 0px; /* Has no effect */
}
<div class="red-box">
    <textarea>No Margin Please!</textarea>
</div>

解决方案

By default, I believe both Chrome and Firefox will set these elements as display: inline-block;. Set display: block in your styles and you should be all set.

这篇关于如何在Firefox和Chrome中修复Textarea底部边距不一致?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-30 08:29