I have a countdown timer in an inline JS element.
As of now they are all in one line, I would like days/hours/mins/secs to appear under each number, as shown here: http://prnt.sc/b8le72 - also, is it possible to style the text and numbers individually in CSS? (like making the text orange but keep numbers white)
https://jsfiddle.net/eyd8fd4x/
HTML:
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>onepageskiw</title>
<link href="styles.css" rel="stylesheet" type="text/css">
<script src="js.js"></script>
</head>
<body>
<div id="forsidediv">
<img id="forsidepic" src="forsidepic.png">
</div>
<div id="countdowner">
<div id="countdown"></div>
</div>
<script>
CountDownTimer('06/25/2016 10:00 AM', 'countdown');
function CountDownTimer(dt, id)
{
var end = new Date(dt);
var _second = 1000;
var _minute = _second * 60;
var _hour = _minute * 60;
var _day = _hour * 24;
var timer;
function showRemaining() {
var now = new Date();
var distance = end - now;
if (distance < 0) {
clearInterval(timer);
document.getElementById(id).innerHTML = 'EXPIRED!';
return;
}
var days = Math.floor(distance / _day);
var hours = Math.floor((distance % _day) / _hour);
var minutes = Math.floor((distance % _hour) / _minute);
var seconds = Math.floor((distance % _minute) / _second);
document.getElementById(id).innerHTML = days + ' dage ';
document.getElementById(id).innerHTML += hours + ' timer ';
document.getElementById(id).innerHTML += minutes + ' minutter ';
document.getElementById(id).innerHTML += seconds + ' sekunder';
}
timer = setInterval(showRemaining, 1000);
}
</script>
</body>
</html>
CSS:
@charset "utf-8";
body {
margin:0;
}
#countdowner {
color:white;
position:absolute;
margin:0;
margin-top:5em;
padding:0;
text-align:center;
width:100%;
font-size:1em;
font-family:Helvetica;
}
#forsidediv {
position:fixed;
left: 0;
right: 0;
top: 0;
bottom: 0;
text-align: center;
}
#forsidepic {
width: 100%;
}
Dave