This question has already been answered:

enter image description here
Hi everybody!
Does anyone know a civilized way to make red stars in a placeholder in an input. I tried to just put them on top, it turned out to be too dreary.
Can there be any library for this purpose?

Reported as a duplicate by members of Visman , Grundy , aleksandr barakin , user194374, fori1ton Jul 10, '16 at 10:18 .

A similar question was asked earlier and an answer has already been received. If the answers provided are not exhaustive, please ask a new question .

  • 6
    duplicate.stackoverflow.com/questions/298676/… - soledar10

1 answer 1

Like rovnenko

enter image description here

label { position: relative; margin: 16px; float: left; } label span { position: absolute; top: 8px; left: 12px; font-family: Segoe UI; font-size: 14px; cursor: text; } input { padding: 6px 10px 6px 10px; outline: none; font-family: Segoe UI; font-size: 14px; } input:invalid + span:before { content: attr(placeholder); position: relative; color: #999; } input:invalid + span:after { content: '*'; position: relative; color: red; } 
 <label> <input required><span placeholder='E-mail (Логин)'></span> </label>