-3

How can I plain old just the value of margin-left on !important? Here is a example:

.property{
  margin-left: -10%;
}
.property.more{
  margin-left: no value here;
}

I would like the margin-left to be like it was never set. I have tried calc (even none) and everything, but nothing seems to work. Any ideas?

michael jones
  • 680
  • 1
  • 7
  • 17

2 Answers2

7

you can use inherit/initial as margin left

.property.more{
  margin-left: inherit !important;
}

initial Will sets this property to its default value

inherit Will set make it inherit this property from its parent element

Read more to understand how values work

Update: Making !important depends on what other js/css manipulation you make that effects precedence

so

.property.more{
      margin-left: inherit;
    }  

In your case as @smokeyPHP said '.property.more is more specific than .property'. this will work fine.

A.B
  • 19,005
  • 3
  • 31
  • 64
2

If you don't care about IE support, you can use initial or unset

JDB
  • 23,357
  • 5
  • 68
  • 116