Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

211
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!