Include tags in html for node parent 'div'

In looking for a solution to use custom CSS to automatically color nodes based on tags they contain (and color the whole node, not just the tag itself), I’ve seen several discussion points but no actual solutions. It looks like the only way to match tags is to match the title attribute of the tag’s a element; since CSS has no parent selectors and has() is not yet implemented, this doesn’t allow for selecting the entire node.

If the node’s parent div contained tag information, however - either as CSS classes (.tag-foo) or a custom attribute (data-tags="foo"), then custom CSS could easily match the node, and apply custom styles to the node (or any piece of it) based on the tags it contains.