JayD
JayD

Reputation: 479

html/css adding an image for every for every listitem in my menu

I have a listmenu (buttons) and I want to add a small image onto the button in front of every listitem text (link1,2,3,4) with a padding-left of 5 pixels, it should also stay when I hover with my mouse over a button. But I cant seem to find a way how to do it.

image that you can use as an example: http://forum.pictomio.com/images/emoticons/smiley_3_ico.gif

this is the code for my buttonlist:

html:

<div id="menupadding">
<div id="menu">
 <ul>
<li><a href="#">link1</a></li>
<li><a href="#">link2</a></li>
<li><a href="#">link3</a></li>
<li><a href="#">link4</a></li>
 </ul>
</div>
</div>

css:

#menupadding {
    padding-top: 100px;
    padding-left: 302px;
}

#menu {
    margin:0;
    padding:0;
}

#menu li{
    display:block;
    list-style:none;
    padding-bottom:1px;
}

#menu ul{
    width: 140px;
    margin:0;
    padding:1px;    
}

#menu li a{
    display:block;
    font-family:Tahoma, Geneva, sans-serif;
    font-size:12px;

    color:#ffffff;

    text-decoration:none;

    background-color: #376596;

    padding-top:2px;
    padding-left: 20px;
    padding-bottom: 2px;    
}

#menu li a:hover{
    font-size:12px;
    color:#ffffff;
    padding-left: 40px;

    background-image: linear-gradient(bottom, rgb(0,65,139) 14%, rgb(33,42,66) 89%, rgb(0,0,0) 100%);
    background-image: -o-linear-gradient(bottom, rgb(0,65,139) 14%, rgb(33,42,66) 89%, rgb(0,0,0) 100%);
    background-image: -moz-linear-gradient(bottom, rgb(0,65,139) 14%, rgb(33,42,66) 89%, rgb(0,0,0) 100%);
    background-image: -webkit-linear-gradient(bottom, rgb(0,65,139) 14%, rgb(33,42,66) 89%, rgb(0,0,0) 100%);
    background-image: -ms-linear-gradient(bottom, rgb(0,65,139) 14%, rgb(33,42,66) 89%, rgb(0,0,0) 100%);

    background-image: -webkit-gradient(
        linear,
        left bottom,
        left top,
        color-stop(0.14, rgb(0,65,139)),
        color-stop(0.89, rgb(33,42,66)),
        color-stop(1, rgb(0,0,0))
);
}

Upvotes: 1

Views: 808

Answers (1)

Javal Patel
Javal Patel

Reputation: 838

please update below css with this one

#menu li a{
    display:block;
    font-family:Tahoma, Geneva, sans-serif;
    font-size:12px;

    color:#ffffff;

    text-decoration:none;

    background-color: #376596;

    padding-top:2px;
    padding-left: 20px;
    padding-bottom: 2px; 


     background-image:url('http://images.subeta.net/smilies/6398_emoticon_smile.gif');
        background-repeat:no-repeat;

}

you can check live click here

Upvotes: 1

Related Questions