Skip to main content

Day 65 of 100DaysOfSpec, hr and pre elements

I am reading and taking notes on the HTML specifications for 100 days as part of #The100DayProject. Read the initial intent/backstory. I am a Microsoft employee but all opinions, comments, etc on this site are my own. I do not speak on behalf of my employer, and thus no comments should be taken as representative of Microsoft's official opinion of the spec. Subsections not listed below were read without comment.

Currently reading in 4.4 Grouping content.

UAs = user agents = browsers and other HTML document parsers/renderers

4.4.2 The hr element

“The hr element represents a paragraph-level thematic break”, as opposed to the old use for it as a decorative separator line.

  • Doesn’t take any child elements/nodes (including text); is a self-closing tag.
  • Default ARIA role is separator, but can set presentation.
  • Doesn’t affect the document outline.

4.4.3 The pre element

“ The pre element represents a block of preformatted text, in which structure is represented by typographic conventions rather than by elements.”

  • Takes any global ARIA role.
  • I’ve pretty much exclusively used <pre> for code, but can also be used for ASCII art or including an email and retaining hard break paragraphs and bullets.
  • “…a leading newline character immediately following the pre element start tag is stripped.”
  • Need to consider how placing something in a <pre> might strip away understanding that comes from semantic elements: an accessibility issue for users of screen readers, etc.

Short one today. Spent much of my commute ogling the beauty of the PNW and daydreaming!

Responses

My blog uses Webmentions. Responses from Mastodon and other sites that send Webmentions will show up here.

No Webmentions have been sent to this post yet.