关于 HTML 嵌套的问题,我应该将此 p 标签再嵌套一个缩进,以便将其嵌套在 h1 元素中还是保留在原来的位置?与伊莎的每一天

问题描述 投票:0回答:1

<!DOCTYPE html>
<html>
    <head>
      <title>Everday with Isa</title>
    </head>
    <body>
      <h1>An Insider's Guide to NYFW</h1>
      <p>NYFW can be both amazingly fun & incredibly overwhelming, especially if you’ve never been.     Luckily, I’m here to give you an insider’s guide and make your first show a pleasurable experience. By taking my tips and tricks, and following your gut, you’ll have an unforgettable experience!
      </p>
      <h2>Getting Tickets & Picking the Shows</h2>
      <h2>Dressing for the Shows</h2>
    </body>
</html>

在这里,我正在制作一个练习 HTML 页面,我想知道嵌套元素和可读性的最佳实践,我应该将 p 标签嵌套在 h1 元素中,因为从逻辑上讲它是针对该 h1 元素的,还是应该保持原样?`

当然,像这样的 HTML 文件不会出现任何错误,只是想知道哪种方法是处理与标题元素位于同一行的段落标签的正确方法。

html readability
1个回答
0
投票

我建议您保持原样。这是因为 h1 标签通常描述整个网站。此外,h1 标签可以在整个网站内使用(不是强制性的,但推荐)。所以我个人认为你应该保持原样。

© www.soinside.com 2019 - 2024. All rights reserved.