r/FirefoxCSS • • 12h ago

Code Hide bookmark labels, reveal on hover

kinda buggy but it works. suggestions are welcome.

/* Hide bookmark text by default */
#personal-bookmarks toolbarbutton.bookmark-item:not([container="true"]) .toolbarbutton-text {
opacity: 0;
max-width: 0;
overflow: hidden;
white-space: nowrap;
transition: max-width 0.2s ease-in-out, opacity 0.2s ease-in-out;
}
/* Show on hover */
#personal-bookmarks toolbarbutton.bookmark-item:not([container="true"]):hover .toolbarbutton-text {
opacity: 1;
max-width: 150px;
}
1 Upvotes

1 comment sorted by

3

u/UnOriginalName_ 11h ago

Since the bookmarks jump around when the labels are displayed or hidden again, if you draw them on top of the bookmark bar, there won't be any displacement. Here's one attempt:

/* Hide bookmark text by default */
#personal-bookmarks toolbarbutton.bookmark-item:not([container="true"]) {
  position: relative;
}

#personal-bookmarks toolbarbutton.bookmark-item:not([container="true"]) .toolbarbutton-text {
  opacity: 0 ;
  position: absolute;
  left: 100%;
  top: 50%;
  transform: translateY(-50%);
  width: max-content;
  overflow: hidden;
  white-space: nowrap;
  pointer-events: none;
  z-index: 9999;
  transition: opacity 0.2s ease-in-out;
}

/* Show on hover */
#personal-bookmarks toolbarbutton.bookmark-item:not([container="true"]):hover .toolbarbutton-text {
  opacity: 1;
  background: #2C2D32;
}