Basically: no, there is no way to achieve this with CSS alone.
But, if this is seen as a CSS riddle (I recommend you not use the following solution in any real application at all), you could achieve something similar. Again, this will completely abuse both HTML and CSS.
Basically you create a lot of divs , each meaning "pixel". You change the divs ' background-color to :hover and save the background-color state after :hover using the (another offensive) transition trick (pseudo-infinite delay).
Here is a demo: a small link . Try hanging on the tops to see the breadcrumbs that are drawn when you move the mouse.
I, again, exaggerate, this is completely offensive and should not be used in any particular application.
This can be expanded to create a small paint program using CSS. I made a small belt to illustrate: another small link (try drawing by clicking and moving the mouse!)
Bottom line: Use JavaScript - this is the only resort in this case (you cannot control the canvas without JavaScript).
Chris
source share