2023新春祝福html代码,包你学会

news2024/9/28 15:26:28

前言

大家新年好!今天是年三十,在这个充满喜悦和欢乐的节日里,祝大家新年快乐。不论你在外面过的风生水起还是不尽人意,回到家一家人团团聚聚才是最好的。进入正题,我们作为IT民工,我们要用自己的方式表达对别人的祝福!

这是一个前端的祝福网页,网址是 新年快乐 (imimbert.github.io) ,完整代码一共两个文件,大家可以研究前端代码或者部署到 Github 给别人看。

使用方法

由于这次教程面向所有人,包括无任何编程基础的人群,所以非常详细。

首先在你存代码的目录下打开文件拓展名

新建文本文档

重命名为 index.txt。

再用同样的方法创建 index1.txt

然后把以下内容复制进 index.txt。

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>新年快乐</title><!-- 这是网页标题 -->
<style>
@import url('https://fonts.googleapis.com/css?family=Poppins:100,200,300,400,500,600,700,800,900');

@font-face {
    font-family: mono;
    src: url(../fonts/JetBrainsMono-Medium.ttf);
}

* {
    padding: 0;
    margin: 0;
}

::placeholder {
    color: #009bff66;
}

a {
    text-decoration: none;
}

body .container {
    background-color: #1e1e22;
    box-sizing: border-box;
    height: 500vw;
    padding: 0 2vw;
}

body .container .main {
    margin: 0 auto;
    width: 80vw;
}

body .container .main .header {
    height: 60px;
    position: relative;
}

body .container .main .header .nav {
    height: 60px;
    display: inline-block;
}

body .container .main .header .nav li {
    float: left;
    height: 60px;
    line-height: 60px;
    margin: 0 1vw;
    font-family: 'Poppins', serif;
    font-size: 1vw;
    list-style: none;
}

body .container .main .header .nav li a {
    border-bottom: 1px solid #009bff;
    color: #ddd;
    transition: all 0.5s;
}

body .container .main .header .nav li a:hover {
    color: #009bff;
}

body .container .main .header .nav li p {
    color: #009bff;
}

body .container .main .header .btn-login {
    position: absolute;
    right: 0;
    top: 0;
    height: 60px;
    display: flex;
    flex-direction: row-reverse;
    align-items: center;
}

body .container .main .header .btn-login .nav-1 {
    padding: 0 20px;
    display: flex;
    flex-direction: row;
    height: 40px;
    line-height: 40px;
    color: #000;
    background-color: #009bff;
    border-radius: 20px;
    text-align: center;
    transition: all 0.3s;
}

body .container .main .header .btn-login .nav-1:hover {
    color: #ddd;
}

body .container .main .header .btn-login .nav-1 ion-icon {
    height: 40px;
    padding-right: 10px;
}

body .container .main .header .btn-login .nav-2 {
    padding: 0 20px;
    display: flex;
    flex-direction: row;
    height: 40px;
    line-height: 40px;
    color: #ddd;
    text-align: center;
    transition: all 0.3s;
}

body .container .main .header .btn-login .nav-2:hover {
    color: #009bff;
}

body .container .main .header .btn-login .nav-2 ion-icon {
    height: 40px;
    padding-right: 10px;
}

body .container .main section .title-bar {
    height: 10vw;
}

body .container .main section .title-bar .title {
    border-right: 2px solid #000;
    margin-top: 4vw;
    display: inline-block;
    font-size: 6vw;
    font-family: 'mono', serif;
    color: rgb(255, 255, 255);
    overflow: hidden;
    white-space: nowrap;
    animation: borders 1s infinite normal,
    widths 4s steps(16);
}

@keyframes borders {
    from {
        border-right-color: #000;
    }

    to {
        border-right-color: #ddd;
    }
}

@keyframes widths {
    from {
        width: 0;
    }

    to {
        width: 16ch;
    }
}

.about {
    margin-top: 3vw;
}

.about p {
    font-size: 1.5vw;
    font-family: 'Poppins', serif;
    color: #fff;
}

.func-1 {
    margin-top: 5vw;
    display: flex;
    flex-direction: row;
}

