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.

Pure css buttons

Featured Replies

I'm trying to put together the simplest possible code for some buttons in my sidebar

 

in the html

 

<a href="http://www.mydomain.com/contact" id="buttonContactEmail" class="sidebarButton"></a>

 

and the css class

 

.sidebarButton
{
width:225px;
height:59px;
display:block;
}

 

and id

 

#buttonContactEmail, #buttonContactEmail a:link, #buttonContactEmail a:visited
{background-image:url(images/buttonContactEmail.png);}

#buttonContactEmail a:hover, #buttonContactEmail a:active
{background-image:url(images/buttonContactEmailHover.png);}

 

The button shows up fine. The only thing that doesn't work is the hover/active background change. The image name and location for the rollover image are definatly correct.

 

I had a look in firebug and

 

#buttonContactEmail a:hover, #buttonContactEmail a:active
{background-image:url(images/buttonContactEmailHover.png);}

 

isn't getting loaded at all, its not being superceded by another css value, its just not getting loaded. Its in the same css file as the

#buttonContactEmail, #buttonContactEmail a:link, #buttonContactEmail a:visited

line and the class value

 

Aby ideas?

 

Thanks

a:hover will only hover the link text, you need to use :hover (

#buttonContactEmail:hover

) to get the button to hover. It might not work on versions of IE though

It's the other way around.

 

This:

 

#buttonContactEmail a:hover, #buttonContactEmail a:active
{background-image:url(images/buttonContactEmailHover.png);}

 

Should be this:

 

a#buttonContactEmail:hover, a#buttonContactEmail:active
{background-image:url(images/buttonContactEmailHover.png);}

Hope this helps.

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.