如何在悬停时将图像更改为其他图像

时间:2015-08-30 03:13:25

标签: html image css3 class hover

任何人都可以帮助我吗?我在悬停时试图让我的徽标变成另一张图片。

<head>
     <meta charset="utf-8" />
     <link rel="stylesheet" href="styles/base.css"/>
     <link rel="stylesheet" href="styles/modele01.css"/>
     <link rel="shortcut icon" href="./images/favicon.ico" >
     <title> Look At Them Cars </title>
     <style type='text/css'> 
        img {
            background-image: url('./images/LogoSite.png');
        }

        img:hover {
            background-image: url('./images/LogoBleu.png');
        }
    </style>
</head>

<body>
    <div id="titre" class="slide header">
        <h1><a href="index.html"><img src="./images/LogoSite.png"></a></h1>
        <br></br>
        <div id="liste">
            <a href="Lexus">Lexus</a>
            <a href="Porsche">Porsche</a>
            <a href="Toyota">Toyota</a>
            <a href="Crédits">Crédits</a>
        </div>
    </div>

我一直试图在我的css img中做一个课程:将我想要改变的背景图像悬停在上面。它没有工作

1 个答案:

答案 0 :(得分:0)

使用背景图片属性方法,在头标记的html页面顶部尝试:

<style type='text/css'> 
    img {
       background-image: url('firstimage.png');
    }

    img:hover {
       background-image: url('second.png');
    }
</style>
相关问题