How are <article> and <section> tags different from <div>? Do they affect anything? [closed]

风格不统一 提交于 2020-01-06 06:32:18

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!