Placeholder-Attribut stylen

von Marco Simbürger

Seit HTML5 gibt es das Placeholder-Attribut für die <input>-Tags. Der Placeholder-Text wird angezeigt solange das Feld noch nicht ausgefüllt wurde. Der Placeholder-Text übernimmt aber nicht die Eigenschaft color, welche man auf das Input-Feld setzen kann. Hierfür bedarf es eines extra Stylings für das Placeholder-Attribut:

::-webkit-input-placeholder { color: #fff; } /* WebKit, Blink, Edge */
:-moz-placeholder { color: #fff; opacity: 1; } /* Mozilla Firefox 4 to 18 */
::-moz-placeholder { color: #fff; opacity: 1; } /* Mozilla Firefox 19+ */
:-ms-input-placeholder { color: #fff; } /* Internet Explorer 10-11 */

Zurück

Kommentare

Einen Kommentar schreiben

Was ist die Summe aus 1 und 8?