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

  1. Avoid generic styles p, div {...} .
  2. DIV assigns an ID and resets all the styles applied to that div for the page.
  3. 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

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -