Display Time using Js and Css3
This is a sample post in which you can create a Java script which can display the current time. Basically it fetches the local time from the system every 1 second using setInterval method.
Things we have used :
Demo:
As you can see when you hover the mouse over it, the color changes. This affect is added using css3.
The Code:
Found Bugs or wanna share your thoughts, Comment them !
Things we have used :
- Css3 shadows and Hover Properties
- Date Class with toLocaleTimeString() method
- setInterval() method.
Demo:
As you can see when you hover the mouse over it, the color changes. This affect is added using css3.
The Code:
<html>
<style>
body {
background-color:black;
}
#time{
display: inline-block;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
padding: 10px;
border: none;
font: normal 48px/normal "Warnes", Helvetica, sans-serif;
color: rgba(255,255,255,1);
text-decoration: normal;
text-align: center;
-o-text-overflow: clip;
text-overflow: clip;
white-space: pre;
text-shadow: 0 0 10px rgba(255,255,255,1) , 0 0 20px rgba(255,255,255,1) , 0 0 30px rgba(255,255,255,1) , 0 0 40px #ff00de , 0 0 70px #ff00de , 0 0 80px #ff00de , 0 0 100px #ff00de ;
-webkit-transition: all 200ms cubic-bezier(0.42, 0, 0.58, 1);
-moz-transition: all 200ms cubic-bezier(0.42, 0, 0.58, 1);
-o-transition: all 200ms cubic-bezier(0.42, 0, 0.58, 1);
transition: all 200ms cubic-bezier(0.42, 0, 0.58, 1);
}
#time:hover {
text-shadow: 0 0 10px rgba(255,255,255,1) , 0 0 20px rgba(255,255,255,1) , 0 0 30px rgba(255,255,255,1) , 0 0 40px #00ffff , 0 0 70px #00ffff , 0 0 80px #00ffff , 0 0 100px #00ffff ;
}
</style>
<body>
<center><p id="time"></p></center>
<script>
var myVar = setInterval(function(){ myTimer() }, 1000);
function myTimer() {
var d = new Date();
var t = d.toLocaleTimeString();
document.getElementById("time").innerHTML = t+"<br/><br/><br/>Time Using JS and Css3";
}
</script>
</body>
</html>
Found Bugs or wanna share your thoughts, Comment them !

Comments
Post a Comment