HTML div and img tags disappear when I change from plain text to rich text and back to plain text

Hello! I’m trying to use div and img tags (because the documentation said that supports HTML) to customize with CSS. If I write them in the plain text editor and publish it, it works well. But if I want to edit it and change to the rich text editor, all the HTML disappears.

I understand, looking thru older posts, that there is a problem with the rich text editor and HTML. What worries me is that the HTML is lost, so if I do a gallery (for example) using div and img, it can get wiped out if I change to rich text editor by mistake. Am I doing something wrong? Is there a way to not loose the HTML content if I change to the rich text editor?

Thank you!

I can’t respond from a technical perspective at, but I do know it is “a feature” in most if not all double code (html and/or markdown and/or text/rich) editors I tried.
One can’t switch code bases without loosing at least some of the presentation you created. Either write in markdown and benefit of the luxury to enhance it with some html (like alignment of text), or write in html.
CSS editing is done in the blog preferences.

Thank you for your response.