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.

simple css menu or rollover script?

Featured Replies

Evening,

 

Ok I have five images i'm using as "buttons" I want to the image to change on rollover, whats the cleanest way to do this by doing a list using li?

  • Author

ok I went for a css rollover however I can't get the "home" or "contact" buttons to work... they are visable but don't change state...

 

 

<div id="navigation">

 

<ul>

<li class="home"><a href="#">Home</a></li>

<li class="gallery"><a href="#">Gallery</a></li>

<li class="about"><a href="#">About</a></li>

<li class="services"><a href="#">Services</a></li>

<li class="Contact"><a href="#">Contact</a></li>

</ul>

 

</div>

 

 

 

CSS

 

 

 

#navigation ul {

width: 682px;

height: 51px;

position: absolute; /** Places image at the top of the page **/

top: 100px; /** Determines the height from the top of the page **/

left: 100px; /** Determines the width from the left of the page **/

background: url(menu.jpg) no-repeat 0 0;

list-style: none;

margin: 0; padding: 0;

}

#navigation li {

display: inline;

}

#navigation li a:link, #navigation li a:visited {

border: none;

width: 136px; /** width of the button in active state **/

height: 51px; /** height of the button in active state **/

display: block;

position: absolute;

top: 0;

text-indent: -7000px; /** Removes li text from the screen **/

outline: none;

}

#navigation li.home a:link, #navigation li.home a:visited {

left: 0;

}

#navigation li.gallery a:link, #navigation li.gallery a:visited {

left: 136px /** how many px left of the first button i.e blue **/

}

#navigation li.about a:link, #navigation li.about a:visited {

left: 272px /** how many px left of the first button i.e blue **/

}

#navigation li.services a:link, #navigation li.services a:visited {

left: 410px /** how many px left of the first button i.e blue **/

}

 

#navigation li.contact a:link, #navigation li.contact a:visited {

left: 546px /** how many px left of the first button i.e blue **/

}

 

#navigation li.home a:hover {

background: url(menu.jpg) no-repeat 0 -51px; /** moves image up 30px showing the rollover states **/

}

#navigation li.gallery a:hover {

background: url(menu.jpg) no-repeat -136px -51px; /** moves image up 30px and right 80px showing the rollover states **/

}

#navigation li.about a:hover {

background: url(menu.jpg) no-repeat -272px -51px;

}

#navigation li.services a:hover {

background: url(menu.jpg) no-repeat -410px -51px;

}

 

#navigation li.contact a:hover {

background: url(menu.jpg) no-repeat -546px -51px;

}

 

Can anyone see what is wrong??? please help???

Got a link?

 

<li class="Contact">

 

Change the C to lowerclass, dunno if it matters, but it was the first thing i noticed >.<

 

It looks ok to me? You've cleared your cache to be sure right?

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.