Additional stylesheet for rollovers
-
Okay, I’m a little bit lost here, please bear with me. ??
I’ve used rollovers in the past, and added a special class for each them in my theme’s stylesheet. It worked just fine, but I’d like to begin add rollover images regularly to my posts and it doesn’t seem right to add the theme’s stylesheet for each post.
I tried adding the following code to a specific WP post. The code worked while viewing in the browser, but when I inserted it into the post, the image displayed properly, but it didn’t change on hover like it did while viewing in the browser.
<head> <style type="text/css"> .csstest a{ display: block; width: 500px; height: 750px; background: url(https://www.littlevictorian.com/wp-content/uploads/2013/11/SofaRolloverSprite.png); background-position: 0 0; } .csstest a:hover { background-position: -500px 0; } </style> </head> <div class="csstest"><a href="https://www.littlevictorian.com/?p=1180"></a></div>
I read somewhere that I should create an additional stylesheet to house the rollover image styling. Is that the right thing to do?
And if so, how do I do that? The second stylesheet is already created and in the theme folder, but does it need to be added to the functions file to work?
- The topic ‘Additional stylesheet for rollovers’ is closed to new replies.