创建 HTML5 时使用更多标签还是更少标签更好?
我读到任何相关内容都应该包含在 中<section>
,请在下面查看,一个变体带有较少的标签,第二个变体带有更多标签。
我知道有些人说标签越多越好,有些人说标签越少,但有普遍接受的规则吗?
<section class="body" id="contact">
<section id="contact_us_form">
<header>
<h1>CONTACT US</h1>
<hr />
</header>
<p>
Get in touch with the Foundation<br /> with your
questions and queries
</p>
<form action="">
<input type="text" name="name" placeholder="name"
autocomplete="on" autofocus="on"> <input type="text" name="email"
placeholder="email">
<textarea name="message" placeholder="message"></textarea>
<button class="submit" type="submit" formaction="">SEND MESSAGE</button>
</form>
</section>
<section id="contact_details">
<section id="email_address">
<h1>EMAIL</h1>
<p>test@email.com</p>
</section>
<section id="postal_address">
<h1>ADDRESS</h1>
<address class="vcard">
<div class="adr">
<div class="center-name">name</div>
<div class="street-address">2 road name</div>
<div class="locality">city</div>
</div>
</address>
</section>
<section id="phone_number">
<h1>PHONE:</h1>
<p>+12345678</p>
</section>
</section>
</section>
或者
<section class="body" id="contact">
<section id="contact_us_form">
<h1>CONTACT US</h1>
<hr />
<p>
Get in touch with the Foundation<br /> with your
questions and queries
</p>
<form action="">
<input type="text" name="name" placeholder="name"
autocomplete="on" autofocus="on"> <input type="text" name="email"
placeholder="email">
<textarea name="message" placeholder="message"></textarea>
<button class="submit" type="submit" formaction="">SEND MESSAGE</button>
</form>
</section>
<section id="contact_details">
<h1>EMAIL</h1>
<p>test@email.com</p>
<h1>ADDRESS</h1>
<address class="vcard">
<div class="adr">
<div class="center-name">name</div>
<div class="street-address">2 road name</div>
<div class="locality">city</div>
</div>
</address>
<h1>PHONE:</h1>
<p>+12345678</p>
</section>
</section>