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

208
Visualizações
How to add red required text to an input when the field has not been filled out

I would like to add a red required text on the right side of a text input. I would want it to look similar to this. An email field with the required tag.

I apologize for not have code to add, the only things ive tried have been messing with placeholders as i have no idea which direction to go for this. Any help is much appreciated.

about 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

You may want to consider something like this.

input {
  padding: 1em;
  width: 250px;
}
/* Position label on top of input field */
label {
  margin-left: -80px;
  position: relative;
  z-index: 2;
}
/* Show red label when input invalid */
input:required:invalid+label {
  color: red;
}
/* Don't display label when input is valid */
input:required:valid+label {
  display: none;
}
<input type="email" id="email_input" placeholder="Email" required>
<label for="email_input">Required</label>

about 4 years ago · Santiago Trujillo 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