Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Why? Just use different h1...h6 family tags depending on your structure.

The example in the article

<body> <h1>Level 1</h1> <section> <h1>Level 2</h1> <section> <h1>Level 3</h1> <section> <h1>Level 4</h1> </section> </section> </section> </body>

can become

<body> <h1>Level 1</h1> <section> <h2>Level 2</h1> <section> <h3>Level 3</h1> <section> <h4>Level 4</h1> </section> </section> </section> </body>



> tools like Lighthouse now flag cases of <h1>s without defined font-size as bad practice.

You forgot to include a font size in your h1's which is what people are complaining about needing to do.


The warning is only for <h1>s inside a section, so GP’s example — where the only h1 is at the top level — would not be flagged.


If that is true, then TFA seriously missed the mark:

> Alongside the changes in browser styles, page auditing tools like Lighthouse now flag cases of <h1>s without defined font-size as bad practice.

Then when listing what to expect:

> Lighthouse will flag a warning if <h1> is used without a specified font-size.

And under the section "Fixing the Lighthouse warning":

> Lighthouse has recently inherited a check based on Chromium's DevTools warnings for sites that don't specify a font-size for <h1> elements.

Then it uses top-level h1 selectors in its examples of recommended styles. I mean you might be right about when that warning will appear, but the article doesn't seem to think you are.


The error is named `H1UserAgentFontSizeInSection` -- makes it seems like it would only fire for an H1 used in a section?


TFA has been fixed to make this clearer. Thanks!




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: