Changer background DIV au survol d'un autre DIV

reedbedroom Messages postés 80 Date d'inscription   Statut Membre Dernière intervention   -  
benji69340 Messages postés 29 Date d'inscription   Statut Membre Dernière intervention   -
Bonjour,

Je n'arrive pas a faire ce que je souhaites, et pourtant je sais que cela est possible !

Je m'explique, j'ai un DIV principal avec une photo en background que j'aimerais modifier lors du passage sur un autre DIV (bouton).

Voici mon CSS :


#top-page-contact
{
position: relative;
margin: 0px auto;
background: url(http://www.iwebu.com/hedgeguard_v1/wp-content/themes/hedgeguard/images/fond-contact.png) no-repeat right top;
height: 263px;
width: 1100px;
text-align: center;
padding-top: 280px;
}

#boutonLondon
{
float: left;
width: 200px;
height: 21px;
background-color: #f29413;
margin-top: 20px;
text-align: center;
font-family: 'Gotham A', 'Gotham B'; font-weight: 400; font-style: normal;
color: #fff;
font-size: 12.05px;
padding-top: 5px;
cursor: pointer;
}

#boutonLondon:hover + #top-page-contact
{
background: url(http://www.iwebu.com/hedgeguard_v1/wp-content/themes/hedgeguard/images/fond-contact.png) no-repeat right top;
}


Quelqu'un saurai pourquoi cela ne fonctionne pas ?!!

Merci à Tous !


A voir également:

2 réponses

Angelneonizz Messages postés 788 Date d'inscription   Statut Membre Dernière intervention   137
 
Bonjour,

je crois qu'il n'y a pas de +
il faudrait mettre :


#boutonLondon:hover #top-page-contact
{
background: url(http://www.iwebu.com/hedgeguard_v1/wp-content/themes/hedgeguard/images/fond-contact.png) no-repeat right top;
}
0
benji69340 Messages postés 29 Date d'inscription   Statut Membre Dernière intervention   1
 
Si si, ça aurait du fonctionner avec le "+" , mais je crois savoir que les deux éléments doivent avoir le même parent direct .
A explorer
0
reedbedroom
 
Merci !

J'ai finalement réussi a le faire en javascript ...
0