javascript - Best way to keep elements inside DIV not to inherit page styles -
I am using CKEditor to allow user to post some rich content as comments. But while displaying, I am using DIV as parent and throwing all the stuff into it. So, obviously it gets all the CSS of the page. I want to stop it, I have options
- Avoid generic styles
p, div {...}. - DIV assigns an ID and resets all the styles applied to that div for the page.
- Use IFrame to display content. (This seems a good solution for me, but I am trying to do as much IFrames as possible).
Any new suggestion please do this?
Use BEM method for your CSS. The block-element-modifier has been an outgoing solution in all my work, including the company's stylesheets, including $ 1 billion in revenues and some three hundred engineers.
Under BEEM you will end:
. Site Search {} / * block * / .ite-search_field {} / * element * / .site-search - Full {} / * modifier * / In this case, your comments section can be a .comment block, with some elements and modifiers inside it With style things
Comments
Post a Comment