div:empty:not(:focus):before {
content: attr(data-text);
}
div:focus:before {
content: "";
}
<div data-text="placeholder text..."></div>
The CSS code above is used to show placeholder text in a <div> element, but the issue arises when clicking on the element, as the placeholder text does not disappear.
There seems to be an issue with the div:focus:before
selector. What could be wrong with this approach?