I am currently working on developing a static website using Gatsby and I am facing some challenges. I am trying to implement a hover effect for the menu items in the navigation bar, but I am encountering difficulties with the CSS classes including Site-header, wrapper site-header__wrapper, nav__wrapper, and nav__item. I have attempted to make changes to both nav__wrapper.active and nav__item a in the CSS, but have not been successful in achieving the desired result. Below, you can find the HTML and CSS code that I have tried so far. I would greatly appreciate any guidance or advice on how to successfully achieve this hover effect. Thank you in advance.
* {
padding: 0px;
/* padding-bottom: 8px; */
margin: 0 auto;
text-decoration: none;
color: white;
}
html,
body {
min-height: 100%;
}
body {
background: radial-gradient(at top left, snow 0%, snow 100%);
background-repeat: no-repeat;
}
.brand {
font-weight: bold;
font-size: 20px;
padding-top: 12px;
padding-right: 35%;
}
h3 {
font-weight: bold;
font-size: 20px;
font-style: initial;
font-family: "Lucida Sans", "Lucida Sans Regular", "Lucida Grande",
"Lucida Sans Unicode", Geneva, Verdana, sans-serif;
color: black;
}
.site-header {
position: relative;
overflow: hidden;
padding: 15px 10px;
background-color: white;
border: 1px snow;
}
.site-header__wrapper {
padding-top: 4rem;
padding-bottom: 6rem;
}
@media (min-width: 600px) {
.site-header__wrapper {
display: flex;
justify-content: space-between;
align-items: center;
padding-top: 0;
padding-bottom: 15px;
}
}
@media (min-width: 600px) {
.nav__wrapper {
display: flex;
gap: 12px;
align-items: center;
padding-top: 10px;
padding-bottom: 0;
}
}
@media (max-width: 599px) {
.nav__wrapper {
position: relative;
top: 100%;
right: 0;
left: 0;
bottom: 0;
z-index: -1;
background-color: #d9f0f7;
visibility: hidden;
opacity: 0;
transform: translateY(-100%);
transition: transform 0.3s ease-out, opacity 0.3s ease-out;
}
.nav__wrapper.active {
display: inline-block;
visibility: visible;
opacity: 1;
transform: translateY(0);
position: relative;
color: #0087ca;
}
}
.nav__item a {
transition: 0.4s;
color: #111;
font-size: 20px;
text-decoration: none;
display: inline-block;
padding: 1.5rem 1rem;
gap: 10px;
}
.nav__item a:hover{
background-color: #ffffff;
color: #EEA200;
padding: 24px 10px;
font-size: 50px;
}
.nav__toggle {
display: flow-root;
}
@media (max-width: 599px) {
.nav__toggle {
display: block;
position: absolute;
right: 1rem;
top: 1rem;
}
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<link rel="stylesheet" href="style.css" />
<title>Static Template</title>
</head>
<body>
<header class="site-header">
<div class="wrapper site-header__wrapper">
<h3 class="brand">Community Site</h3>
<nav class="nav">
<div class="nav__wrapper">
<a class="nav__item" href="/Home">
<h3>Home</h3>
</a>
<a class="nav__item" href="/Aboutus">
<h3>What are we</h3>
</a>
<a class="nav__item" href="/Contactus">
<h3>Contact Us</h3>
</a>
</div>
</nav>
</div>
</header>
</body>
</html>