lyx20131111的猪耶
lyx20131111 · · 休闲·娱乐
<div style="display: flex; justify-content: space-between; align-items: center; background: #f8f0f5; padding: 20px; border-radius: 10px;"> <!-- 左侧自动更新文字区 --> <div id="left-text" style="text-align: left; font-size: 18px; line-height: 1.8;"> <p>欢迎您朋友 🎉</p> <p id="date-info"></p> <p id="day-of-year"></p> <p id="birthday-countdown"></p> <p>Ciallo~(∠・ω<)⌒★</p> </div>
<!-- 中间图片区(替换成你的灵梦图片链接) --> <div style="margin: 0 20px;"> <img src="https://cdn.luogu.com.cn/upload/image_hosting/这里替换成你的图片ID.png" alt="灵梦" style="width: 150px;"> </div>
<!-- 右侧你的账号信息区 --> <div style="text-align: left; font-size: 18px; line-height: 1.8;"> <p><img src="https://cdn.luogu.com.cn/upload/image_hosting/这里替换成图标ID.png" style="width: 24px; vertical-align: middle; margin-right: 8px;"> 洛谷:lyx20131111</p> <p>目标:红名230 | 每日打卡刷题</p> <p>邮箱:你自己的邮箱@xx.com</p> </div> </div>
<script> // 在这里设置你的生日(月、日) const birthMonth = 11; // 你的生日月份,比如11月就写11 const birthDay = 11; // 你的生日日期,比如11日就写11
// 星期映射 const weekDays = ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"];
// 获取当前日期 const now = new Date(); const year = now.getFullYear(); const month = now.getMonth() + 1; const day = now.getDate(); const weekDay = weekDays[now.getDay()];
// 计算一年中的第几天 const startOfYear = new Date(year, 0, 1); const dayOfYear = Math.ceil((now - startOfYear) / (1000 60 60 * 24));
// 计算生日倒计时 let nextBirthday = new Date(year, birthMonth - 1, birthDay); if (nextBirthday < now) { nextBirthday = new Date(year + 1, birthMonth - 1, birthDay); } const daysToBirthday = Math.ceil((nextBirthday - now) / (1000 60 60 * 24));
// 写入页面
document.getElementById("date-info").textContent = 今天是 ${month} 月 ${day} 日,${weekDay};
document.getElementById("day-of-year").textContent = 也是 ${year} 年的第 ${dayOfYear} 天;
document.getElementById("birthday-countdown").textContent = 距离我的生日还有 ${daysToBirthday} 天;
</script>