Quantcast
Channel: Active questions tagged html - Stack Overflow
Viewing all articles
Browse latest Browse all 73905

Placeholder for contenteditable div with minimal JS

$
0
0

I created a div tag with the contenteditable attribute. I want to put the placeholder in here, and I found the following code.

[contenteditable=true]:empty:before {
  content: attr(placeholder);
  display: block;
  /* For Firefox */
}
<div class="test" contenteditable="true" placeholder="test"></div>

In a chromium-based engine, it looks like it's working. But I heard there is an error here that requires JavaScript. I couldn't find the error. Can you tell me what the problem is?

I'm also not sure that content:attr(); is the web standard in css. Is it a standardized CSS property?


Viewing all articles
Browse latest Browse all 73905

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>