html怎么制作万年历,js+html制作简单日历的方法

这篇博客介绍了一位新手如何使用JavaScript和HTML创建一个简单的日历插件。通过CSS样式设置布局,JavaScript计算每个月的天数,以及根据日期标记不同的样式。点击按钮可以切换月份,显示当前日期,并标记周末。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

新手一枚,不会写什么高大上的博文,一些平时做的小练习,献丑

b2495f5b68a5fed516d15a2abc8f7fc8.png

代码:

无标题文档

* {margin: 0;padding: 0}

#calendar {width: 210px;margin: 100px auto;overflow: hidden;border: 1px solid #000;padding: 20px;position: relative}

#calendar h4 {text-align: center;margin-bottom: 10px}

#calendar .a1 {position: absolute;top: 20px;left: 20px;}

#calendar .a2 {position: absolute;top: 20px;right: 20px;}

#calendar .week {height: 30px;line-height: 20px;border-bottom: 1px solid #000;margin-bottom: 10px}

#calendar .week li {float: left;width: 30px;height: 30px;text-align: center;list-style: none;}

#calendar .dateList {overflow: hidden;clear: both}

#calendar .dateList li {float: left;width: 30px;height: 30px;text-align: center;line-height: 3

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值