You need to allow the needed tags in a custom RTE preset.
Here is how to implement a custom preset:
https://docs.typo3.org/c/typo3/cms-rte-ckeditor/main/en-us/Configuration/Examples.html#how-do-i-create-my-own-preset
And here you can see how to allow the needed html tags in the RTE:
https://docs.typo3.org/c/typo3/cms-rte-ckeditor/main/en-us/Configuration/Examples.html#how-do-i-allow-a-specific-tag