Is there really no way with CSS to style an image to display its alt text instead of its src?

· · Web · 4 · 0 · 3

@xor Not as such, for stupid "img has no content" reasons, but I bet you could change the src to point to a nonexistent image and force it to display that way?


img {

works just fine; you'd need to add some more css to hide the broken image icon.

@ben hmm that is not apparently working for me but I think it might be for reasons specific to my application (and may even be a caching issue? hmm.) will keep poking though


I don't know exactly what your use case is, but in a similar situation when trying to write custom CSS for Mastodon I resorted to blocking the images with an ad blocker. Maybe that doesn't help at all but I thought I'd mention it because it didn't occur to me at first.

Sign in to participate in the conversation

Toots from the intersection of art and technology.