Tim Streater said:
....
Yes, OK with all of that. In my instance, I have a :hover and a
:hover:before. So I suppose the :hover makes the link element have
relative positioning, and then the pseudo-element created by
:hover:before has absolute positioning relative to the link. ...
....
Yes, in your case something like that. You in fact specifically
attach a relative positioning on the [data-phishtip]:hover and
presumably in this new CSS3 the data syntax causes the class to
attach to whatever contains the data-phishtip="..." in the HTML.
Naturally, not all combinations of CSS were in the minds of the
inventors. There used to be the HTML attributes: link, alink,
vlink, which would be put on BODY; these were for the links
before any action, for activated (selected or click on and hold
down), and visited links. I don't know of any attribute for
hover, something everyone would want these days and easily
supplied (for links at least) with a CSS pseudo-class. And then
there are some pseudo-elements to supply various needs and these
can be styled.
Having got these extra classes to take over the styling, all
sorts of possibilities get opened up. Positioning
pseudo-elements! What was probably a simple inline mechanism to
shift a line of text left or right (and reflow whatever else to
accommodate) and add a bit of extra on an action, can be turned
into tricks with positioning. You might be surprised at how
different browsers react to these gymnastics, it is not all
smooth sailing as if it has all been thought through from the
beginning and there are total rights and wrongs. There is some
indeterminacy. As we have witnessed in this thread to some extent.
The reason :before is so named is it was expected to be inserted
in the flow before the original content. Similar remarks apply to
:after and to be seen in my above url. But once you start
*positioning* this pseudo element, its name becomes pointless,
because it can be positioned anywhere at all and relative to
almost anything. In fact, the :before element could be positioned
visually to after the original text and the :after to before!
You can push the boundaries of the original technology to do
various odd things, using these two pseudo elements. When you
position absolutely, you are just more than lucky to have the
two, rather than just one, both being as good as the other, both
as positionable as the other, the essential quality of them being
that they are created on an action rather than in the HTML doc.
Like identical ghosts for hire, you hire them to do any
particular scaring you want ... to make your mother-in-law leave,
to scare your teenage kids out of their complacency...