【发布时间】:2016-02-08 19:39:57
【问题描述】:
我正在尝试将我的两个标签(“您的消息:”和“您的电子邮件:”)放在每个文本区域的左上角,“您的消息:”在顶部的文本区域。虽然即使通过这种方法:How will I align the label of a text area to top? 我也无法让它工作。是否需要该表才能正常工作?我尝试了其他方法来让它发挥作用,例如将表单分组到 -p- 标记中,但这也不起作用。
HTML
<div id="ContactUsForm">
<p>Contact Us</p>
<form>
<table>
<td>
<label for="message">your message:</label>
<textarea id="message" class="contact" name="message"</textarea>
<label for="email">your email:</label>
<textarea id="email" class="contact" name="email"></textarea>
</td>
</table>
</form>
</div>
CSS
#ContactUsForm {
position: absolute;
width: 1400px;
height: 400px;
top: 227px;
left: 42px;
border: 2px solid #E64A19;
}
#ContactUsForm p {
text-decoration: underline;
font-weight: bold;
position: absolute;
top: -15px;
left: 50px;
font-size: 30px;
}
.contact {
position: absolute;
background: white;
border: 2px solid #E64A19;
}
#message {
width: 500px;
height: 150px;
top: 100px;
left: 30px;
resize: none;
position: absolute;
}
#email {
width: 500px;
height: 70px;
position: absolute;
resize: none;
top: 300px;
left: 30px;
}
label {
vertical-align: top;
}
【问题讨论】:
-
旁注:您缺少
tr标签。 -
你的开场
textarea标签没有关闭<textarea id="message" class="contact" name="message"</textarea>