Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

CSS Rollovers

Featured Replies

So another interesting thread from across the pond 8)

 

I have a client who has four images going across the screen. When the user rollsover them I want the images to disappear and four word to appear in their place (one at a time as the mouse goes over each one).

 

I know there is a way to do a CSS Rollover, but before I dive into trying to tailor make one base on one I find on Internet, I thought I'd ask if anyone has an particular ideas how to do exactly what I want in CSS.

 

Thanks! 8)

 

-Seth

You could have each each image as a background image to a <a> tag and hide the text according to the hover state.

 

In code

a {
display:block;
height:whatever px;
width:whatever px;
background: url (path/to/your/image);
text-indent:-5000px;
}
a:hover {
background:none;
text-indent:0;
}

You could have each each image as a background image to a <a> tag and hide the text according to the hover state.

 

Nice one ElanMan ;)

*you can even create some animation effect with JQuery ^_^ * (no javascript would default to the css solution from ElanMan)

  • Author

but what if i wanted to go between two images and not between image and text?

but what if i wanted to go between two images and not between image and text?

 

Just have a new background image for the hover state:

 

a:hover {
background: url (path/to/your/image);
}

 

You can also have both the 'on' and 'off' states in the same image file and use CSS to reference the appropriate part for each state using the 'background-position:' property (the so-called 'CSS Sprites' technique).

 

James

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.