Issue #1836Opened February 26, 2019by AkibDeraiya1232 reactions

How to add !important in all the generated apis

Question

Hello @artf,

While i am going to edit some html from editor with the help of css then i need to add !important into all the css which is changed.

Let me give you an example, This is previous css

.banner-title {
    background-color: #e6d8d8;
    border: 3px #acbe5a #b83dd3;
    color: #f80000;
}

Now i am going to change this font's color with #000. then only this changed css need to be append with !important, So, new css will be get while i am going to fetch using editor.getCss() will be like,

.banner-title {
    background-color: #e6d8d8;
    border: 3px #acbe5a #b83dd3;
    color: #f000 !important;
}

Can i achieve this goal?

Answers (3)

NicoEnglerFebruary 27, 20190 reactions

I don't think you need to add !important because your element with the class .banner-title gets a unique class added holding the property that has changed.

So if you change the color, a new class is added with color: #your-color and thus the color defined in .banner-title is overwritten.

AkibDeraiya123February 27, 20190 reactions

@NicoEngler , Thank you for your valuable response. But thing is that i am loading one default template page with default css. In this css we have css like

.banner-title {
    background-color: #e6d8d8;
    border: 3px #acbe5a #b83dd3;
    color: #f80000 !important;
}

Now when i am changing the color to #000 using editor then the new css will be created like,

.banner-title {
    color: #000;
}

But thing is that default css have already !important so it will take the default template's css not the new one.

So, that's why i'm adding !important to new generated css by editor.

Let me know if you didn't got my point i can understand with more description.

Related Questions and Answers

Continue research with similar issue discussions.

Paid Plugins That Match This Issue

Curated by issue keywords and label relevance to help you ship faster.

View all plugins

Loading paid plugin recommendations...

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.