<!DOCTYPE html>
<html lang="en">
<head>
<link href='E:\html\testpro\style.css' rel='stylesheet'>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>mini_calendar</title>
</head>
<body>
<div class="calendar">
<p id='monthname'></p>
<p id='dayname'></p>
<p id='daynumber'></p>
<p id='year'></p>
</div>
<script src='E:\html\testpro\script.js' rel='text/js'></script>
</body>
</html>
#css code==>>
*{
box-sizing: border-box;
margin: 0;
padding: 0;
}
body{
display: flex;
background-color: #000;
line-height: 80px;
}
.calendar{
position: absolute;
width: 200px;
text-align: center;
overflow: hidden;
left: 20%;
top: 20%;
background-color: #fff;
border-radius: 10px;
}
#monthname{
font-family: fantasy;
background-color: salmon;
font-size: 4em;
color: #fff;
padding: 15px;
border-bottom: 20px solid #777;
}
#dayname{
font-size: 20px;
color: #777;
}
#daynumber{
font-size: 4.4em;
font-family: fantasy;
}
#year{
font-size: 1.4em;
font-family: sans-serif;
}
#js code==>>
var date = new Date();
let monthname = date.toLocaleString('default', {month: 'long'});
let dayname = date.toLocaleString('default', {weekday: 'long'});
let daynumber = date.getDate();
let year = date.getFullYear();
document.getElementById('monthname').innerHTML = monthname;
document.getElementById('dayname').innerHTML = dayname;
document.getElementById('daynumber').innerHTML = daynumber;
document.getElementById('year').innerHTML = year;
For Digital Clock: click here
Comments
Post a Comment