Jump to content

list with background images as buttons


Recommended Posts

I'm trying to create a group of navigation buttons using <ul> and background images.  The problem is that no matter what I set the height and width of the <li> or <ul> or <a> the image only shows directly behind the words and I don't get the full button. 

html:
[code]
  <div id="siteNav">
    <ul id="siteNavList">
      <li id="stock"><a href="http://www.skyartstock.com" title="stock photos">stock photos</a></li>
      <li id="prints"><a href="http://www.skyartprints.com" title="fine art prints">fine art prints</a></li>
      <li id="aj"><a href="http://www.arjenandjerrineverkaik.com" title="a & j verkaik">a & j verkaik</a></li>
    </ul>
  </div>
[/code]

css:
[code]
#siteNav {
margin: 100px 0px 0px 800px;
width: 97px;
}

#siteNavList {
        white-space:nowrap;
list-style-type:none;
width: 97px;
}

#siteNav ul li {
font-size: 10pt;
}

#siteNav ul li a {
width: 97px;
height: 27px;
color: #FFF;
text-decoration: none;
}

#siteNav ul li a:visited {
color: #C36AC9;
text-decoration: none;
width: 97px;
height: 27px;
}

#stock a {
background-image: url(../images/SS-002311.jpg);
background-repeat: no-repeat;
width: 97px;
height: 27px;
}

#prints a{
background-image: url(../images/SP-915525.jpg);
background-repeat: no-repeat;
width: 97px;
height: 27px;
}

#aj a {
background-image: url(../images/AJ-002335.jpg);
background-repeat: no-repeat;
width: 97px;
height: 27px;
}
[/code]

If anyone has any ideas I'd love to hear them.

Thanks!

Link to comment
https://forums.phpfreaks.com/topic/28919-list-with-background-images-as-buttons/
Share on other sites

I tried recreating your document on my end to test with, but your website requires a login to view the images in question.

Just a guess -- maybe lists don't support height and width? Tested with a <div> or <span>?
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.