I certain do love little reminders about HTML semantics, notably semantics which are more durable to decide to reminiscence. Scott has an incredible one, starting with this markup:
<p>I'm a paragraph.</p>
<span>I'm additionally a paragraph.</span>
<div>You would possibly hate it, however I am a paragraph too.</div>
<ul>
<li>Even I'm a paragraph.</li>
<li>Although I am an inventory merchandise as nicely.</li>
</ul>
<p>I'd trick you</p>
<deal with>Guess who? A paragraph!</deal with>
You could have a look at that markup and say “Hey! You possibly can’t idiot me, solely the
<p>
parts are “actual” paragraphs!You would possibly even name out such parts as
div
s orspan
s getting used as “paragraphs” a WCAG failure.However, when you’re considering these kinds of issues, then possibly you’re not conscious that these are really all “paragraphs”.
It’s simple to neglect this since lots of these non-paragraph parts usually are not allowed in between paragraph tags and it often will get all sorted out anyway when HTML is parsed.
The accessibility bits are what I at all times come to Scott’s writing for:
These examples I offered initially of this submit? macOS VoiceOver, NVDA and JAWS deal with all of them as paragraphs ([asterisks] for NVDA, learn on…). […] The purpose being that display readers are in line with HTML, and perceive that “paragraphs” are extra than simply the
p
factor.
Direct Hyperlink →