Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change background image on hover

Tags:

html

css

list

Would the proportions of the image have anything to do with the problem?

#menu {
background: black;
width: 100%;
height: 45px;
}
#menu ul {

text-decoration: none;
list-style-type: none;

}

#menu li {
text-decoration: none;
display: inline;
font-size: 30px;
padding-left: 30px;
}
#menu a:hover {
   background-image: url(images/hover.png);

}
#menu a {
text-decoration: none;
color: white;
margin: auto
  background-repeat: bo-repeat;
  background-position: top center;
  background-size: contain;

}

On hover it repeats the images multiple times. The image is 2000 x 500 px. How can I make it so that this image is displayed behind the word in the middle and not repeat. Thank you

This is the image hover link

the html code

<div id="menu"> 
<ul>
<li><a href="index.html"> Home</a></li>
<li> <a href="#"> lalal</a></li>
</ul>
</div>
like image 373
reidjako Avatar asked Dec 12 '25 03:12

reidjako


1 Answers

You should set the text parameters like this:

LIVE DEMO OF YOUR WEBSITE

#menu ul li a:hover
{
    background-image: url(http://img.mynet.com/ha2/tayyip.jpg);
    -webkit-background-size: cover;
    -moz-background-size: cover;
    -o-background-size: cover;
    background-size: cover;
}
like image 65
Ali Çarıkçıoğlu Avatar answered Dec 14 '25 18:12

Ali Çarıkçıoğlu



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!