Is there an easier way to indent in HTML?

I’m doing my technical documentation project and chose to explain HTML, but I want to have nested code when I show code. When I looked up how to indent online, people said the best way is to make a bunch of divs and add a margin-left to them in order to show indentation. I’ve done this so far, but it’s just a lot of code, kinda messy to me.

Is there an HTML symbol for indentation, like there is for an opening bracket (&lt) and a closing bracket (&gt)?

You can use pre or code with white-space that keeps the tabs:

<pre>
  // level1
    // level 2
</pre>
<code style="white-space:pre">
   // level1
    // level 2 
</code>
2 Likes

Thank you! This looks a lot better now

&nbsp;

There are a few whitespace html entities
https://dev.w3.org/html5/html-author/charref

1 Like

Woooow

Thank you, I saved it to my bookmarks :+1: