Why is the default for "Always add !important to CSS styles" set to "yes"?

Tagged: 

Author Posts

Bellul

Why is the default for “Always add !important to CSS styles” set to “yes”? Isn’t !important considered as a last resort? And the MT-css is loaded last, isn’t it?


Sebastian

Hey Bengt,

Thanks for your question. I appreciate that this decision seems a bit strange to developers, as we are discouraged from using !important. It’s basically because complete beginners have no concept of CSS specificity and would frequently try to apply styles that don’t work because the selector MT suggestions happens to have a lower specificity score than competing CSS rules added by the theme, builder, or plugin. And they would not be in a position to understand the “Always add !important to CSS styles” preference, even if they were to stumble across it.

More experienced users, who may initially be alarmed to see !important globally applied, are in a better position to understand the issue and turn off the setting. Turning it off removes !important from all existing styles too, so should not be too inconvenient.

There is some room for improvement here though. I plan to add a configuration screen when MT first loads which shows the beginner-oriented settings that are on by default, to allow more experienced users to adjust these from the start. I will also provide an option for importing all workspace settings, to make it easier to work consistently across sites.

I hope that helps explain things a bit. Please let me know if you have any more questions.

Cheers,
Sebastian


Bellul

Thanks for the clarification!

You must login or register to reply to this topic.