There are many ways to do rollover menus. Some people would fight to the death over their favourite way to do things. I’m not going to argue this is the best way but the simplest when using the CMS package Joomla.
This tutorial requires the Extended Menu module (which I recommend by itself as essential for any Joomla install).
Menu Images as sprites
Sprites are becoming a preferred method for storing small graphics to be displayed on a web page. It is basically taking several graphics and merging them into the same file, then extracting them by referring to specific pixel co-ordinates. In terms of the web it can help to reduce image file sizes and more importantly http requests. For more info check out this article about CSS Sprites.
I’ve decided to use this technique to store the different states of a menu image. In-active, rollover and active. As you can see I’ve put each menu state in the same file as exactly the same size, one on top of the other. The measurement that will be important later will be our height which is 44 pixels.

Once you have created your images, upload them into the /images/stories directory of your Joomla install. This is where you can select images for you menu items.
Setup menu
In the Joomla administrator, go to the menu you have created for this effect. Open up the first menu item. On the right hand side you have the option of selecting a menu image. From the drop down list, select the menu image you saved previously and then click save.
Repeat for each menu item you want to be represented by an image.
Extended Menu Module
Next is to configure your Extended Menu module in Joomla. The settings we need to take note of are the following:
- Change “Menu Name” to the name of the menu you have setup.
- Menu style should be “Flat List“.
- Set “Show Menu Icons” to “Image Only (Linked)“.
Click save to save your changes.
At this point if you view the page with your menu, you will see all 3 button states of each menu item. In order to only see the current menu state we need to apply some CSS styles.
CSS Menu Styles
Open up the CSS file for the specific Joomla template you are using and add the following (because my menu is in the header I’m preceding styles with the header ID):
#header ul li {
overflow: hidden;
height: 44px;
float: left;
}
First style here is setting the height of our button. This is essential so that we’re only seeing one state at a time. Then we set the overflow to be hidden. This ensures the non active button states are hidden from view. Floating each item allows us to create a horizontal menu.
#header ul li a {
display: block;
}
Setting the anchor to block ensures that the entire surface area of the link will be clickable. It also makes sure our button fills up the entire space we’re allotted it in the previous declaration.
#header ul li a:hover {
margin-top: -44px;
}
This is the magic part. We’re setting our anchor hover state to slide the image up revealing our next portion of the sprite. We have to do this on the anchor tag as IE6 only works when the hover state is on the anchor tag.
#active_menu {
margin-top: -88px;
}
The Extended Menu module adds an id tag to whichever menu item is active. This allows us to specify a different offset to show the active image state.
And that’s it! With a few simple lines of CSS and our Extended Menu module we’re able to create effective rollover menus with ease.