.func-1 .func-1-left {
    width: 55vw;
    margin-right: 5vw;
    border: 2px solid #ffffff;
    border-radius: 25px;
}

.func-1 .func-1-left #foo-bar {
    padding: 1vw;
}

.func-1 .func-1-left p {
    font-family: "Poppins", serif;
    font-size: 1.5vw;
    color: #fff;
    padding-left: 2vw;
}

#daily-words {
    padding-left: 3vw;
}

.shop {
    display: flex;
    flex-direction: column;
    margin: 2vw 0;
}

.shop a{
    color: #009bff;
    transition: all .5s;
}

.shop a:hover{
    color: white;
}

.shop p {
    font-family: "Poppins", serif;
    font-size: 1.5vw;
    color: #fff;
    padding-left: 1vw;
    border-left: 2px solid #009bff;
}

.shop h2 {
    color: white;
    margin-top: .5vw;
    font-weight: 300;
    font-family: "Poppins", serif;
    font-size: 1.5vw;
}

.shop h1{
    font-family: 'Poppins', serif;
    font-size: 3vw;
    font-weight: 400;
    color: #fff;
    transition: all 1s;
}

.shop h1:hover {
    color: #009bff;
}
</style>

</head>
<body>
    <style>
        body .container {
            background-color: black;
            box-sizing: border-box;
            height: 500vw;
            padding: 0 2vw;
        }
    </style>
    <div class="container">
        <div class="main">
            <ul class="header">
                <ul class="nav">
                    <li>
                        <a href="#">Back to top</a>
                    </li>
                </ul>
            </ul>
            <div class="shop" id="talk">
                <h1 style="color:white;">输入你的昵称</h1>
                <input type="text" style="width: 300px;height:30px;" id="a-name"><br>
                <button style="width: 60px;height:25px;" onclick="get()">提交</button>
            </div>
            <script>
                function get(){
                    var butt = document.getElementById("a-name").value;
                    // alert(butt);
                    window.location = "./index1.html?name="+butt;
                    window.sessionStorage.setItem('name', butt);  
                }
            </script>
        </div>
    </div>
  </body>
</html>

再把以下内容复制进 index1.html

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>新年快乐</title><!-- 这是网页标题 -->
<style>
body{
  overflow: hidden;
  margin: 0;
}
h1{
  position: fixed;
  top: 30%;
  left: 0;
  width: 100%;
  text-align: center;
  transform:translateY(-50%);
  font-family: 'Love Ya Like A Sister', cursive;
  font-size: 60px;
  color: #c70012;
  padding: 0 20px;
}
h1 span{
  position: fixed;
  left: 0;
  width: 100%;
  text-align: center;
margin-top:30px;
    font-size:40px;
}
</style>

</head>
<body>
<h1 id="h1"></h1>
<canvas></canvas> <!--canvas 画布-->

<script>
var canvas = document.querySelector("canvas"),
    ctx = canvas.getContext("2d");

var ww,wh;

function onResize(){
    ww = canvas.width = window.innerWidth;
    wh = canvas.height = window.innerHeight;
}

ctx.strokeStyle = "red";
ctx.shadowBlur = 25;
ctx.shadowColor = "hsla(0, 100%, 60%,0.5)";

var precision = 100;
var hearts = [];
var mouseMoved = false;
function onMove(e){
    mouseMoved = true;
    if(e.type === "touchmove"){
        hearts.push(new Heart(e.touches[0].clientX, e.touches[0].clientY));
        hearts.push(new Heart(e.touches[0].clientX, e.touches[0].clientY));
    }
  else{
        hearts.push(new Heart(e.clientX, e.clientY));
        hearts.push(new Heart(e.clientX, e.clientY));
    }
}

var Heart = function(x,y){
    this.x = x || Math.random()*ww;
    this.y = y || Math.random()*wh;
    this.size = Math.random()*2 + 1;
    this.shadowBlur = Math.random() * 10;
    this.speedX = (Math.random()+0.2-0.6) * 8;
    this.speedY = (Math.random()+0.2-0.6) * 8;
    this.speedSize = Math.random()*0.05 + 0.01;
    this.opacity = 1;
    this.vertices = [];
    for (var i = 0; i < precision; i++) {
        var step = (i / precision - 0.5) * (Math.PI * 2);
        var vector = {
            x : (15 * Math.pow(Math.sin(step), 3)),
            y : -(13 * Math.cos(step) - 5 * Math.cos(2 * step) - 2 * Math.cos(3 * step) - Math.cos(4 * step))
        }
        this.vertices.push(vector);
    }
}

