CSS first-of-type usage

@Deinos @Olondre my response would be a bit incomplete (bcoz I don’t have access to my pc for few days to test) but it will give the potential solution approach.

Btw first-of-type works for first of element (either H2/H3 or p or ul) but not classes and valid within same parent.

So since in LP .HyperMD-header-2 is a div, if u don’t have it as first one of the notes line it won’t be detected as first. For Reading view, almost everything is wrapped by its own container div unless it’s the very next line, so that almost cannot work.

The solution is likely to use sibling selector i.e. HyperMD-header-2 ~ HyperMD-header-2 in LP to select all H2 other than first.

For Reading View .markdown-preview-section div:has(h2) ~ div:has(h2) h2. This one, in general is the approach but it might miss something

2 Likes