问题原文
原帖链接 · Bo Terham · CC BY-SA 4.0
I am confused about when I should use a h2 tag and when I should avoid it.
Like most commercial websites I have a product list page. 24 products are divided into 6 rows of 4 columns each. The product is displayed in a 'card'. I am doubting if each card title (so each product title) should be a h2 tag or if it should be just a p tag.
On one hand, 24 h2 tags seems like overuse to me. On the other hand, each product is just as important as the next one, and it is the main content of the page. I would like to know what is the correct approach in this instance.
Besides products I also have a blog page, where I often write articles in the form of "5 tips do task x". Each subheading is a h2 tag. Is this also overuse or is it correct use?
已采纳解答
原帖链接 · Peter206 · CC BY-SA 4.0
In my understanding, there should be one h1 title on the top of the page and then h2 titles over main (sub-)sections of a page. Under each h2 heading comes the content, which should be more than just 1 item or 1 sentance usually.
When you have a list of products in tabular format as you describe it, putting h2 for each of 24 product seems to be overdoing it.
I suppose your goal is to make it possible to search for each of these products and for that putting its name in h2 might be useful.
If you changed your page so that the table can have sections for each product which can be opened up (e.g. with summary details tags on the same page or via hyperlink on a new page) then there is a place to put the product as a heading, as you provide a lot of details to your product.
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
