Responsive topnav

When I make the browser window smaller, the topnav don`t follow and match accordingly. What I want is a responsive topnav. What am I doing wrong? Will it automaticaly fit a mobile screen, but not a browser window? But then again, it works at w3schools. Posted now with the HTML.

Here is the css:

ul {
    list-style-type: none;
    margin: 0;
    padding: 0;
    overflow: hidden;
    background-color: #141A34;
}

ul li {float: left;}

ul li a {
    display: block;
    color: white;
    text-align: center;
    padding: 14px 16px;
    text-decoration: none;
}

ul li a:hover:not(.active) {background-color: #111;}

ul li a.active {background-color: #4CAF50;}

ul li.right {float: right;}

@media screen and (max-width: 600px){
    ul.topnav li.right,
    ul.topnav li {float: none;}
}

li.dropdown  {
    display: inline-block;
}

.dropdown-content {
    display: none;
    position: absolute;
    background-color: #f9f9f9;
    min-width: 160px;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
    z-index: 1;
}

.dropdown-content a {
    color: black;
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    text-align: left;
}

.dropdown-content a:hover {background-color: #f1f1f1}

.dropdown:hover .dropdown-content {
    display: block;
}

HTML:

  <ul>
      <li><a target="_blank" rel="nofollow" href="ferskvaregrossisten.html">Hjem</a></li>
      <li><a target="_blank" rel="nofollow" href="om.html">Om</a></li>
      <li><a target="_blank" rel="nofollow" href="kontakt.html">Kontakt</a></li>
      <li class="dropdown">
      <a target="_blank" rel="nofollow" href="javascript:void(0)" class="dropbtn">Produkter</a>
      <div class="dropdown-content">
        <a target="_blank" rel="nofollow" href="kjøttvarer.html">Kjøttvarer</a>
        <a target="_blank" rel="nofollow" href="pølser.html">Pølser</a>
        <a target="_blank" rel="nofollow" href="pålegghelpølse.html">Pålegg hel pølse</a>
        <a target="_blank" rel="nofollow" href="kryddersmør.html">Kryddersmør</a>
        <a target="_blank" rel="nofollow" href="pakketpålegg.html">Pakket pålegg</a>
        <a target="_blank" rel="nofollow" href="kjølevarer.html">Kjølevarer</a>
        <a target="_blank" rel="nofollow" href="kjølevarerfiskogskalldyr.html">Kjølevarer fisk og skalldyr</a>

    </ul>

You forgot to close your <div> and your <li>. Try the following html:

  <ul>
      <li><a target="_blank" rel="nofollow" href="ferskvaregrossisten.html">Hjem</a></li>
      <li><a target="_blank" rel="nofollow" href="om.html">Om</a></li>
      <li><a target="_blank" rel="nofollow" href="kontakt.html">Kontakt</a></li>
      <li class="dropdown">
      <a target="_blank" rel="nofollow" href="javascript:void(0)" class="dropbtn">Produkter</a>
      <div class="dropdown-content">
        <a target="_blank" rel="nofollow" href="kjøttvarer.html">Kjøttvarer</a>
        <a target="_blank" rel="nofollow" href="pølser.html">Pølser</a>
        <a target="_blank" rel="nofollow" href="pålegghelpølse.html">Pålegg hel pølse</a>
        <a target="_blank" rel="nofollow" href="kryddersmør.html">Kryddersmør</a>
        <a target="_blank" rel="nofollow" href="pakketpålegg.html">Pakket pålegg</a>
        <a target="_blank" rel="nofollow" href="kjølevarer.html">Kjølevarer</a>
        <a target="_blank" rel="nofollow" href="kjølevarerfiskogskalldyr.html">Kjølevarer fisk og skalldyr</a>
        </div>
        </li>
    </ul>

hi your forget add className to your ‘ul’
in your media queris you write ul.topnav but in html your ul dones’t has className