3

There is a html page customized with css styles(I cannot change this css). One tag of this page designed as a container for dynamic html data. How can I "reset" css settings for this div(css styles defined in the page have no influence on the content of this div)?

I have access only to dynamic html and I can add more css styles to a page.

Le_Coeur
  • 1,521
  • 5
  • 28
  • 44
  • Post the parent CSS you need to modify. – Czechnology Mar 14 '12 at 20:55
  • 1
    are the css styles defined before or after the dynamic css styles? Have you tried to make the styles more specific for the div? – kamalo Mar 14 '12 at 20:55
  • Css styles of the main page can be different each time – Le_Coeur Mar 14 '12 at 20:56
  • 1
    Have you tried using !important? – j08691 Mar 14 '12 at 20:57
  • If you REALLY need to reset the style, which I wouldn't recommend performance-wise, you can modify the plugin getting the computed style to reset everything: http://stackoverflow.com/questions/1004475/jquery-css-plugin-that-returns-computed-style-of-element-to-pseudo-clone-that-el – Smamatti Mar 14 '12 at 21:22
  • possible duplicate of [Reset/remove CSS styles for element only](http://stackoverflow.com/questions/15901030/reset-remove-css-styles-for-element-only) – T.Todua Feb 28 '14 at 13:04

2 Answers2

4

If I understand you correctly the problem you have having is that the CSS for the main page is affecting the CSS for your "dynamic" div. For the most part there is nothing you can do about that, other than specifying higher-priority styles to the dynamic content you are loading.

You can do this by doing in-line css, or by doing other more specific CSS declarations in a file or tags.

GoldenNewby
  • 4,382
  • 8
  • 33
  • 44
3

The answer is not to "reset" the styles, but rather to SET the styles you want on the div, to override whatever the page styles throw at you. In your situation you'll need to either edit the style attribute, or modify the javascript style properties.

joshuahealy
  • 3,529
  • 22
  • 29