Heart.prototype.draw = function(){
    this.size -= this.speedSize;
    this.x += this.speedX;
    this.y += this.speedY;
    ctx.save();
    ctx.translate(-1000,this.y);
    ctx.scale(this.size, this.size);
    ctx.beginPath();
    for (var i = 0; i < precision; i++) {
        var vector = this.vertices[i];
        ctx.lineTo(vector.x, vector.y);
    }
    ctx.globalAlpha = this.size;
    ctx.shadowBlur = Math.round((3 - this.size) * 10);
    ctx.shadowColor = "hsla(0, 100%, 60%,0.5)";
    ctx.shadowOffsetX = this.x + 1000;
    ctx.globalCompositeOperation = "screen"
    ctx.closePath();
    ctx.fill()
    ctx.restore();
};


function render(a){
    requestAnimationFrame(render);

    hearts.push(new Heart())
    ctx.clearRect(0,0,ww,wh);
    for (var i = 0; i < hearts.length; i++) {
        hearts[i].draw();
        if(hearts[i].size <= 0){
            hearts.splice(i,1);
            i--;
        }
    }
}


onResize();
window.addEventListener("mousemove", onMove);
window.addEventListener("touchmove", onMove);
window.addEventListener("resize", onResize);
requestAnimationFrame(render);

window.onload=function starttime(){
    time(h1,'2023/1/21');     // 2023年春节时间
    ptimer = setTimeout(starttime,1000); // 添加计时器
}

    function time(obj,futimg){
        var nowtime = new Date().getTime(); // 现在时间转换为时间戳
        var futruetime =  new Date(futimg).getTime(); // 未来时间转换为时间戳
        var msec = futruetime-nowtime; // 毫秒 未来时间-现在时间
        var time = (msec/1000);  // 毫秒/1000
        var day = parseInt(time/86400); // 天  24*60*60*1000
        var hour = parseInt(time/3600)-24*day;    // 小时 60*60 总小时数-过去的小时数=现在的小时数
        var minute = parseInt(time%3600/60); // 分 -(day*24) 以60秒为一整份 取余 剩下秒数 秒数/60 就是分钟数
        var second = parseInt(time%60);  // 以60秒为一整份 取余 剩下秒数
        obj.innerHTML="<br>距离春节还有:<br>"+day+"天"+hour+"小时"+minute+"分"+second+"秒"+"<br><span>愿我所想的事顺心如意。<br>and may the things I think of be all right.<br>祝"+window.sessionStorage.getItem('name')+"新年快乐!"+"</span>"
        return true;
    }
</script>
  <!-- <audio id="bgmusic" src="http://music.163.com/song/media/outer/url?id=1851244378.mp3" autoplay="autoplay" loop="loop" style="display: block; width: 3%; height:3%;"></audio> -->
    <script type="text/javascript">
        // alert(butt);
        document.addEventListener('DOMContentLoaded', function () {
            function audioAutoPlay() {
                var audio = document.getElementById('bgmusic');
                audio.play();
                document.addEventListener("WeixinJSBridgeReady", function () {
                    audio.play();
                }, false);
            }
            audioAutoPlay();
        });
</script>
</body>
</html>

重命名两个文件的后缀为 .html

然后双击 index.html,即可看到效果。

部署 Github

如果你想把你的网页分享给别人看,那你就要部署到 github(免费)

首先创建一个 github 账号,网址:github.com

注册好后创建一个仓库

命名为 xxx.github.io,例如 NewYear.github.io

然后进入这个页面

点这里

进入这个页面

把你刚才那两个文件拖到中间

点这

到这个页面

点这

到这个页面

点这

到这个页面

点这里,选择 main

变成这样

点 save

等几分钟刷新一下,出现类似这个就代表成功了

点这里就可以访问你的网站了

最后

最后也是给大家送上新年的祝福,再见~

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/174949.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

