-1
Hi, I’m trying to make the color of background-color
of item li:hover
occupy 100% of the width of the screen when opened by a screen smaller than 480px, I tried to leave the width of the padding at 100%, but the items were outside the screen.
How are you:
As I wish:
* {
padding: 0;
margin: 0;
font-family: 'Open Sans', sans-serif;
}
:root {
--texto-branco: #f2f2f2;
--fundo-preto:#262626;
}
nav {
display: flex;
justify-content: space-between;
align-items: center;
background-color: var(--fundo-preto);
box-sizing: border-box;
}
.logo {
margin: 16px;
}
.bar {
display: none;
}
li {
display: inline-block;
padding: 21px 16px;
transition: 0.3s;
}
li:hover {
background-color: #009DFF;
}
a {
text-decoration: none;
color: var(--texto-branco);
}
@media (max-width: 480px) {
.bar {
display: inline-block;
cursor: pointer;
margin: 16px;
}
nav {
align-items: flex-start;
}
nav ul {
margin-top: 64px;
}
li {
display: block;
text-align: center;
}
}
<html lang="pt-br">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="style.css">
<script src="https://kit.fontawesome.com/a3703589d3.js" crossorigin="anonymous"></script>
<title>VM Design</title>
</head>
<body>
<nav>
<a class="logo" href="#">VM</a>
<ul>
<li><a href="#">Home</a></li>
<li><a href="#">Sobre</a></li>
<li><a href="#">Projetos</a></li>
<li><a href="#" class="fale_comigo">Fale Comigo</a></li>
</ul>
<a href="#" class="bar"><i class="fas fa-bars"></i></a>
</nav>
</body>
</html>