How does StackOverflow create its tag system. How can it format the html in a text area?
I just don’t know where to begin. If someone could guide me, then I can know what direction to take so I can write some code that someone can check.
Like this:

EDIT:
Basically, when I press space, how do i add a new element/div to the inside of the div?
What I would do is:
When you write inside the input and let’s say you select HTML, it creates a span in the left DIV and reduces the width of the right div to match the remaining size. Of course, inside your span there’s the text HTML with the delete sign.
You could do it easily using jQuery.
Example:
And you write some jQuery / JS