【问题标题】:Can't enter text in a textarea无法在文本区域中输入文本
【发布时间】:2015-03-13 11:45:53
【问题描述】:

我无法在消息部分输入文本。它不会让我点击和输入。名称、电子邮件和反垃圾邮件部分工作正常,只有文本区域不行。我用谷歌搜索并没有找到关于 HTML textarea 标签的解决方案。

<form method="post" action="email.php">
    <label>Name</label>
    <input name="name" placeholder="Type Here">
    <label>Email</label>
    <input name="email" type="email" placeholder="Type Here">

    //this is the problem 
    <label>Message</label>
    <textarea name="message" placeholder="Type Here"></textarea>
    <label>*What is 2+2? (Anti-spam)</label>
    <input name="human" placeholder="Type Here">
    <input id="submit" name="submit" type="submit" value="Submit">
</form>

这是我的 CSS:

.contact-form input[type=text],
.contact-form input[type=password],
.contact-form input[type=email],
.contact-form textarea,
.contact-form input[type=file] {
    display: inline-block;
    float: left;
    padding: 12px 15px;
    width: 100%;
    border: 0;
    border: 1px #DFDFDF solid;
    background: #fff;
    -moz-transition: all 0.2s ease-in-out;
    -o-transition: all 0.2s ease-in-out;
    -webkit-transition: all 0.2s ease-in-out;
    transition: all 0.2s ease-in-out;
}

.contact-form textarea {
    clear: both;
    width: 100%;
    height: 180px;
    resize: none;
}

Fiddle

【问题讨论】:

  • 我猜消息字段被另一个元素“覆盖”了......你的 css 有问题......请发布它
  • 它对我有用,geekfellows.com/works.jpg 看看这个jsfiddle.net/bom8jygq
  • 也许是 JS 中的东西
  • css没有错
  • 它不能正常工作。我无法在文本区域中输入文本。

标签: html css forms


【解决方案1】:

你有:

button, input, optgroup, select, textarea { 
color: inherit;
font: inherit;
margin: 0px;
}

问题是font: inherit; 使用来自form 元素的line-height: 0px。因此,将line-height: 1.2em 设置为textarea 或您希望的其他值。

【讨论】:

  • 我遇到了同样的问题,但这并没有解决。还有其他解决方案吗?
猜你喜欢
  • 2015-06-08
  • 2021-06-27
  • 1970-01-01
  • 2011-09-04
  • 2016-08-16
  • 2011-01-07
  • 1970-01-01
  • 1970-01-01
  • 2015-01-22
相关资源
最近更新 更多