Centrer un menu déroulent CSS
Bonjour à tous,
je rencontre un problème pour centrer mon menu déroulent au milieux de ma page.
voici mon code HTML et CSS
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
| <!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<meta name="viewport"content="width=device-width, initial-scale=1.0"/>
<title>Lauret Lucas</title>
<link rel="stylesheet" type="text/css" href="style.css"/>
<body bgcolor="gray">
</head>
<header>
<nav>
<ul>
<li><a>Style photo</a>
<ul>
<li><a>Paysage</a></li>
<li><a>Portrait</a></li>
<li><a>Drone</a></li>
<li><a>Iphone</a></li>
</ul>
</li>
<li><a>Contacter</a>
<ul>
<li><a href="https://www.facebook.com/mcmoa">Facebook</a></li>
<li><a href="https://twitter.com/LauretLucas34">Twitter</a></li>
<li><a href="https://www.instagram.com/lauretlucas34/?hl=fr">Instagram</a></li>
<li><a href="https://www.youtube.com/channel/UCx2MnCXOcxBHYgbYNtyi8Mw">Youtube</a></li>
<li><a>E-mail</a></li>
</ul>
</li>
<li><a>Vidéo</a></li>
<li><a>Contact</a></li>
</ul>
</nav>
</header>
<body>
</body>
</html> |
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
| header{
font-family: Arial;
}
header nav {
color: #FFFFFF;
}
header nav ul{
list-style: none;
margin: 0;
padding: 0;
}
header nav ul li{
margin: 0;
padding: 0;
float: left;
width: 200px;
height: 40px;
background-color: rgba(0, 0, 0, 0.8);
line-height: 40px;
text-align: center;
}
header nav ul li a{
display: block;
text-decoration: none;
}
header nav ul li a:hover{
background-color: gray;
opacity: 0.5;
}
header nav ul li ul li{
display: none;
}
header nav ul li:hover ul li{
display: block;
} |
merci d'avance en espérant pouvoir être aider.