Why do we need var,code,kbd,samp tags we can display the contents in other tag also??? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Why do we need var,code,kbd,samp tags we can display the contents in other tag also???

for the interview purpose so I asked

25th Dec 2017, 12:52 PM
kanthraj s
kanthraj s - avatar
2 Answers
+ 1
true, but it's a convention , so browsers can apply default styles , even if you forget to, or can't, for example, browser will apply monospace font to code tags, it's better this way also because, code sections should look same for everybody, it's convenient
25th Dec 2017, 1:08 PM
Morpheus
Morpheus - avatar
+ 1
in addition to it.. every tag rendered by the browsers have meaning specific.. like as you said you can format codes in other tags but why using code tag? because it's even better for browser understanding and SEO optimization.
25th Dec 2017, 1:25 PM
Мг. Кнап🌠
Мг. Кнап🌠 - avatar