HTML中的年历代码可以在网页上展示一年中所有的日期和节假日。以下是一个简单的案例:
<!DOCTYPE html> <html> <head> <Meta charset="utf-8"> <title>2022年年历</title> <style> table { border-collapse: collapse; font-size: 14px; } th,td { border: 1px solid #ccc; padding: 5px; text-align: center; } th { background-color: #f0f0f0; } caption { margin-bottom: 10px; font-size: 16px; font-weight: bold; } </style> </head> <body> <table> <caption>2022年年历</caption> <thead> <tr> <th>一月</th> <th>二月</th> <th>三月</th> <th>四月</th> <th>五月</th> <th>六月</th> </tr> </thead> <tbody> <tr> <td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td> </tr> <tr> <td>7</td><td>8</td><td>9</td><td>10</td><td>11</td><td>12</td> </tr> <tr> <td>13</td><td>14</td><td>15</td><td>16</td><td>17</td><td>18</td> </tr> <tr> <td>19</td><td>20</td><td>21</td><td>22</td><td>23</td><td>24</td> </tr> <tr> <td>25</td><td>26</td><td>27</td><td>28</td><td>29</td><td>30</td> </tr> <tr> <td>31</td> </tr> </tbody> </table> </body> </html>
上面的代码使用了HTML的