最佳实践将形成元素逼入自己的线条,< p> or&< div>元素?
我正在练习创建HTML表单,并且想知道AP标签或DIV标签是否是在其自己的行上设置每个表单元素的最佳实践。
这就是我目前所拥有的。
<div>
<label for="firstname">Enter your first name:</label>
<input id="firstname" type="text" placeholder="First Name">
</div>
<div>
<label for="lastname">Enter your last name:</label>
<input id="lastname" type="text" placeholder="Last Name">
</div>
I'm practicing creating an HTML form and was wondering whether a p tag or div tag would be best practice to set each form element on it's own line.
This is what I have at the moment.
<div>
<label for="firstname">Enter your first name:</label>
<input id="firstname" type="text" placeholder="First Name">
</div>
<div>
<label for="lastname">Enter your last name:</label>
<input id="lastname" type="text" placeholder="Last Name">
</div>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
而不是
&lt; div&gt;
或&lt; p&gt;
在&lt; ol&gt; &lt; li&gt;
s >或&lt; ul&gt;
(如果需要&lt; div&gt;
或&lt; p&gt;
,请使用&lt; div&gt;
,因为它比互动更重要,而不是段落)Instead of
<div>
or<p>
use<li>
s in an<ol>
or<ul>
(if you need<div>
or<p>
, use<div>
because it's more for interactivity than a paragraph)