Making the backgrounds dynamic is more attractive than simple ones. The following codes uses two background images. They are fade in and out frequently by a rotating agent. This rotation absorbs attentions to see what is happening and what will appear next.
HTML
<!-- This script got from www.devanswer.com -->
<main>
<div class="background"></div>
<div class="foreground"></div>
</main>
<script src="https://cdnjs.cloudflare.com/ajax/libs/prefixfree/1.0.7/prefixfree.min.js"></script><div id="bcl"><a style="font-size:8pt;text-decoration:none;" href="http://www.devanswer.com">Developers Answer</a></div>
CSS
:root {
--direction: -45deg;
}
body {
margin: 0;
padding: 0;
}
main {
position: relative;
}
div {
position: absolute;
top: 0;
left: 0;
width: 100vw;
height: 100vh;
background-size: cover;
background-repeat: none;
}
.background {
background-image: url(http://devanswer.com/codes/files/day.jpg);
}
.foreground {
background-image: url(http://devanswer.com/codes/files/night.jpg);
mask-image: linear-gradient(var(--direction), black 40%, rgba(0, 0, 0, 0) 60%);
mask-position: 50% 50%;
}
Javascript
let c = 45;
function draw() {
document.documentElement.style.setProperty('--direction', c++ + 'deg');
requestAnimationFrame(draw);
}
requestAnimationFrame(draw);