Guest User

Firefox CSS

a guest
Oct 2nd, 2026
38
0
340 days
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.25 KB | None | 0 0
  1. /* Various tab styling tweaks */
  2.  
  3. .browserContainer {
  4. border-width: 0 !important;
  5. }
  6. :root {
  7. --tab-margin-block: -4px -4px !important;
  8. }
  9. #tabs-newtab-button,
  10. #new-tab-button,
  11. .tabbrowser-tab {
  12. height: 21px !important;
  13. padding-inline-start: 0px !important
  14. }
  15. #tabbrowser-tabs .tab-text {
  16. font-family: 'Trebuchet MS', sans-serif;
  17. font-size: 10pt !important;
  18. }
  19. .tabbrowser-tab[selected] .tab-text {
  20. font-weight: bold !important;
  21. }
  22. .tabbrowser-tab[selected] .tab-background {
  23. border: 1.3px solid #dddddd !important;
  24. }
  25. .tabbrowser-tab:not([selected]) .tab-icon-image,
  26. .tabbrowser-tab:not([selected]) .tab-text,
  27. .tabbrowser-tab:not([selected]) .tab-throbber[busy] {
  28. opacity: 0.6 !important;
  29. }
  30. .tabbrowser-tab:hover .tab-icon-image,
  31. .tabbrowser-tab:hover .tab-text {
  32. opacity: 1.0 !important;
  33. }
  34.  
  35. /* Source file https://github.com/MrOtherGuy/firefox-csshacks/tree/master/chrome/autohide_bookmarks_and_main_toolbars.css */
  36.  
  37. #navigator-toolbox{
  38. --uc-bm-padding: 4px; /* Vertical padding to be applied to bookmarks */
  39. --uc-bm-height: calc(20px + 2 * var(--uc-bm-padding)); /* Might need to adjust if the toolbar has other buttons */
  40. --uc-navbar-height: -40px; /* navbar is main toolbar. Use negative value */
  41. --uc-autohide-toolbar-delay: 600ms; /* The toolbar is hidden after 0.6s */
  42. --uc-toolbox-browser-area-overlap: -1px;
  43. }
  44. :root[uidensity="compact"] #navigator-toolbox{
  45. --uc-navbar-height: -34px;
  46. }
  47. :root[uidensity="touch"] #navigator-toolbox{ --uc-bm-padding: 6px }
  48.  
  49. :root[chromehidden~="directories"] #navigator-toolbox{
  50. --uc-bm-height: 0px;
  51. }
  52. :root[chromehidden~="toolbar"] #navigator-toolbox{
  53. --uc-navbar-height: 0px;
  54. }
  55. /* At least on Windows 10 display scaling > 100% causes 1px gap to appear below tabs depending on Firefox
  56. * density settings and whether or not menubar is enabled.
  57. */
  58. @media (min-resolution: 120dpi){
  59. :root[uidensity="compact"] #navigator-toolbox:has(> #toolbar-menubar:is([autohide="false"],:not([autohide]))){
  60. --uc-toolbox-browser-area-overlap: -0.5px;
  61. }
  62. }
  63. @media (min-resolution: 140dpi){
  64. #navigator-toolbox{
  65. --uc-toolbox-browser-area-overlap: -0.5px;
  66. }
  67. }
  68.  
  69. #navigator-toolbox,
  70. #sidebar-box,
  71. #sidebar-main,
  72. #sidebar-splitter,
  73. #tabbrowser-tabbox{
  74. z-index: auto !important;
  75. }
  76.  
  77. :root[sessionrestored] #nav-bar,
  78. :root[sessionrestored] #PersonalToolbar{
  79. background-image: linear-gradient(var(--toolbar-background-color,var(--toolbar-bgcolor,transparent))), var(--lwt-additional-images,var(--toolbar-bgimage)), var(--toolbox-background-image,none) !important;
  80. background-position: top,var(--lwt-background-alignment);
  81. background-position-y: calc(0px - var(--tab-min-height) - 2*var(--tab-margin-block,var(--tab-block-margin,0px)));
  82. background-repeat: repeat,var(--lwt-background-tiling);
  83. transform: rotateX(89.9deg);
  84. transform-origin: top;
  85. transition: transform 135ms linear var(--uc-autohide-toolbar-delay) !important;
  86. z-index: 2;
  87. }
  88. #PlacesToolbarItems > .bookmark-item,
  89. #OtherBookmarks,
  90. #PersonalToolbar > #import-button{
  91. padding-block: var(--uc-bm-padding) !important;
  92. }
  93. :root[sessionrestored] #PersonalToolbar{
  94. z-index: 1;
  95. background-position-y: calc(0px - var(--tab-min-height) - 2*var(--tab-margin-block,var(--tab-block-margin,0px)) + var( --uc-navbar-height));
  96. }
  97.  
  98. :root[lwtheme-image] #nav-bar,
  99. :root[lwtheme-image] #PersonalToolbar{
  100. background-image: linear-gradient(var(--toolbar-background-color,var(--toolbar-bgcolor,transparent))),var(--lwt-header-image), var(--lwt-additional-images,var(--toolbar-bgimage)), var(--toolbox-background-image,none) !important;
  101. }
  102.  
  103. #nav-bar[customizing],#PersonalToolbar[customizing]{ transform: none !important }
  104.  
  105. #navigator-toolbox > #PersonalToolbar{
  106. transform-origin: 0px var(--uc-navbar-height);
  107. position: relative;
  108. }
  109. /* Using :popover-open here seems weird, but before bug 2022527 Firefox used to make the :popover "always-open" as a hacky workaround for another issue.
  110. But now that the hack was removed, we don't want to apply these rules anymore. */
  111. :root[sessionrestored] :is(.urlbar:popover-open,#urlbar:popover-open){
  112. opacity: 0;
  113. pointer-events: none;
  114. transition: transform 135ms linear var(--uc-autohide-toolbar-delay), opacity 0ms calc(var(--uc-autohide-toolbar-delay) + 135ms);
  115. transform-origin: 0px calc((var(--urlbar-container-height) - var(--urlbar-height)) / 2);
  116. transform: rotateX(89.5deg);
  117. }
  118. :root:is([window-modal-open],[customizing]) toolbar :is(.urlbar:popover-open,#urlbar:popover-open),
  119. #mainPopupSet:has(> [panelopen]:not(#ask-chat-shortcuts,#selection-shortcut-action-panel,#chat-shortcuts-options-panel,#tab-preview-panel)) ~ toolbox :is(.urlbar:popover-open,#urlbar:popover-open),
  120. #navigator-toolbox:is(:hover,:focus-within) :is(.urlbar:popover-open,#urlbar:popover-open),
  121. :where(:root[sessionrestored]) #nav-bar #searchbar-new:popover-open:is([focused],[open]),
  122. :where(:root[sessionrestored]) #urlbar-container > #urlbar:popover-open:is([focused],[open]){
  123. opacity: 1;
  124. pointer-events: auto;
  125. transition-delay: 100ms;
  126. transform: rotateX(0deg);
  127. }
  128.  
  129. :root[sessionrestored]:not([customizing]) :where(#navigator-toolbox){
  130. margin-bottom: calc(var(--uc-toolbox-browser-area-overlap,0px) - var(--uc-bm-height) + var(--uc-navbar-height)) !important;
  131. }
  132.  
  133. /* Make sure the bookmarks toolbar is never collapsed even if it is disabled */
  134. :root[sizemode="fullscreen"] #PersonalToolbar,
  135. #PersonalToolbar:is([collapsed=""],[collapsed="true"]){
  136. min-height: initial !important;
  137. max-height: initial !important;
  138. visibility: hidden !important
  139. }
  140. #PersonalToolbar:is([collapsed=""],[collapsed="true"]) #PlacesToolbarItems > *,
  141. :root[sizemode="fullscreen"] #PersonalToolbar #PlacesToolbarItems > *{
  142. visibility: hidden !important;
  143. }
  144.  
  145. /* If bookmarks toolbar is collapsed on startup, then no items are generated, and we need to set some height for it */
  146. #PlacesToolbarItems:empty{
  147. height: var(--uc-bm-height);
  148. }
  149.  
  150. /* Selected tab needs higher z-index now to "hide" the border below it */
  151. .tabbrowser-tab[selected]{ z-index: 3 !important; }
  152.  
  153. /* Show toolbars when a window modal dialog is open, otherwise toolbar layout breaks after closing the dialog */
  154. :root[window-modal-open] :is(#nav-bar,#PersonalToolbar){
  155. transition-delay: 100ms !important;
  156. transform: rotateX(0);
  157. }
  158.  
  159. /* SELECT TOOLBAR BEHAVIOR */
  160. /* Comment out or delete one of these to disable that behavior */
  161.  
  162. /* Show when urlbar is focused */
  163. #nav-bar:focus-within + #PersonalToolbar,
  164. #navigator-toolbox > #nav-bar:focus-within{
  165. transition-delay: 100ms !important;
  166. transform: rotateX(0);
  167. }
  168.  
  169. /* Show when cursor is over the toolbar area or when some menu panel is open */
  170. #mainPopupSet:has(> [panelopen]:not(#ask-chat-shortcuts,#selection-shortcut-action-panel,#chat-shortcuts-options-panel,#tab-preview-panel)) ~ #navigator-toolbox > :is(#nav-bar,#PersonalToolbar),
  171. #navigator-toolbox:hover > :is(#nav-bar,#PersonalToolbar){
  172. transition-delay: 100ms !important;
  173. transform: rotateX(0);
  174. }
  175.  
  176. /* This makes the tab notification box show immediately below tabs, otherwise it would break the layout */
  177. #navigator-toolbox > div{ display: contents }
  178. :where(#navigator-toolbox > #TabsToolbar,#navigator-toolbox > #toolbar-menubar,#tab-notification-deck,.global-notificationbox,#notifications-toolbar){
  179. order: -1;
  180. }
  181. :root[BookmarksToolbarOverlapsBrowser] #navigator-toolbox{
  182. margin-bottom: calc(-1px - var(--uc-bm-height) + var(--uc-navbar-height)) !important;
  183. z-index: auto !important;
  184. }
  185. @media -moz-pref("browser.fullscreen.autohide"){
  186. :root[sizemode="fullscreen"] #navigator-toolbox[style*="margin-top"]{
  187. margin-top: calc(1px - var(--tab-min-height) - 2 * var(--tab-margin-block,var(--tab-block-margin,0px))) !important;
  188. }
  189. }
  190.  
  191. /* Set the following pref to enable compatibility with multi-row_bookmarks.css */
  192. @media -moz-pref("userchrome.autohide-bm-and-main-toolbars.multirow-bookmarks-compat.enabled"){
  193. #navigator-toolbox{ margin-bottom: var(--uc-navbar-height) !important; }
  194. #PersonalToolbar:not([customizing]){
  195. min-height: 0 !important;
  196. margin-bottom: 0;
  197. height: 0;
  198. overflow-y: visible !important;
  199. z-index: 2;
  200. padding-inline: 0 !important;
  201. }
  202. #personal-bookmarks{
  203. background: inherit;
  204. height: min-content;
  205. }
  206. #PlacesToolbarDropIndicatorHolder{
  207. pointer-events: none !important;
  208. }
  209. }
  210.  
Tags: CSS
Advertisement
Add Comment
Please, Sign In to add comment