I want to set an image as a background, however the image name might be either bg.png
or bg.jpg
.
Is there any non-javascript way to create a fallback to an alternative image if the default background doesn't exist?
body{
background: url(bg.png);
background-size: 100% 100%;
width: 100vw;
height: 100vh;
margin: 0;
}
See Question&Answers more detail:os