Home > Software design >  CSS remove styling specified in the tag in a media query
CSS remove styling specified in the tag in a media query

Time:08-03

In the HTML Code (which I can't modify) there's a div with style specified in the tag. But I don't want this style to apply in a specific media query for responsive purposes.

<div style="width:calc((100% - var(--column-spacing) * 1) * 0.4375);margin-inline-start:var(--column-spacing)"></div>

I tried to just put another value in the media query for this div but it doesn't work. Is there something I can do about it?

CodePudding user response:

Adding !important to the styles should work since it overrides the styles set in the style attribute.

CodePudding user response:

You can use the !important property in the css to override the inline css as shown below

selector {
  property: value; /* normal declaration */
  property: value !important; /* important declaration (standard) */
  property: value ! important; /* important declaration (non-standard) */
}

Nevertheless it is recommended to use it as sparingly as possible

  • Related