{background: !moreimportantthanimportant} (style vs !important)

edited June 2018 in Style Development Chrome
How to make background transparent if it's have "background:#fefefe !important" on site? Is it possible?
I tried some manipulations with width, height and padding but something i do wrong


  • edited June 2018 Firefox

    You can't fight an inline !important with external CSS.

    I suggest writing your style as usual but remove the inline styles with some Javascript (apply with an extension like Tampermonkey).
    For example:

    // ==UserScript==
    // @name         Remove inline important background
    // @namespace    stonecrusher
    // @version      0.1
    // @description  Removes inline styles that are specified in the script
    // @author       stonecrusher
    // @match        https://www.example.com/*
    // @grant        none
    // ==/UserScript==
    /* jshint esversion: 6 */
    (function() {
        'use strict';
        var nodeList = document.querySelectorAll("#your > .selectors, #here ~ .separated > .by.commas, .have.fun"),i;
        for (i = 0; i < nodeList.length; ++i) {
  • thanks, how can I apply this code only for one sitE?

  • edited June 2018 Firefox

    You can fight if this !important is *.css on this page or in <style> - must use same XPath / CSS selectors.

  • thanks, how can I apply this code only for one sitE?

    It will only be active for sites specified in the @match statement.

    Here is some more information, but probably unnecessary. Just paste your desired URL / Domain after // @match and you'll be fine.
    * resembles wildcard.


Sign In or Register to comment.