this post was submitted on 21 Feb 2025
7 points (88.9% liked)

Asklemmy

45245 readers
856 users here now

A loosely moderated place to ask open-ended questions

Search asklemmy 🔍

If your post meets the following criteria, it's welcome here!

  1. Open-ended question
  2. Not offensive: at this point, we do not have the bandwidth to moderate overtly political discussions. Assume best intent and be excellent to each other.
  3. Not regarding using or support for Lemmy: context, see the list of support communities and tools for finding communities below
  4. Not ad nauseam inducing: please make sure it is a question that would be new to most members
  5. An actual topic of discussion

Looking for support?

Looking for a community?

~Icon~ ~by~ ~@Double_A@discuss.tchncs.de~

founded 5 years ago
MODERATORS
 

I know it in the spec stylesheets but why was this made like this?

all 9 comments
sorted by: hot top controversial new old
[–] espentan@lemmy.world 5 points 23 hours ago (1 children)

I've never experienced H2 to be larger than H1 in such usage, but rather the same size. Are you sure there aren't any CSS affecting your result?

From a stackoverflow reply:

Why h1 and h2 are same?

This is by design is because browser manufacturers think/agreed, that beneath web editors, producers and developers the is commonly treated as the visual more important heading and headings in the content documents should then ideally start with . That is why font-size is not default bigger inside , , , tags.

[–] sanderium@lemmy.zip 1 points 21 hours ago
[–] bleistift2@sopuli.xyz 3 points 23 hours ago* (last edited 23 hours ago) (1 children)

Do you mean…

  1. body > article > h1 is smaller than body > h2
  2. body > article > h1 is smaller than body > article > h2?

And where? Which spec stylesheets are you talking about?

For (1), https://css-tricks.com/document-outline-dilemma/ might answer your question.

[–] sanderium@lemmy.zip 1 points 21 hours ago* (last edited 21 hours ago)

It is number 2,

<body>
    <main>
        <article>
            <h1>Post Title</h1>
            <h2>Post "Topic"</h2>
        </article>
    </main>
</body>

Doing now the same as some developers I found:

<body>
    <main> 
        <h1>Post Title</h1>
        <article>
            <h2>Post "Topic"</h2>
        </article>
    </main>
</body>

Im asking because I found this question on stackoverflow for the section tag

[–] bjoern_tantau@swg-empire.de 2 points 23 hours ago

They probably expect you to use a new section with h1 for each uhhh section where you would use a h2 tag. So I gueas the h2 didn't get any new styling information at all.

In the end it's a mess most devs just fix with their own stylesheet.