I want to style the text we see when we hover over the image. I tried the following but it won’t work:
From the HTML spec (emphasis mine):
The title attribute represents advisory information for the element, such as would be appropriate for a tooltip. On a link, this could be the title or a description of the target resource; on an image, it could be the image credit or a description of the image; on a paragraph, it could be a footnote or commentary on the text; on a citation, it could be further information about the source; on interactive content, it could be a label for, or instructions for, use of the element; and so forth. The value is text.
Ergo, only text is allowed in the title
attribute. For a custom HTML tooltip, you must use a custom solution, such as hiding the content by default and showing it on :hover
with CSS, or using JavaScript to pull from a data-...
attribute.