Issue
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?
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>
Answered By - Joke_Sense10
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.