Hi, guys I have a little question. i have a top navigation bar with two LI tags "HOME" and "PRODUCTS". The LI tag products have a dropdown list. My navbar and drop down work perfectly but i wanted to fallow the steps on W3school to make it responsive for other screen that are more little. I fallow the steps so I add .topnav to the CSS i have already :
BEFORE
ul {
list-style-type: none;
margin: 0;
padding: 0;
background-color: #333;
overflow: hidden;
border-radius: 10px;
font-family:"Comic Sans MS", cursive, sans-serif;
}
li {
float: left;
border-right: 1px solid #bbb;
}
li:last-child {
border-right: none;
}
li a, .dropbtn{
display: block;
color: whitesmoke;
text-align: center;
padding: 14px 16px;
text-decoration: none;
}
li a:hover, .dropbtn:hover .dropbtn {
background-color: #cc0000;
color: whitesmoke;
}
AFTER
body {
margin: 0;
}
ul.topnav{
list-style-type: none;
margin: 0;
padding: 0;
background-color: #333;
overflow: hidden;
border-radius: 10px;
font-family:"Comic Sans MS", cursive, sans-serif;
}
ul.topnav li {
float: left;
border-right: 1px solid #bbb;
}
ul.topnav li:last-child {
border-right: none;
}
ul.topnav li a, .dropbtn{
display: block;
color: whitesmoke;
text-align: center;
padding: 14px 16px;
text-decoration: none;
}
ul.topnav li a:hover, .dropbtn:hover .dropbtn {
background-color: #cc0000;
color: whitesmoke;
}
but somehow its dont work. When i add the ul.topnav my CSS for the UL tag it doesnt appear at all so i tought that the problem is with the drop down classes that I have
can someone explain me how to place everything so I can user my CSS plus the topnav class to make it reponsive ?
here is the css for the droop down
.dropdown-content {
display: none;
position: absolute;
background-color: whitesmoke;
min-width: 160px;
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
}
.dropdown-content a {
color: black;
padding: 12px 16px;
text-decoration: none;
display: block;
text-align: left;
}
.dropdown-content a:hover {
background-color: #cc0000;
}
.dropdown:hover .dropdown-content {
display: block;
}
P.S : for the nav bar and dropdown I fallowed the W3school steps