Inputting a default image in case the src attribute of an html img is not valid?
You asked for an HTML only solution...
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head> <title>Object Test</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head>
<body>
<p> <object data="http://stackoverflow.com/does-not-exist.png" type="image/png"> <img src="https://cdn.sstatic.net/Img/unified/sprites.svg?v=e5e58ae7df45" alt="Stack Overflow logo and icons and such"> </object> </p>
</body>
</html>
Inputting a default image in case the src attribute of an html img is not valid?
You asked for an HTML only solution...
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head> <title>Object Test</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head>
<body>
<p> <object data="http://stackoverflow.com/does-not-exist.png" type="image/png"> <img src="https://cdn.sstatic.net/Img/unified/sprites.svg?v=e5e58ae7df45" alt="Stack Overflow logo and icons and such"> </object> </p>
</body>
</html>
Image found on src attribute but not loaded
For some reason, the image' relative path (./) is the public folder. Thank you all!
Set a default value for Image src in next.js
In my case, the right way to do that is by onErrorCapture
.
Related Topics
What Are All the Valid Self-Closing Elements in Xhtml (As Implemented by the Major Browsers)
Get the Value in an Input Text Box
Best Practices & Considerations When Writing HTML Emails
Make Background Color Extend into Overflow Area
How to Make Div Elements Display Inline
How to Get a Div to Float to the Bottom of Its Container
Trouble With Parsing Table Data in Perl
How to Use CSS to Surround a Number With a Circle
Should I Specify Height and Width Attributes For My Imgs in Html
Is It Valid to Have a HTML Form Inside Another HTML Form
How to Add a New Line in Textarea Element
How to Submit Form on Change of Dropdown List