第三天总结 之 商品管理界面的实现 之 页面中 下拉框问题的解决

页面中下拉框问题的解决 在页面中 点击商品类型这个图标 会出现下拉框 展示所有的商品类型 然后通过选择的 类型 来作为 查询时的一个条件 即 当不选或选择展示所有商品时 按照 不对这个条件进行操作 选择其他的商品类型时 会查询出含有该类型的商品 下拉框中 数据的展示与 如…

java设计模式中责任链模式是什么/怎么用责任链模式避免if-else语句

继续整理记录这段时间来的收获&#xff0c;详细代码可在我的Gitee仓库SpringBoot克隆下载学习使用&#xff01; 6.5 责任链模式 6.5.1 定义 职责链模式&#xff0c;为避免请求发生者与多个处理者耦合在一起&#xff0c;将所有请求处理者通过前一对象记住其下一对象的引用而连…

重学Attention

注意力机制对比RNN 主要解决了RNN无法并行&#xff0c;并且不能解决长序列依赖问题 所以为什么设计 Q K V这三个矩阵 一边来是让 K V的 首先通过Q 和 K点击计算Attention矩阵&#xff0c;这个矩阵表明的是V上每一个特征与Q的相关程度&#xff0c;相关程度高的&#xff0c;权重…

解剖一道有意思的指针题

这道指针题挺有意思的&#xff0c;将各级指针之间的联系联系起来&#xff0c;仔细分析会发现也不难&#xff0c;重在逻辑思维&#xff0c;做完将会加深你对指针的理解的&#xff0c;好好享受指针带来的乐趣吧&#xff01;&#xff01;&#xff01;结果是什么呢&#xff1f;//题…

FPGA 20个例程篇:19.OV7725摄像头实时采集送HDMI显示(三)

第七章 实战项目提升&#xff0c;完善简历 19.OV7725摄像头实时采集送HDMI显示&#xff08;三&#xff09; 在详细介绍过OV7725 CMOS Sensor的相关背景知识和如何初始化其内部寄存器达到输出预期视频流的目的后&#xff0c;就到了该例程的核心内容即把OV7725输出的视频流预先缓…

Zotero入门教程

文章目录一、生成Bibliography二、Zotero文献自动导入1. 为什么要使用SCI-HUB2. 如何自定义PDF解析器三、在Zotero中添加Extension四、文件存储位置的修改五、markdown笔记功能一、生成Bibliography 在 Document Preferences中点击“管理样式”&#xff0c;就可以在Zotero Styl…

我的周刊(第075期)

我的信息周刊&#xff0c;记录这周我看到的有价值的信息&#xff0c;主要针对计算机领域&#xff0c;内容主题极大程度被我个人喜好主导。这个项目核心目的在于记录让自己有印象的信息做一个留存以及共享。&#x1f3af; 项目elasticvue[1]基于 Vue 的 Elasticsearch 管理客户端…

Linux常见命令 16 - 权限管理命令 chown, chgrp, umask

目录 1. 改变文件/目录所有者 chown 2. 改变文件/目录的所属组 chgrp 3. 显示文件的缺省(默认)权限 umask [-S] 1. 改变文件/目录所有者 chown 改变文件权限使用chmod&#xff0c;只有root和当前文件拥有者可以更改&#xff0c;如果想要更改目录/文件的所有者&#xff0c…

MutationObserver的示例代码的使用(附示例代码)

MutationObserver的使用 首先先介绍一下MutationObserver的特点 1.MutationObserver的回调属于微队列 2.它会在触发指定 DOM 事件时&#xff0c;调用指定的回调函数&#xff0c;说白了就是用来检测DOM节点的 MutationObserver回调函数 参数 callback 一个回调函数&#xff0…

论文投稿指南——中文核心期刊推荐(环境科学 2)

【前言】 &#x1f680; 想发论文怎么办&#xff1f;手把手教你论文如何投稿&#xff01;那么&#xff0c;首先要搞懂投稿目标——论文期刊 &#x1f384; 在期刊论文的分布中&#xff0c;存在一种普遍现象&#xff1a;即对于某一特定的学科或专业来说&#xff0c;少数期刊所含…

