Learner Learner - 1 year ago 92
CSS Question

How to override inline styles in a child div?

I have two

s like below

<div class="parent">
<div class="child">

Now in the
div, I see a style called
with some pixels when I inspect it. I am surprised how its not applied to the parent

I want to override the style to
from its

My application is an angular and css3 html5, web api mvc based app.

How to do it?

I tried this

div[style] {
height: 100px;

Answer Source

If you say that inline style is being inserted dynamically and you don't know how you can't change (you really should debug till you find out how is being inserted) then to be more specific than inline styling, only using !important

NOTE this is one of the extreme cases that !important should be used. Otherwise AVOID IT

.child {
  background: red;
  height: 100px !important;
  width: 100px
<div class="parent">
  <div class="child" style="height: 30px">

You can see an answer of mine here with more details regarding this subject.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download