Exploring Headings: Semantics, Fluidity, and Styling

A few links about headings that I’ve had stored under my top hat.

“Page headings don’t belong in the header”

Martin Underhill:

I’ll start with where the

should be placed, and you’ll start to see why the isn’t the right location: it’s the header for the page, and the main page content should live within the
element.

A classic conundrum! I’ve seen the main page heading (

) placed in all kinds of places, such as:

– The site (wrapping the site title)
– A nested in the

content
– A dedicated outside the
content

Aside from that first one — the site title serves a different purpose than the page title — Martin pokes at the other two structures, describing how the implicit semantics impact the usability of assistive tech, like screen readers. A is a wrapper for introductory content that may contain a heading element (in addition to other types of elements). Similarly, a heading might be considered part of the

content rather than its own entity.

So:


Page heading





Page heading


Like many of the decisions we make in our work, there are implications:

– If the heading is in a that is outside of the

element, it’s possible that a user will completely miss the heading if they jump to the main content using a skip link. Or, a screenreader user might miss it when navigating by landmark. Of course, it’s possible that there’s no harm done if the first user sees the heading prior to skipping, or if the screenreader user is given the page prior to jumping landmarks. But, at worst, the screenreader will announce additional information about reaching the end of the banner (maps to role=”banner”) before getting to the main content.</p> <p>– If the heading is in a that is nested inside the <main> element, the loses its semantics, effectively becoming a generic </p> <div> or </p> <section>, thus introducing confusion as far as where the main page header landmark is when using a screenreader.</p> <p>All of which leads to Martin to a third approach, where the heading should be directly in the <main> content, outside of the :</p> <p><br /> <br /> <main></p> <h1>Page heading</h1> <p> <br /> </main></p> <p>This way:</p> <p>– The landmark is preserved (as well as its role).<br /> – The </p> <h1> is connected to the <main> content.<br /> – Navigating between the and <main> is predictable and consistent.</p> <p>As Martin notes: “I’m really nit-picking here, but it’s important to think about things beyond the visually obvious.”</p> <p>“Fluid Headings”</p> <p>Donnie D’Amato:</p> <p>There’s no shortage of posts that explain how to perform responsive typography. […] However, in those articles no one really mentions what qualities you are meant to look out for when figuring out the values. […] The recommendation there is to always include a non-viewport unit in the calculation with your viewport unit.</p> <p>To recap, we’re talking about text that scales with the viewport size. That usually done with the clamp() function, which sets an “ideal” font size that’s locked between a minimum value and a maximum value it can’t exceed.</p> <p>.article-heading {<br /> font-size: clamp(<min>, <ideal>, <max>);<br /> }</p> <p>As Donnie explains, it’s common to base the minimum and maximum values on actual font sizing:</p> <p>.article-heading {<br /> font-size: clamp(18px, <ideal>, 36px);<br /> }</p> <p>…and the middle “ideal” value in viewport units for fluidity between the min and max values:</p> <p>.article-heading {<br /> font-size: clamp(18px, 4vw, 36px);<br /> }</p> <p>But the issue here, as explained by Maxwell Barvian on Smashing Magazine, is that this muffs up accessibility if the user applies zooming on the page. Maxwell’s idea is to use a non-viewport unit for the middle “ideal” value so that the font size scales to the user’s settings.</p> <p>Donnie’s idea is to calculate the middle value as the difference between the min and max values and make it relative to the difference between the maximum number of characters per line (something between 40-80 characters) and the smallest viewport size you</p></div><footer class="entry-footer"> <div class="entry-tags"> <span class="tags-links"> <span class="tags-label screen-reader-text"> Post Tags: </span> <a href=https://wiredgorilla.com/tag/accessibility/ title="accessibility" class="tag-link tag-item-accessibility" rel="tag"><span class="tag-hash">#</span>accessibility</a><a href=https://wiredgorilla.com/tag/articles/ title="articles" class="tag-link tag-item-articles" rel="tag"><span class="tag-hash">#</span>articles</a><a href=https://wiredgorilla.com/tag/content/ title="content" class="tag-link tag-item-content" rel="tag"><span class="tag-hash">#</span>content</a><a href=https://wiredgorilla.com/tag/course/ title="course" class="tag-link tag-item-course" rel="tag"><span class="tag-hash">#</span>course</a><a href=https://wiredgorilla.com/tag/dedicated/ title="dedicated" class="tag-link tag-item-dedicated" rel="tag"><span class="tag-hash">#</span>dedicated</a><a href=https://wiredgorilla.com/tag/difference/ title="difference" class="tag-link tag-item-difference" rel="tag"><span class="tag-hash">#</span>difference</a><a href=https://wiredgorilla.com/tag/done/ title="done" class="tag-link tag-item-done" rel="tag"><span class="tag-hash">#</span>done</a><a href=https://wiredgorilla.com/tag/explain/ title="Explain" class="tag-link tag-item-explain" rel="tag"><span class="tag-hash">#</span>Explain</a><a href=https://wiredgorilla.com/tag/font/ title="Font" class="tag-link tag-item-font" rel="tag"><span class="tag-hash">#</span>Font</a><a href=https://wiredgorilla.com/tag/heading/ title="heading" class="tag-link tag-item-heading" rel="tag"><span class="tag-hash">#</span>heading</a><a href=https://wiredgorilla.com/tag/information/ title="information" class="tag-link tag-item-information" rel="tag"><span class="tag-hash">#</span>information</a><a href=https://wiredgorilla.com/tag/it/ title="it" class="tag-link tag-item-it" rel="tag"><span class="tag-hash">#</span>it</a><a href=https://wiredgorilla.com/tag/location/ title="location" class="tag-link tag-item-location" rel="tag"><span class="tag-hash">#</span>location</a><a href=https://wiredgorilla.com/tag/magazine/ title="Magazine" class="tag-link tag-item-magazine" rel="tag"><span class="tag-hash">#</span>Magazine</a><a href=https://wiredgorilla.com/tag/make/ title="make" class="tag-link tag-item-make" rel="tag"><span class="tag-hash">#</span>make</a><a href=https://wiredgorilla.com/tag/maps/ title="maps" class="tag-link tag-item-maps" rel="tag"><span class="tag-hash">#</span>maps</a><a href=https://wiredgorilla.com/tag/notes/ title="notes" class="tag-link tag-item-notes" rel="tag"><span class="tag-hash">#</span>notes</a><a href=https://wiredgorilla.com/tag/one/ title="one" class="tag-link tag-item-one" rel="tag"><span class="tag-hash">#</span>one</a><a href=https://wiredgorilla.com/tag/other/ title="Other" class="tag-link tag-item-other" rel="tag"><span class="tag-hash">#</span>Other</a><a href=https://wiredgorilla.com/tag/posts/ title="posts" class="tag-link tag-item-posts" rel="tag"><span class="tag-hash">#</span>posts</a><a href=https://wiredgorilla.com/tag/recap/ title="recap" class="tag-link tag-item-recap" rel="tag"><span class="tag-hash">#</span>recap</a><a href=https://wiredgorilla.com/tag/responsive/ title="responsive" class="tag-link tag-item-responsive" rel="tag"><span class="tag-hash">#</span>responsive</a><a href=https://wiredgorilla.com/tag/semantics/ title="semantics" class="tag-link tag-item-semantics" rel="tag"><span class="tag-hash">#</span>semantics</a><a href=https://wiredgorilla.com/tag/settings/ title="settings" class="tag-link tag-item-settings" rel="tag"><span class="tag-hash">#</span>settings</a><a href=https://wiredgorilla.com/tag/tech/ title="tech" class="tag-link tag-item-tech" rel="tag"><span class="tag-hash">#</span>tech</a><a href=https://wiredgorilla.com/tag/top/ title="top" class="tag-link tag-item-top" rel="tag"><span class="tag-hash">#</span>top</a><a href=https://wiredgorilla.com/tag/typography/ title="Typography" class="tag-link tag-item-typography" rel="tag"><span class="tag-hash">#</span>Typography</a><a href=https://wiredgorilla.com/tag/units/ title="units" class="tag-link tag-item-units" rel="tag"><span class="tag-hash">#</span>units</a><a href=https://wiredgorilla.com/tag/usability/ title="usability" class="tag-link tag-item-usability" rel="tag"><span class="tag-hash">#</span>usability</a><a href=https://wiredgorilla.com/tag/value/ title="value" class="tag-link tag-item-value" rel="tag"><span class="tag-hash">#</span>value</a><a href=https://wiredgorilla.com/tag/values/ title="values" class="tag-link tag-item-values" rel="tag"><span class="tag-hash">#</span>values</a><a href=https://wiredgorilla.com/tag/work/ title="work" class="tag-link tag-item-work" rel="tag"><span class="tag-hash">#</span>work</a> </span></div></footer></div></article> <nav class="navigation post-navigation" aria-label="Posts"> <h2 class="screen-reader-text">Post navigation</h2> <div class="nav-links"><div class="nav-previous"><a href="https://wiredgorilla.com/a-centuries-old-grid-of-holes-in-the-andes-may-have-been-a-spreadsheet-for-accounting-and-exchange/" rel="prev"><div class="post-navigation-sub"><small><span class="kadence-svg-iconset svg-baseline"><svg aria-hidden="true" class="kadence-svg-icon kadence-arrow-left-alt-svg" fill="currentColor" version="1.1" xmlns="http://www.w3.org/2000/svg" width="29" height="28" viewBox="0 0 29 28"><title>Previous Previous

A centuries-old grid of holes in the Andes may have been a ‘spreadsheet’ for accounting and exchange

Similar Posts