Howdy, Stranger!

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

about:blank domain exception for background color

Hi,

I've set the following to have about:blank be displayed in blue :
@-moz-document url("about:blank") {html {background:#004CD0;}}

I omitted the !important so up to now I've encountered no color problem on sites using about:blank
Yet, I encounter a true difficulty on protonmail.com which uses about:blank in its email composition window ... resulting in the background color I've chosen.

I'd like to know if it's possible to insert in the above rule an exception for a given domain :
@-moz-document url("about:blank") {html {background:#004CD0;}} BUT NOT on domain1, domain2

Thanks

Comments

  • edited October 8 Firefox
    If there is a way to detect that about:blank is in an iframe (and not style it there), that should solve the problem. But I'm not aware of such a thing in pure CSS. (User scripts can distinguish, but usually do not run on about: pages.)

    What if you think about it the other way around: a common way a site enables about:blank as a rich text editor composition area is to add the contenteditable attribute to an element, perhaps the body. So maybe something like --
    @-moz-document url("about:blank") {
    html {background:#004CD0;}
    body[contenteditable] {background:#f5f5f5;}
    }
    -- would work?
  • myfmyf
    edited October 9 Chrome

    I'm using head:empty + body:empty selector to prevent unwanted styling of about:blank content when something alters its content for quite a while and it seems to work well in Firefox with Stylish.

    OP, you your UA reads Chrome, my Stylus tells me it is not possible to style about:blank in Chrome. Even if it was, my approach would not most probably work, if style was injected into document like it is from userscript.

Sign In or Register to comment.