One alternative solution is to utilize the css-pseudo-selectors ::before
and ::after
, since they come with a content-property. Here's an example:
.hover-me { background: orangered; }
.hover-me::after { content : "Bleh." }
.hover-me:hover::after{ content : "Blahargh!" }
<div class="hover-me"></div>
However, in terms of maintenance, it's important to remain consistent with where you place content and styles. It can become confusing trying to remember whether text belongs in CSS or HTML each time. Additionally, the types of content that can be used are limited (no html), but still valuable to understand.