How to tell style tag to get property from class?

I know this question seems strange but you’ll see it is not so difficult to understand.

I am writing this rules with javascript:

    var cap_style = {
        all:'initial',
        'display':'block',
        'max-width':'100%',
        'position':'relative',
        'height':'auto',
        'margin':'0 auto'
    };

I used the rule all:'initial' to get rid of the css that the element may get from the css of the page. The problem comes when, after that I want to add a class to transition it:

.transitioned{
  -webkit-transition: height 1s ease;
  transition: height 1s ease;
}

As you’ll see, the class doesn’t affect because all:initial sets it again to: transition: initial.

As you can see, I’m overriding part of the all:initial properties, for example, I override display, max-width and position. So the question is:

Would it be possible to override the transition property to make it inherit from the class?

If possible, it would be something like:

    var cap_style = {
        all:'initial',
        'display':'block',
        (...)
        'transition':'super'
    };


Source: css

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.