无法删除textarea margin-bottom

时间:2014-07-04 10:04:40

标签: html css

我有一个嵌入div内的textarea。为什么textarea是一种低利润率。我该如何删除它?

js fiddle

HTML

<form id="form">


    <div class="message_content">
        <textarea name="content" type="text" autocomplete="off"></textarea>
    </div>

</form>

CSS

  .message_content {
 height:auto;
 overflow: auto;
 background: red;
 }

 .message_content textarea {
 font-size: 14px;
 color: grey;
 height: 200px;
 margin: 0;
 resize: none;
 -webkit-box-sizing: border-box;
 -moz-box-sizing: border-box;
 box-sizing: border-box;
 }

4 个答案:

答案 0 :(得分:4)

只需添加textarea

即可

display: inherit;

<强> CSS

.message_content textarea {
font-size: 14px;
color: grey;
height: 200px;
margin: 0;
resize: none;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
display: inherit; /*Add this*/
}

fiddle

答案 1 :(得分:2)

使用以下CSS代码:

.message_content {
    height:auto;
    overflow: auto;
    background: red;
}

.message_content textarea {
    display: inherit;
    font-size: 14px;
    color: grey;
    height: 200px;
    margin: 0;
    resize: none;
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    box-sizing: border-box;
}

答案 2 :(得分:2)

在.message_content textarea display:block;

中添加代码

答案 3 :(得分:0)

尝试这种方式:

height提交至.message_content,将100%提交至textarea

请在此处查看DEMO