用htmlcssjs写一个高级的情人节快乐、
时间: 2023-02-26 09:09:45 浏览: 46
下面是一个使用 HTML、CSS 和 JavaScript 制作的情人节快乐页面的代码:
```
<!DOCTYPE html>
<html>
<head>
<style>
body {
background-color: pink;
text-align: center;
}
h1 {
font-size: 72px;
margin-top: 100px;
color: red;
}
</style>
</head>
<body>
<h1 id="greeting">情人节快乐!</h1>
<script>
const greeting = document.getElementById("greeting");
const date = new Date();
const hours = date.getHours();
if (hours < 12) {
greeting.innerHTML = "早上好,情人节快乐!";
} else if (hours < 18) {
greeting.innerHTML = "下午好,情人节快乐!";
} else {
greeting.innerHTML = "晚上好,情人节快乐!";
}
</script>
</body>
</html>
```
代码中,我们使用 HTML 来创建页面结构,使用 CSS 来设置页面样式,使用 JavaScript 来判断当前的时间,并动态地更新页面中的问候语。