Skip to content

Overwriting External Styles

James Millar edited this page May 7, 2015 · 1 revision

The capacity to override style is broadly determined by the source of the style.

Injected HTML with Inline Style

  • CANNOT be overwritten by normal CSS styles
  • Can be overwritten by !important CSS styles

Injected HTML with Inline Style with !important

  • CANNOT be overwritten by !important CSS styles
  • Can be overwritten by JavaScript Dom style manipulation

NB. Elements with Inline Styles can be targeted by selecting on the 'style' attribute. Example: div[style] {}

Linked Styles

  • Normal CSS specificity applies

Content in iFrame on same domain

  • CANNOT be targeted by CSS styles in parent page
  • Can be overwritten by Javascript DOM style manipulation

Content in iFrame on same different domain

  • CANNOT be targeted by CSS styles in parent page
  • CANNOT be overwritten by Javascript DOM style manipulation