<!-- 如果试图触发div标签绑定的onfocus事件和onblur事件,需要为该标签添加tabindex属性 --> <div class="a" tabindex="0"> <div class="b"></div> </div> <div class="c"></div>
.a{ outline: none; } .b{ width: 50px; height: 50px; background: red; } .c{ width: 100px; height: 100px; background: blue; } .a:focus + .c{ background: yellow; }