占位文本未出现在文本区域中

3

我知道这里有人能帮我。我已经查看了关于相同主题的所有论坛,但也许有人可以帮助我特定的情况。我的textarea占位符没有显示出来。下面是代码:

<fieldset class="contactFormDetails">
    <input type="text" name="input-name" placeholder="Name" />
    <input type="text" name="input-mail" placeholder="Subject" />
</fieldset>
<fieldset class="contactFormMessage">
    <textarea name="input-message" placeholder="Type your message here"></textarea>
</fieldset>
<fieldset class="contactFormButtons">
    <input type="submit" value="Send" />
</fieldset>

你正在使用什么浏览器? - Fernando Jorge Mota
很奇怪,我在Chrome上也遇到了同样的问题! - Michael Aquilina
请查看以下答案:https://dev59.com/S2kw5IYBdhLWcg3wBmCA。 - CSSian
2个回答

2

1
你意识到你可以做到这个,对吗?
<textarea name="input-message" placeholder="Type your message here"></textarea>

这与占位符文本不等价。您的解决方案要求用户突出显示并删除文本,然后才能输入自己的文本,而占位符文本则在您开始键入到文本区域时自动消失。此外,如果用户没有输入任何内容,这种解决方案在提交表单时需要更多的工作,因为值“在此处输入您的消息”将被提交,然后需要在服务器上处理。 - beterthanlife
@betterthanlife 原始标记是正确的,那么请检查您的 CSS 是否将其隐藏或设置为白色? - Matt Lambert

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接