在甲骨文云容器实例(Container Instances)上部署Oracle Linux 7 Desktop

甲骨文云推出了容器实例&#xff0c;这是一项无服务器计算服务&#xff0c;可以即时运行容器&#xff0c;而无需管理任何服务器。 今天我们尝试一下通过容器实例部署Oracle Linux 7 Desktop。 创建容器实例 在甲骨文容器实例页面&#xff0c;单击"创建容器实例"&am…

分享150个PHP源码,总有一款适合您

PHP源码 分享150个PHP源码&#xff0c;总有一款适合您 下面是文件的名字&#xff0c;我放了一些图片&#xff0c;文章里不是所有的图主要是放不下...&#xff0c; 150个PHP源码下载链接&#xff1a;https://pan.baidu.com/s/1PWajFunhPFyoNFGc6F4qSQ?pwd0sq5 提取码&#…

Linux rm命令详解,Linux删除文件目录

「作者主页」&#xff1a;士别三日wyx 「作者简介」&#xff1a;CSDN top100、阿里云博客专家、华为云享专家、网络安全领域优质创作者 rm 命令一、常用操作1. 删除文件2. 删除目录二、其他操作作用&#xff1a;删除文件或目录 参数&#xff1a; -f 直接删除&#xff0c…

steam/csgo搬砖项目真的假的?

本文全文干货分享&#xff0c;如果你想通过steam搬砖做副业赚钱&#xff0c;看这一篇就够了&#xff01; 这个项目是什么意思&#xff1f; 是不是你也很好奇这个玩法&#xff1f;我们先看下我们自己的数据&#xff0c;再来解释一下我们怎么赚的钱 一、项目原理 利用steam平台…

【Spring5源码学习】Spring基础介绍及调试环境搭建

Spring 是一款用于简化企业级 Java 应用开发的分层开源框架&#xff0c;有着强大的扩展和融合能力&#xff0c;它善于整合各种单层框架并建立起完整的体系&#xff0c;能高效统一的构造可提供企业级服务的应用系统。 1、Spring 概述 Spring Framework 是一个分层非常清晰并且依…

[C++]深复制与浅复制

深复制与浅复制 C中&#xff0c;默认的复制构造函数只能实现浅复制。 浅复制指的是在对象复制前&#xff0c;只对对象中的数据成员进行简单的复制 大多数情况下"浅复制"已经能很好的工作了&#xff0c;但是当类的数据成员中有指针类型时&#xff0c;浅复制只会复制指…

Gulp.Task 正解

gulp task 实现过程 今天从源码的角度分析下 gulp 中 task 的实现过程。多个 task 是如何执行&#xff1f;&#xff1f;&#xff1f; 等等 gulp 插件分布图 其实通过上述截图可以看到&#xff0c;其实整个 gulp 内部什么逻辑都没有&#xff0c;都是由一个一个插件组成的。上述的…

Java多线程案例之单例模式(饿汉,懒汉)

目录 一、饿汉模式 二、懒汉模式 前言&#xff1a;单例模式是校招中最常见的设计模式之一。下面我们来谈谈其中的两个模式&#xff1a;懒汉&#xff0c;饿汉。 何为设计模式&#xff1f; 设计模式是软件开发人员在软件开发过程中面临的一般问题的解决方案。这些解决方案是众多…

《Linux性能优化实战》学习笔记 Day04

06 | 锁&#xff1a;如何根据业务场景选择合适的锁&#xff1f; 原文摘抄 当你无法判断锁住的代码会执行多久时&#xff0c;应该首选互斥锁&#xff0c;互斥锁是一种独占锁。 如果你能确定被锁住的代码执行时间很短&#xff0c;就应该用自旋锁取代互斥锁。 对于 99% 的线程…

工信部电子标准院:龙蜥操作系统获评“优秀”

近日&#xff0c;工信部中国电子技术标准化研究院公布第二批通过开源项目成熟度评估的开源项目名单&#xff0c;龙蜥操作系统&#xff08;Anolis OS&#xff09;凭借在生态构建、技术创新、应用落地等方面的成熟能力与卓越表现&#xff0c;顺利通过评估并获得优秀贰级&#xff…