October 22, 2024
Chicago 12, Melborne City, USA
HTML

Is there a CSS parent selector?


im making a site without javascript and im wodering how do i toggle the menu

the menu is located in and each iten is an menu item

im trying to make ul (class links) togglebut nothing is working

@media(max-width: 968px) {
.links {
    position: absolute;
    top: 100%;
    right: 0;
    width: 100%;
    padding: 1em 3em;
    color: white;
    display: none; /* Escondido por padrão */
    flex-direction: column;
    text-align: center;
    background: rgba(0, 0, 0, 0.9);
  }
  .burger {
    display: block !important; 
  }

  .menu-toggle:checked + .links {
    display: flex !important;
  }
}
.burger {
    display: none;
}

my html

<nav>
      <a href="#" class="logo"><span>Linda</span> </a>

      <label class="burger" for="menu-toggle">
        <input type="checkbox" id="menu-toggle" class="menu-toggle" />
        <span></span>
        <span></span>
        <span></span>
      </label>
      <ul class="links">
        <a href="#home">Home</a>
        <a href="#about">About</a>
        <a href="#contact">Contact</a>
      </ul>

      <a href="#contact" class="btn">Contact Me</a>
    </nav>

Im not allowed to use any javascript



You need to sign in to view this answers

Leave feedback about this

  • Quality
  • Price
  • Service

PROS

+
Add Field

CONS

+
Add Field
Choose Image
Choose Video