gpt4 book ai didi

html - HTML5
元素的正确用法?

转载 作者:太空狗 更新时间:2023-10-29 15:45:03 27 4
gpt4 key购买 nike

我正在寻找 <address> 的正确用法元素。

例如,我要显示多个地址,所以我需要将它们写在一个地址元素中还是彼此分开?

<p>BLA BLA CO.</p>
<address>
<span class="full-address">XXX ST. XXX ETC.</span>
<span class="city">IZMIR</span>
<span class="town">Bornova</span>
<span class="phone">+11 111 111 1111</span>
<span class="fax">+11 111 111 1112</span>
</address>

<p>OTHER BLA CO.</p>
<address>
<span class="full-address">XXX ST. XXX ETC.</span>
<span class="city">IZMIR</span>
<span class="town">Bornova</span>
<span class="phone">+11 111 111 1111</span>
<span class="fax">+11 111 111 1112</span>
</address>

这个的正确用法是什么?

最佳答案

在您的用例中,这可能是不正确的用法。

根据官方引用:

The address element must not be used to represent arbitrary addresses (e.g. postal addresses), unless those addresses are in fact the relevant contact information. (The p element is the appropriate element for marking up postal addresses in general.)

引用,生活水平:https://html.spec.whatwg.org/multipage/semantics.html#the-address-element

引用,规范 HTML4.01:http://www.w3.org/TR/html401/struct/global.html#h-7.5.6

引用,推荐 HTML5:http://www.w3.org/TR/html5/sections.html#the-address-element

.

您提供了多个邮政地址,因此 p 在这里似乎更合适。对于address,它表示其最近的articlebody的联系信息,也允许在footer中。

关于html - HTML5 <address> 元素的正确用法?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27042119/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com