Platzhalter für contenteditable Attribute

HTML & CSS

Platzhalter für den contenteditable Attribut erstellen:

<style>
    [contentEditable=true]:empty:before{

        content: attr(data-placeholder);
        color: #cccccc;
    }

    /*
     or with class
    */

    .content:empty:before{

        content: attr(data-placeholder);
        color: #cccccc;
    }
</style>

<div class=„content“ contenteditable="true" data-placeholder="Placeholder"></div>
Zurück