Notion Full-Width Pages in Narrow Viewport

Allows pages to fill the viewport width when the viewport is narrow.

  1. // ==UserScript==
  2. // @name Notion Full-Width Pages in Narrow Viewport
  3. // @namespace Notion Custom Scripts
  4. // @match *://www.notion.so/*
  5. // @grant none
  6. // @version 0.1
  7. // @author Jacob Zimmerman (jczimm) <jczimm@jczimm.com>
  8. // @description Allows pages to fill the viewport width when the viewport is narrow.
  9. // ==/UserScript==
  10.  
  11. function addStyle(cssCode) {
  12. const head = document.querySelector('head')
  13. if (head) {
  14. const style = document.createElement('style')
  15. style.type = 'text/css'
  16. style.innerHTML = cssCode
  17. head.appendChild(style)
  18. }
  19. }
  20.  
  21. addStyle(`
  22. @media (max-width: 850px) {
  23. .notion-overlay-container > div > div > div[style*="relative"] { /* don't select the gray background overlay, which has position: absolute */
  24. max-height: unset !important;
  25. max-width: unset !important;
  26. width: 100% !important;
  27. height: 100% !important;
  28. top: 0 !important;
  29. }
  30. .notion-overlay-container .notion-quick-find-menu,
  31. .notion-overlay-container .notion-quick-find-menu > div {
  32. max-height: unset !important;
  33. max-width: unset !important;
  34. }
  35.  
  36. .notion-frame > .notion-scroller > div:not(.notion-page-content) > div,
  37. .notion-page-content {
  38. padding-left: 1em !important;
  39. padding-right: 1em !important;
  40. }
  41.  
  42. .notion-frame > .notion-scroller > div:not(.notion-page-content)[style*="padding"] {
  43. padding-left: 0 !important;
  44. padding-right: 0 !important;
  45. }
  46.  
  47. div[data-block-id] {
  48. max-width: unset !important;
  49. }
  50. }
  51. `)

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址