Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

137
Visualizações
Div id css code only working if place it underneath or next to it

I'm trying to display the div tag when the checkbox is checked. Everything is working, but when I move tag down about a few lines, it stops working. If I put the tab next to the input tag then it works fine.

css

#toggle-content-box{
display:none;
}
#mycheckbox:checked ~ #toggle-content-box{
 display:block;
height:100px;

}

If I place the div underneath the line then it works perfectly.

 <input type="checkbox"  name="file_id"  id="mycheckbox" value="">
 <div id="toggle-content-box">This div will display when checkbox above is checked</div>

But for some reason, I need to move this div down about 10 lines from the line, then it stops working. The div is not showing when the checkbox is checked.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

You should declar the checkbox before the div not after it !

This is why when you put the div above the checkbox it is not working.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda