3 ms·
Heading styles (whether in HTML or word processors) have long been a source of annoyance for me, because they constantly have to be redone. Current models all
by crazygringo 10y ago
Heading styles (whether in HTML or word processors) have long been a source of annoyance for me, because they constantly have to be redone.
Current models all follow the top-down approach -- assume you know your top sections when you start (H1), then drill down into H2, H3, etc.
But just as often you want to do bottom-up -- start with a short article with a single heading (H1), then add a sibling section (turn both H1's into H2's, add the "real" H1), then put those both under a larger section (H2's become H3's, H1's turn into H2's, new H1), and so on.
Any manual choice of heading levels is just dumb, frankly. <h> is a great solution -- I just want to see something similar for word processors as well!
- jaffathecake 10y agoWhy do you think <h> is a better solution compared to what HTML5 proposed?
- RubyPinch 10y agoMaybe its best use would be a pre-processor feature? Best of both worlds, controllable auto-calculation, plus backwards compatibility
- deleted 10y ago[deleted]
- didgeoridoo 10y agoThis problem was solved (although apparently not fully implemented) through the "document outline" approach using semantic section elements: https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Using_HTML_sections_and_outlines https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Usin...
- sjwright 10y agoMost word processors' paragraph styles are an arbitrary list. You can define your own "Heading 1.5" style if you wish.
- jessaustin 10y agoI agree that we should just let the computer keep track of heading levels. TFA suggests, convincingly to me, that "<h1>" would serve this purpose as well as "<h>". This wouldn't even run afoul of CSS single-pass concerns the way that lots of reasonable styling requests do. The first time the browser sees "<h1>", the immediate parent is the top level. Any child with an "<h1>" is the next level, any sibling with one is the same level, and so on.
- crooked-v 10y agoThis is how section tags were supposed to work with headers, but nobody ever implemented it.
- arthur2e5 10y agoChrome 58 gives a smaller font size (1.5em, same as <h2>) for <h1> elements under <section> and friends: /* user agent stylesheet */ :-webkit-any(article,aside,nav,section) h1 { font-size: 1.5em; -webkit-margin-before: 0.83em; -webkit-margin-after: 0.83em; } And <h1> keeps shrinking as you nest <section>s. So yes, someone has actually implemented it. (I personally don't like the <article> part, but well -- whatever.)
- nkkollaw 10y agoYou won't have that problem if you use HTML5 sections. The outline is defined using sections, and you can use all h1s (or at least h1s are scoped to the section, so more easily managed)
- fiatjaf 10y agoClassless, my pack of CSS CMS themes, uses this approach: https://github.com/websitesfortrello/classless https://github.com/websitesfortrello/classless
- afloatboat 10y agoI would be careful with that approach. I've followed it for a couple of years, but noticed that browser vendors and other tools have not embraced this change. While it's technically still correct, it might backfire in reality. So maybe this <h>-element would be a welcome addition to the spec. https://www.w3.org/wiki/HTML/Usage/Headings/h1only#Heading_semantics_exposed_by_browsers https://www.w3.org/wiki/HTML/Usage/Headings/h1only#Heading_s... http://html5doctor.com/computer-says-no-to-html5-document-outline/ http://html5doctor.com/computer-says-no-to-html5-document-ou...
- corny 10y agoIt looks like that method is now deprecated in HTML 5.1. https://bitsofco.de/document-outlines-in-html-5-1/ https://bitsofco.de/document-outlines-in-html-5-1/
- deleted 10y ago[deleted]
- nkkollaw 10y agoThat might be a problem, but looking for better tools or waiting for them to adopt the standard seems an easier solution than inventing another standard.
- sametmax 10y agoLet's not ad something to the spec because vendors don't implement the spec correctly. That makes no sense. What makes you think they will implement the new one correctly ? Plus they are wrong in the first place.
- throwawayish 10y agoThis is what rST solved and got 100% right ~15 years ago.