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

87
Visualizações
no style change when disabling fieldset

how do I make my disabled and enabled <fieldset> look the same?

i.e. when toggling disabled no difference should be visible

I tried this but it doesn't work:

fieldset{
  opacity:1 !important;
  border:0;
}

fieldset:disabled{
 opacity:1 !important;
}

fieldset:disabled *{
 opacity:1 !important;
}
<fieldset disabled>
  <select>
   <option>testing</option>
  </select>
</fieldset>

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

0

You could use initial, note that it is not supported on internet explorer.

fieldset {
  border: 0;
}

fieldset:disabled * {
  opacity: initial;
  color: initial;
}
<fieldset disabled>
  <select>
   <option>testing</option>
  </select>
</fieldset>

about 4 years ago · Juan Pablo Isaza Relatório

0

Try using pointer-events:none; this disables the form while still keeping the background same

fieldset {
  border: 0;
}

.disabled *{
 pointer-events:none;
}
<fieldset class='disabled'>
  <select>
   <option>testing</option>
  </select>
</fieldset>

I've used .disabled * so that the click events on the fieldset itself can still be detected

about 4 years ago · Juan Pablo Isaza Relatório

0

One way, making sure it looks the same when disabled, is to explicitly set the various colors as well as the opacity.

fieldset,
fieldset>* {
  background-color: white;
  border-color: black;
  color: black;
  opacity: 1;
}
<fieldset disabled>
  <select>
    <option>testing</option>
  </select>
</fieldset>

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