+
95
-

css中focus-within与focus伪类有啥区别?

css中focus-within与focus伪类有啥区别?


网友回复

+
15
-

:focus表示当前元素处于focus状态时候的样式;

而:focus-within表示当前元素或者当前元素的子元素处于focus状态的样式;

示例代码:

<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1.0,maximum=1.0,minimum=1.0,us...

点击查看剩余70%

我知道答案,我要回答