BLOG.RONSOME.COM

Greasemonkey and Pseudo-Classes

February 22, 2010

While fiddling with a Greasemonkey script, I discovered an interesting little CSS tidbit today.

<div class="bookmark">
  <span class="balloon">...</span>
</div>

I have several divs with class="bookmark". Each div.bookmark contains a child, span.balloon. I was attempting to make .balloon hidden by default, and visible when I hovered over .bookmark.

.balloon {
  visibility: hidden;
}

.bookmark:hover .balloon {
  visibility: visible;
}

This didn't work for me. Scratching my head, I checked everything I could think of, and naturally came to the conclusion that the :hover pseudo-class simply doesn't work with Greasemonkey. Of course, such a conclusion didn't sit well, and I went back to the basics. I found that body:hover worked just fine. div:hover worked as well. Working from there, I tried div:hover.bookmark. Eureka! Apparently pseudo-classes in Greasemonkey need to be attached to an element in order to work.

Labels: , , ,

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]



<< Home