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:

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

Thank you! This looks a lot better now


There are a few whitespace html entities

1 Like


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