问题
Are the <article>
and <section>
tags important on a website, as opposed to regular <div>
s? What is the their purpose?
For example:
Are there any additional limitations on them? E.g. is this a correct page structure?
<body> <h1>Title</h1> <h6>00/00/0000 - 00:00</h6> <figure> <img src="" alt=""> <figcaption><b></b></figcaption> <hr> </figure> <div> <p></p> <img src="" alt=""> <figcaption><b></b></figcaption> <hr> <p></p> <p></p> <p></p> <div> <iframe></iframe> </div> </div> </body>
Do they influence search engines (as best known atm, of course) or anything else on the page?
At the moment, I don't use these tags and I would like to know the importance of it and how to use them correctly.
回答1:
HTML5 tags like <article>
and <section>
are called semantic elements (or semantic tags). Their purpose is to create a better standardization for website structures.
For example, an <article>
tag should ideally contain an article of some kind, such as a blog post or news article. A <nav>
tag should contain a page's navigation menu.
Using these tags instead of <div>
tags will not change the look or layout of a page unless your browser/useragent applies different default styling to them.
Additionally, semantic tags may affect a page's search engine optimization. As far as I know, there is no definitive proof yet that Google or other search engines treats pages with semantic tags differently/better than ones without them.
来源:https://stackoverflow.com/questions/52435378/how-are-article-and-section-tags-different-from-div-do-they-affect-anythi