简体   繁体   English

在h1之后是否有必要使用H2

[英]Is it necessary to use H2 after h1

Is it mandatory to use H2 after h1 if text is too small then can we use h4 after h1 . 如果文本太小,是否必须在h1之后使用H2,那么我们可以在h1之后使用h4。 and is it accessible ? 它可以访问吗?

Technically you can use any combination of those. 从技术上讲,您可以使用它们的任意组合。

Semantically, it's wise to use the common order. 从语义上讲,使用通用订单是明智的。 And if the font size is too small, use CSS to change that. 如果字体太小,请使用CSS来更改它。

With the tags h1 - h6 you give a semantic meaning to a title. 使用标签h1 - h6您可以为标题赋予语义含义。 Where h1 is for the top level, h2 for a subdivision of h1 , h3 for a subdivision of h2 etc. 其中h1表示顶层, h2表示h1的细分, h3表示h2的细分等。

You can change the appearance by setting CSS rules, which is great because now you can separate content from layout. 您可以通过设置CSS规则来更改外观,这很好,因为现在您可以将内容与布局分开。

你应该总是正确结构的文件,所以是应该h2h1 -如果文字是错误的大小,你应该使用CSS的标题样式为您的口味。

H1 is usally used for primary headers, h2 for subheaders, h3 for subsubheaders etc. It's doesn't really matter what order you use them in. it's just a conventional document structure, it would illogical to have a sub header, then a primary header but it's not enforced. H1通常用于主标题,h2用于子标题,h3用于子标题等。使用它们的顺序并不重要。它只是一个传统的文档结构,有一个子标题,然后是主标题是不合逻辑的但它没有强制执行。 Just style them in css for your liking. 只需根据自己的喜好在CSS中设置样式。

Ideally you should stick to H1 then H2 and then use CSS to alter the styles of both to match what you want. 理想情况下,您应该坚持H1然后H2,然后使用CSS来改变两者的样式以匹配您想要的。

Think of HTML as describing the content and structure of your document (hence why it's preferred to stick to H1 then H2, because that indicates the structure of the headings), and then think of CSS as taking that structure and formatting it according to some layout rules, so the CSS defines how big and what colour your want all your H1s and H2s to be. 将HTML视为描述文档的内容和结构(因此,为什么最好坚持H1然后H2,因为这表示标题的结构),然后将CSS视为采用该结构并根据某些布局对其进行格式化规则,因此CSS定义了你想要的所有H1和H2的大小和颜色。

(Technically there is nothing stopping your from mixing up the order and doing whatever you want though) (从技术上讲,没有什么可以阻止你混合订单并做任何你想要的事情)

Yes, you can skip levels, and most screen readers won't care. 是的,您可以跳过级别,大多数屏幕阅读器都不会关心。

It is often better to use CSS, though. 但是,使用CSS通常更好。

No, they're just tags. 不,他们只是标签。 The heirarchy is implied rather than defined or enforced so you can use them in any order you please. heirarchy是隐含的而不是定义或强制执行,因此您可以按照您喜欢的任何顺序使用它们。

But for readability and neatness you're better of redefining them with CSS if you don't like the sizes rather than just using H3 for a main heading and ignoring H1 and H2. 但是为了可读性和整洁性,如果你不喜欢大小而不是仅仅使用H3作为主标题而忽略H1和H2,那么你最好用CSS重新定义它们。 Aside from anything else it could impact Search Engine Optimisation (which considers H1 significant, though I'm not sure about H2 and H3). 除了它可能影响搜索引擎优化(它认为H1很重要,但我不确定H2和H3)。

h1和h2对搜索引擎优化非常重要,使用一个h1和多个h2之后是合乎逻辑的事情。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM