Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

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

edited June 10 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

Comments

  • edited June 10 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) {
            nodeList[i].style.removeProperty("background");
        }
    
    })();
    
  • thanks, how can I apply this code only for one sitE?

  • For fun you can always test out the Myf maneuver.

    https://forum.userstyles.org/discussion/comment/97780/#Comment_97780

  • edited June 12 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.

    https://developer.chrome.com/extensions/match_patterns

Sign In or Register to comment.