Recently, I attempted to create a fullscreen webpage like this one: https://i.sstatic.net/21KCr.png My goal was to have the color of each element change randomly every second.
Here is the JavaScript code I implemented:
<script>
var tid = setInterval(chngColor, 1000);
function chngColor()
{
document.body.style.backgroundColor = '#'+(Math.random()*0xFFFFFF<<0).toString(16);
}
</script>
However, I encountered an issue when trying to create a fullscreen div that would encompass the entire body, with additional inner divs spaced by a margin of 10px. I cannot seem to get the styling for these divs right.
position: absolute;
width: 100%;
height: 100%;
left: 0;
top: 0;
background-color="myFunction();";
z-index: 10;
margin-bottom:10px;
margin-top:10px;
margin-left:10px;
margin-right:10px;
Unfortunately, my current setup isn't working as expected. Any advice or suggestions?