I'm taking a coding class and we were making a navigation bar with clickable links. The problem is mine wouldn't work at all. I added position: relative; and top: 0; so that way the buttons would move down after clicking and also removed the box-shadow after clicking on the link. It doesn't seem to do anything. Does anyone know what the problem might be? Sorry if my question doesn't make any sense.
body {
margin: 10%;
font-family: Tahoma, Verdana, Geneva, sans-serif;
}
nav {
overflow: hidden;
width: 43%;
margin: 0 auto;
padding-bottom: 1em;
}
nav ul {
list-style-type: none;
/* Step 2: Remove bullets */
}
nav ul li {
float: left;
/* Step 3: Float li's left to line up horizontally */
}
/* Psuedoclass Class Selectors - State of links LVHA */
nav a:link {
/* Default state of link */
display: block;
/* Step 4: Gives anchor tag structure */
width: 6em;
/* Increases width of links and makes all buttons a standard width */
border: 2px solid rgb(175, 175, 175);
text-align: center;
text-decoration: none;
padding: .5em 1em;
/* Gives breathing room between content and inside of border */
margin: 0 5px;
border-radius: 6px;
background-color: rgb(190, 190, 190);
color: white;
text-shadow: #666 .1em .1em .1em;
/* Color, right, bottom, blur */
box-shadow: rgba(0, 0, 0, .5) 0 5px 3px;
/* Color, right, bototm, blur */
/* Sets position of each button to relative and sets positions to zero */
position: relative;
top: 0;
}
nav a:visited {
border: 2px solid rgb(175, 175, 175);
color: white;
}
nav a:hover {
background-color: #fdca00;
border-color: #fda700;
}
nav a:active a:focus {
/* Moves button 3px down and removes shadow on click */
top: 3px;
box-shadow: rgba(0, 0, 0, .5) 0 0 0;
}
<nav>
<ul>
<li><a href="#">Men</a></li>
<li><a href="#">Women</a></li>
<li><a href="#">Kids</a></li>
<li><a href="#">SALE</a></li>
</ul>
</nav>