Use the focus-within pseudo-class to conditionally assign styling to a parent element when its child receives focus.
HTML:
import "./styles.css";document.getElementById("app").innerHTML = `
CSS:
#red:focus-within { background-color: red;}
本文共 325 字,大约阅读时间需要 1 分钟。
Use the focus-within pseudo-class to conditionally assign styling to a parent element when its child receives focus.
HTML:
import "./styles.css";document.getElementById("app").innerHTML = `
CSS:
#red:focus-within { background-color: red;}
转载于:https://www.cnblogs.com/Answer1215/p/11430852.html