Setting background-color: inherit
does cause it to take the background colour of the parent element.
The reason it is taking transparent
is because the background colour of the parent (the li
) is transparent
(the default value).
The only other element in your second JSFiddle which has a background colour set is #unknown_background
, which is the anchor’s great-great-grandparent.
Add div, ul, li { background-color: inherit; }
to the end of your stylesheet and the background will be inherited all the way down and the border will not show up.