Is it alright to use multiple h1 tags on the same page, but style them differently?

前端 未结 11 1399
走了就别回头了
走了就别回头了 2020-12-02 15:38

I have a webpage that I use h1 tags multiple times within various DIVs and I style h1 for each div to be the appropriate size.

For example...

#conten         


        
11条回答
  •  心在旅途
    2020-12-02 16:18

    In my opinion, you don't need to worry, its ok to do it like this.

    H1 designates part of your contents to be a first level heading. So if you have a first level heading in your navigation div (e.g.

    Navigation Menu

    ), of course that should be #nav h1.

    If you should have several H1s within your contents depends: If you have a blog and every entry has its own heading, those would be H1s. However, if your blog itself has a heading (e.g.

    My Blog!

    ), the blog entry heading should be an H2.

    But that is only theory. Go for what is readable, semantic markup. You can best decide on that by looking at your html and asking yourself: 'Is it readable? Would the readability improve if I did it the other way?' The answer will vary from project to project.

提交回复
热议问题