Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

212
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda