is there a semantic html/css tag way to denote monospace/serif/sans typography?

i guess one can write this via span classes but that won't be very semantic?

.monospace { font-family: monospace}
.sans {font-family: sans}
.serif {font-family: serif}

Some normal text, <span class="monospace"> some typewriter text</span>...



@randomdent nothing breaks, it's all design!

<pre> sets the content of the block as "preformatted". meaning (usually) monospace font and line break on \n

not completely sure what you're trying to do, but i guessed <pre> might be the closest.

if you just want different fonts, css classes are the way to go. if you want the hypertext to differentiate content semantically, use <pre> and <p> (though this won't distinguish between serif and sans fonts)

@ruffni if you have a free flowing text that is wrapped at the block/element boundary - like all text in html excluding that inside <pre> - than wrapping at \n (newlines) (and no-wrap elsewhere) is actually breaking text flow and wrapping functionality. also <pre> semantically means preformated and not 'font-family: monospace' - it's just a default which can be changed

Sign in to participate in the conversation

The social network of the future: No ads, no corporate surveillance, ethical design, and decentralization! Own your data with Mastodon!