For my e-commerce site I'm using lazy loading for images with lazysizes
. To provide conform img
tags these contain an empty src="data:,"
suggest by this thread which is really neat.
So all lazy loaded images are display as a broken image with alt
text until they reach view port. The problem is, that these alt
texts contain product names which can be really long, so this text overflows image bounds sometimes and breaks layout (i.e. responsive):
Is there a cross-browser solution out there to style alt
texts for images?
EDIT It's important to mention, that I'm talking about alt
texts containing less to no whitespaces, so it would not line-break automatically.
The solution is simple. Simply use
word-break: break-word;
onimg
tags