Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End Trying to create a CSS Sprite in WP

  • This topic is empty.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #28653
    kloy
    Member

    I’m trying to use CSS sprites for my navigation in the header .php file in wordpress.
    This is my first attempt at making a CSS sprite and the first time I’m using a wordpress template..

    I’m trying to use background image in the CSS for link and hover states –I think my CSS is OK, but it’s not working.

    I have a feeling I need to do something with the html or php in the .php file but I’m not exactly sure what. Here’s what I have, that’s not working…

    Code:

Code:
li.toplist #homebtn a:link{width: 88px; height: 46px; background-image: url(images/topnav_01.png) no-repeat; }
li.toplist #homebtn a:hover {width: 88px; height: 46px; background-image: url(images/topnav_01.png) no-repeat;background-position:0px -46px; }
#73792
noahgelman
Participant

You don’t need to restate the css properties on the :hover part, they stay there. All you need on the :hover part is background-position. And I believe in order to use background position you you need to state 2 positions for the image background. For example

li.toplist #homebtn a { width: 88px; height: 46px; background-image: url(images/topnav_01.png) top center no-repeat; }

li.toplist #homebtn a:hover { background-position:0px -46px; }

Viewing 2 posts - 1 through 2 (of 2 total)