I have a website that wraps some kind of user-generated content, and I want to be able to separate layout for layout and layout from user-created content, so ug content cannot break site layout.
User content is trusted because it comes from a well-known group of users on my network, but nevertheless only a small subset of html tags is allowed (p, ul / ol / li, em, strong and a couple more). However, user-generated content is not guaranteed to be well-formed, and we have had some cases of distorted user-generated content that violates the site’s layout.
We work with our users so that the content is well-formed, but in the meantime I'm trying to find a good way to separate the content from the layout. I searched for namespaces but couldn't find good CSS support documentation for nested namespaces.
Anyone have any good ideas?
EDIT
I saw some really good suggestions here, but I should probably clarify that I have absolutely no control over the input mechanism that users use. They inject content into one system, and my page uses this system API to extract content from it. This system uses TinyMCE, but, as I said, we still get incorrect content.
source share