We all know that if an img in HTML cannot be loaded, the alt text will be rendered instead. What if I want the alt be, say, a div? Maybe some JavaScript will help?
Asked
Active
Viewed 36 times
1 Answers
1
You can use the alt tag within a DIV but that wouldn't be valid HTML or HTML5.
Attribute alt not allowed on element div at this point.
You can however use title in HTML4/5 or data- in HTML5 with in DIV and other elements. The rest of your question is not clear and I recommend you edit it before people vote closure on it, also the question may become more suitable on Stack Overflow so please do ensure that you check their for similar questions and answers.
Simon Hayter
- 32,999
- 7
- 59
- 119
-
2I think one of us has misunderstood the question. I thought the question is asking about how if an image can't be loaded, the alt tag is shown, but instead of the plain text of the alt tag, is it possible to show an entire div instead? – grg Sep 10 '15 at 18:55
-
1