css selectors - Is it possible to add text to every image path on hover using CSS? -
i'm wondering, have alot of image on website behave depending on class. wondering if possible using css example.
.willreactonhover.class1{ background: url('../images/image1.png');} .willreactonhover.class2{ background: url('../images/image2.png');}
and then, on hover
.willreactonhover:hover{ background: /*here, .class1 .image1-hover.png , .class2 .image2-hover.png */ }
i don't know if it's possible had suffix -hover existing path if different... know in javascript i'd love pure css solution else i'll have create hover event every class since it's same task each class don't know if there's way it'd optimal. or maybe there css selector use achieve this?
before css-3 people used background-position
along image-sprite use old-horse background-position , :
.willreactonhover.class1{ background: url('../images/image1.png');} .willreactonhover.class2{ background: url('../images/image2.png');} .willreactonhover:hover{ background-position:-10px; }
Comments
Post a Comment