+ 3
How do we write blocks of code with the code tag?
Learning
2 Réponses
0
<code>A piece of computer code</code>
It's basically for formatting, so I wouldn't overthink it.
0
pre preserves spaces and line breaks. it's not that different from the code tag, except that if you use the code tag, it's supposed to indicate that the element contains code (assigns semantic meaning), while pre is just for formatting (no special meaning).
https://www.w3schools.com/tags/tag_pre.asp
You can compare the "Default CSS Settings" for each.