some l...">

Are <Ul> s allowed inside H1?

I was wondering if there would be problems if I add a list inside the H1 header:

<h1> <ul> <li><a href="...">some link</a></li> <li><a href="...">another link</a></li> <li>current page</li> </ul> </h1> 

the list is a breadcrumb navigation.

Or is it better to insert it into the list?

 <ul> <li><a href="...">some link</a></li> <li><a href="...">another link</a></li> <li><h1>current page</h1></li> </ul> 
+4
source share
5 answers

It is wrong to have ul inside h1, the best way to check is to use http://validator.w3.org/ to check your structure, which will look at the way you use it. (but this is still not valid!)

+8
source

Header elements, such as <h1> , follow the phrase content : if you want to follow the HTML specification in the letter, the content of the phrase can contain only plain text or other phrasing content. Since the <ul> elements do not contain text, they are technically not allowed in the <h1> elements.

The second example: placing <h1> elements inside <li> elements is a valid markup and will be the preferred method for combining the <h1> and <ul> elements.

+13
source

You can use the W3C markup validation service to check if this is valid :)

+3
source

To answer your initial question, no, this doesn’t seem like a reasonable thing related to your markup, and even if it would be technically sound (which, I don’t think so), I would not advise doing this.

As for SEO, h1 used to some extent in search, although I believe that it is not as important as the <title> element. However, if your page does not have a semantically speaking title, of course, I would not intend to break one in order to try to improve the ranking. Put this text of the "current page" in the <title> , if necessary, make the list of cartridges the usual list of folders and do not worry with h1 if you do not need it.

+2
source

this will display, but I think it will be considered bad practice, since the list is not a title. You would be better off adding a css style so that you can format the list to the desired size, font, etc.

+1
source

Source: https://habr.com/ru/post/1339965/


All Articles