logoalt Hacker News

nfw2last Thursday at 5:06 AM4 repliesview on HN

I'd like to propose for the list:

Default heading styles should not have equal top and bottom margin. Headings should be closer to the content they label than to the content they are setting their content apart from.

h1, h2, h3 should not have different styles. it's an anti-pattern that leads to broken accessibility


Replies

0xfffafaCrashlast Thursday at 6:05 AM

moreover h* is just broken whenever dealing with more dynamic content — it simply can’t reasonably be made to work according to accessibility recommendations — and the accessibility guidelines around never skipping a level themselves are ridiculous given the practical reality that dynamic content exists and we have only h1, h2, etc. to work with — the readers and specs are what need to adapt here, not the entire internet

there should really be one header tag and its level should be based on some nesting depth

and don’t get me started on the maintainability mess that is z-index… better we have a system to centrally maintain an ordering list than a distributed one which only works reasonably consistently if you already know everything in the whole system

show 3 replies
wavemodelast Thursday at 7:31 AM

That's sensible, but I think default styles for specific elements are not part of the CSS standard, and are instead dictated by the user-agent stylesheet of your browser.

quirinolast Thursday at 5:46 AM

This "headings closer to the content" suggestion is very good.

I came across it when reading Butterick's Practical Typography and it's possibly the lowest effort/clearest improvement guideline in the book.

Now I can't unsee websites that do it wrong.

IshKebablast Thursday at 11:38 AM

> h1, h2, h3 should not have different styles. it's an anti-pattern that leads to broken accessibility

How does that hurt accessibility? Are you saying people use h3 in order to get its style even when they didn't mean h3?

I think the opposite could happen too - if they all have the same style then people might just use h1 everywhere which is probably just as bad. People tend not to use elements that have no obvious use, like <output> which apparently has better accessibility but does absolutely nothing else, so nobody bothers. The whole "semantic web" thing failed partly because of this.

show 1 reply