[discussion]css security issue

How to prevent thirty-party css code from damaging my own page style?

My Case condition:
1. Page’s style can be customized by third-party css code
2. Page has its own private section which doesn’t allow other code modify its style.

For example:

Page may like this:
<div class=“page”><div class=“other”></div><div class=“.psm”><h2></h2></div></div>

Thirty party code may like this:
.page{ color: red;}
.page h2{color: blue; font-size: 100px;} /* danger: it will influence the .psm h2 which is a private section */

So, how to provide a way to satisfy above two condition? which means letting
thirty-party css code customize all page content but the private section?

Any ideas?

You could place the private section in an iframe. That would protect it from other CSS declarations on the page.

iframe solution will have js issue. For private section is owned by system, which should have the whole permission to the system data or server action.

Well apart from that, perhaps people in the CSS forum might have some ideas.

They might know if namespacing or other techniques are available, or unique class names may be the only other option.

You can’t be the only one to face your issue. Are there others developing in a similar nature to you who have already faced and solved your same dilemma?

Paul, Thanks for your suggestion!

Thread continued in the CSS forum: http://www.sitepoint.com/forums/css-53/[discussion]css-security-issue-741897.html

Thread closed.