I'm limited to only using CSS on a current project and I'd like to add a subtitle to an img element.
Here's the html:
#page-2-section-6-row-1-column-0-bullet-0>div>button>img::after {
content: "DMIs";
background-color: #ffee58;
}
<div id="page-2-section-6-row-1-column-0-bullet-0">
<div>
<button>
<img src="local/path/to/image.png">
</button>
</div>
</div>
When I check this in dev tools, the 'after' is added inside the opening and closing img tags, and I don't see the 'content' text anywhere.
I've been battling with this for a couple hours now. What am I doing wrong?
EDIT: Just tried adding the ::after after a p element and that works, so it looks like the problem is img tag related?