How do we write blocks of code with the code tag? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

How do we write blocks of code with the code tag?

Learning

12th Oct 2018, 10:11 AM
Malkiat Singh
Malkiat Singh - avatar
2 Answers
0
<code>A piece of computer code</code> It's basically for formatting, so I wouldn't overthink it.
12th Oct 2018, 1:07 PM
Janningā­
Janningā­ - avatar
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.
14th Oct 2018, 2:04 AM
Janningā­
Janningā­ - avatar