I want to change the background of elements inside a div only when they freeze and when their contenteditable property is true.
I tried:
#myDiv[contenteditable="true"]:hover { background-color: rgba(217, 245, 255,0.5);}
But that will not work. And if I moved the pseudo-class to a div:
#myDiv:hover [contenteditable="true"] { background-color: rgba(217, 245, 255,0.5);}
Then all fields with contenteditable = true will get the background ... any trick to fix this in pure css?
EDIT: HTML example:
<div id="myDiv"> <span contenteditable="true">blabla</span> <div "subdiv" contenteditable="true">blibli</div> </div>
css
Vincent teyssier
source share