I am currently facing an issue with a JavaScript clock displaying in a narrow frame:
<!DOCTYPE html>
<HTML>
<HEAD>
<TITLE>Untitled</TITLE>
<SCRIPT>
function checkTime(i) {
if (i < 10) {
i = "0" + i;
}
return i;
}
function startTime() {
var today = new Date();
var h = today.getHours();
var m = today.getMinutes();
var s = today.getSeconds();
m = checkTime(m);
s = checkTime(s);
document.getElementById('time').innerHTML = h + ":" + m + ":" + s;
t = setTimeout(function () {
startTime()
}, 500);
}
</SCRIPT>
</HEAD>
<BODY onload="startTime()">
<DIV id="time" style="width: 95px; height: 32px; border: solid; border-width: thin; text-align: center"><p>time</p></DIV>
</BODY>
</HTML>
Despite setting vertical-align: middle
, I cannot seem to align the content vertically within the frame. How can I achieve this?