I am in the process of creating a top bar with HTML and CSS. I've added CSS to make the code responsive with a flex element. It looks like this:
@media screen and (max-width: 820px) {
  nav.container {
    flex-grow: 3;
  }
}<div class="topbar">
  <nav class="container">
    <div class="text1">Text</div>
  </nav>
  <nav class="container">
    <div class="text2">Text2</div>
  </nav>
  <nav class="container">
    <div class="text3">Text3</div>
  </nav>
  <nav class="container">
    <div class="text4">Text4</div>
    <div class="text5">Text5</div>
    <!--This is triggered by an external 
             Javascript code, it is sometimes visible and sometimes not visible. -->
  </nav>
</div>The only thing I'm missing right now is a code, that disables the CSS code above when the div (Text5) is not visible.
Edit: I will need a function, that checks if the provided "div with the class text5" has "display: none;" and then toggles the CSS code i've provided off.
 
     
    