2

I'm using Tampermonkey and trying to change the CSS of the body tag. However the usual way to add CSS doesn't work,

GM_addStyle("body {overflow:visible !important}");

I think because the CSS I'm trying to change is added inline by a script. Dev tools indicates overflow: hidden is an inline style; and the overflow: hidden style only appears in dev tools, not in "view source".

<body class="fixed-scroll-nav blah-blah-blah" style="overflow: hidden;">

I have the Tampermonkey script set to run at document-end. I can manually add overflow: hidden in dev tools and confirm it's the correct selector.

Do I need a different JavaScript or Tampermonkey function?

Brock Adams
  • 90,639
  • 22
  • 233
  • 295
BlueDogRanch
  • 721
  • 1
  • 16
  • 43
  • 1
    Something else is going on. (1) Link to the target page (or provide a [mcve]). (2) Is the script using `document-start`? (3) Browser version? Tampermonkey version? (4) Verify that the script does `@grant GM_addStyle`. – Brock Adams Jun 03 '19 at 14:59
  • Also, there should be a semicolon after `!important` (but that's probably not the issue for most browsers). – Brock Adams Jun 03 '19 at 15:02
  • 4
    Ah, my bad. `// @grant GM_addStyle` was missing. Fixed. Add that as your answer. Thanks! – BlueDogRanch Jun 03 '19 at 16:14

0 Answers0