Menu horizontal css
boumbette
-
Gihef Messages postés 5165 Statut Contributeur -
Gihef Messages postés 5165 Statut Contributeur -
Bonjour , j'ai crée un menu horizontal en css , dans un div , ya possibilité de le centrer horizontalement dans ce div ?
merci
merci
5 réponses
-
Il faut étoffer un peu tout ça…
Bon, alors, essaye comme ça pour les CSS :#yo { list-style-type: none; height : 30px; width : 630px; margin : 0 auto; padding : 0; text-align center; border : 1px solid #f88; } #yo li { float: left; width : 150px; height : 30px; line-height : 30px; margin : 0 5px; background-color : #707070; } #yo #lig { margin-left : 0; } #yo #lid { margin-right : 0; } #yo a { color : #fff; text-decoration : none; } #yo a:hover { color : #0ff; }et comme ça pour le HTML :<ul id="yo"> <li id="lig"><a href="#">wwwww</a></li> <li><a href="#">xxxxx</a></li> <li><a href="#">yyyyy</a></li> <li id="lid"><a href="#">zzzzz</a></li> </ul> -
Bonjour,
Si c'est pour Firefox ou autres, un petit :margin : auto;
dans sa <div> devrait suffire.
Si c'est pour IE, il te faudra y ajouter :text-align : center;
Essaye.
-
et où le mettre le margin auto , car mon code css c'est çà :
ul {list-style-type: none;}
li { float: left;} -
-
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question -
<div class="yo"> <ul> <li><a href="l">w</a></li> <li><a href="">x</a></li> <li><a href="">y</a></li> <li><a href="">z</a></li> </div>