How to create an independent HTML block?

Hi all,

I want to know if there is some way to create an independent HTML block .

For more explanation :
My problem is that I have a webpage in which I allow some users can add content (may contain HTML & CSS )
I allow them to add their content inside a certain <div> block , but sometimes their content may not be clean code , and may contain some DIVS with no end , Or even some DIV end with no starting DIV
This sometimes distort my page completely

Is there any way to make their content displayed independently from my parent div , so that my div is first displayed well , and then the content inside it is displayed ?

I’m sorry for long message .
Thanks for any trial to help

Dr Mostafa