< or << keyword in HTML5

I was typing in a <code> element, when I wrote something like 122fff<<kasldksa.

I believe this behaved with strange behaviour (hiding massive blocks of text) with {white-space: pre-wrap}.

I also am sure that with {white-space: normal}/default white-space, < or << have no effect, but does change the color/markdown of the following code/text in the html panel.

TL;DR: What are the < and << “keywords” in HTML5? :cry:

the < is the start of a tag, tags are code instructions, not text to be displayed, so the characters are hidden. You can use &lt; for < and &gt; for > when you want them in text

Ohh oops, thanks for telling me!

I’m interested about the special format, is there any other special characters that are “key characters”, and have a special way of writting them in text?

On second thoughts, isn’t \ the general syntax for the compiler to ignore the next character and to translate it as string?

Yes, it seem you can escape < with \ so to write <html>, but also using the ascii characters is not a bad idea, the result is the same

1 Like

Here is an MDN link as well.

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.