我正在尝试创建一个文本框,我的网页的用户可以在其中输入内容。但是,我无法让文本从框的顶部开始向下移动。相比之下,它停留在中间偏左的位置,只是一直排成一行。我怎样才能对齐和断开文本,以便它可以环绕在框周围?
我曾尝试删除代码中可能专用于文本的某些部分,但都没有奏效。我还查看了其他示例,但都没有用。
<!doctype html>
<html>
<head><title> css </title></head>
<body>
<body style="background-color:lightgray;">
<style>
ul.a {
list-style-type: circle;
}
body {
font-family: "Arial"; font-size: 17px;
}
ul {
text-align: left;
}
input[type=text], select {
width: 90%;
padding: 12px 20px;
margin: 8px 0;
display: block;
border: 1px solid #ccc;
border-radius: 4px;
box-sizing: border-box;
}
}
input[type=submit] {
width: 100%;
background-color: #4CAF50;
color: white;
padding: 14px 20px;
margin: 8px 0;
border: none;
border-radius: 4px;
cursor: pointer;
}
</style>
<center><div style="width:100px;height:60px;border:0px solid #000;"></div>
<div style="width:1000px;height:500px;border:1.5px solid #000;">
<body>
<p><strong> ? </strong></p><hr>
<ul class="a">
<li>?</li>
<li>?</li>
<li>?</li>
</ul>
` <texterea action="/action_page.php" target="_blank">
<p><input class="w3-input w3-padding-100px w3-border" type="text" placeholder="Message" required name="Message" style="height:200px"></p>
<p><button class="w3-button w3-light-grey w3-block" type="submit">SEND</button></p>
</texterea>
</div></center>
</body></html>
我希望文字能够包裹住盒子,但它只是不断地居中,这很烦人。
最佳答案
你的 <textarea>
标签应嵌套在 <form>
中标签。你很接近,你只是看起来混淆了你的嵌套/标签。
我想你想做这样的事情:
<form action="/action_page.php" target="_blank">
<p><textarea class="w3-input w3-padding-100px w3-border" placeholder="Message" required name="Message" style="height:200px"></textarea></p>
<p><button class="w3-button w3-light-grey w3-block" type="submit">SEND</button></p>
</form>
关于html - 我的文本框中的文本与左中心对齐。我该如何删除它?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58739260/