Is it possible to add placeholder in div tag

css, html

Solution

There are lot of options using javascript, but if you want to do it in css. Try this:

[contentEditable=true]:empty:not(:focus):before {
  content: attr(data-text)
}
<div contentEditable=true data-text="Enter text here"></div>

Demo

Problem

I would like to display some text to the user when my `div` element is empty. I have tried adding a placeholder attribute to my `div` but the text is not being displayed. ``` <div placeholder="Enter the text"> </div> ``` How can I display a message when my `div` element is empty?

Original source