JSFiddle - React, Tailwind, and code Playground
HTML
<ul>
<li>
<a>Some anchor text</a>
<div class="sub">Some div content <a>and anchor</a></div>
</li>
</ul>
CSS
li {
position: relative;
}
li > a {
display: block;
}
li > a:before {
content: '';
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: 1;
}
li > a:hover {
background-color: cyan;
}
li > a:before:hover {
background-color: transparent;
}
a:hover {
color: red;
}