I need to add some alt text and/or titles to some image tags on a webpage.
The html structure is not really in my control, so image tags are required even though the tags themselves are being set to display a flat colour derived from a hex-code stored in a SQL table.
Like This
<img style="background-color:{@hexCode};" title="{@colourName}"/>
With @hexCode
being the colour code in question (i.e. '#1f1f1f') and @colourName
being the descriptive name for the colour chosen by the client.
The problem I'm having is that because the colour is being set by the background-color
property the title text (and alt text does this too) is being displayed on top of the colour as well as on hover.
Google has not given me any useful solutions and I can't just not add the titles to the images? What should I do?