揭秘:HTML 实现文字动画、列表、表格、表单与图形设计全攻略
以下是根据你需求生成的完整 HTML 代码: ```html <!DOCTYPE html> <html lang="zh-CN"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>网页综合示例</title> <style> /* 一、文字和动画样式 */ .scrolling-text { color: green; font-size: 24px; font-family: 楷体; font-weight: bold; } .blinking-text { color: purple; font-size: 20px; font-family: 黑体; animation: blink 1s infinite; } @keyframes blink { 0% { opacity: 1; } 50% { opacity: 0; } 100% { opacity: 1; } } /* 三、表格样式 */ table { font-family: 宋体; } /* 四、表单样式 */ form { margin-top: 20px; } /* 五、图形设计样式 */ .circle { width: 100px; height: 100px; background-color: blue; border-radius: 50%; display: flex; justify-content: center; align-items: center; color: white; } .rectangle { width: 200px; height: 100px; background-color: yellow; display: flex; justify-content: center; align-items: center; } </style> </head> <body> <!-- 一、在网页中显示文字和动画 --> <marquee class="scrolling-text">山东旅游职业学院</marquee> <p class="blinking-text">欢迎参加网页制作考试</p> <!-- 二、创建有序列表和无序列表 --> <ol> <li>四季顺序:</li> <li>A. 春</li> <li>B. 夏</li> <li>C. 秋</li> <li>D. 冬</li> </ol> <ul> <li>编程语言</li> <li>Python</li> <li>Java</li> <li>C++</li> <li>Ruby</li> <li>Swift</li> </ul> <!-- 三、设计表格 --> <table border="1"> <tr> <th style="width: 100px;">姓名</th> <th style="width: 80px;">年龄</th> <th style="width: 60px;">性别</th> <th style="width: 120px;">职业</th> </tr> <tr> <td>张三</td> <td>25</td> <td>男</td> <td>工程师</td> </tr> </table> <table border="1"> <tr style="background-color: lightgray;"> <th style="font-family: 黑体; background-color: lightblue;">书名</th> <th style="font-family: 隶书; background-color: lightgreen;">作者</th> <th style="font-family: 仿宋; background-color: lightyellow;">出版年份</th> <th style="font-family: 楷书; background-color: lightpink;">价格</th> </tr> <tr> <td>《HTML 入门》</td> <td>李四</td> <td>2023</td> <td>50</td> </tr> </table> <!-- 四、设计表单 --> <form> <label for="email">电子邮箱:</label> <input type="email" id="email" name="email"><br> <label for="password">密码:</label> <input type="password" id="password" name="password"><br> <label for="name">姓名:</label> <input type="text" id="name" name="name"><br> <label>性别:</label> <input type="radio" id="male" name="gender" value="男"> <label for="male">男</label> <input type="radio" id="female" name="gender" value="女" checked> <label for="female">女</label><br> <label for="grade">年级:</label> <select id="grade" name="grade" size="3"> <option value="大一">大一</option> <option value="大二">大二</option> <option value="大三">大三</option> </select><br> <label for="feedback">意见反馈:</label><br> <textarea id="feedback" name="feedback" rows="4" cols="40"></textarea> </form> <!-- 五、用 DIV+CSS 实现图形设计 --> <div class="circle">欢迎</div> <div class="rectangle">考试进行中...</div> </body> </html> ``` 额外需要注意的逻辑点 1. 在设计表单时,要注意每个输入框和表单元素的`name`属性,它是表单数据提交时的关键标识,不同元素的`name`不能重复。 2. 对于表格的样式设置,不同浏览器可能对表格边框、颜色等样式的渲染有细微差异,需要进行兼容性测试。 3. 在使用 CSS 动画(如文字闪烁动画)时,要考虑到不同浏览器对动画属性的支持情况,必要时添加浏览器前缀以保证兼容性。 ######[AI写代码神器 | 1423点数解答 | 2025-06-13 09:22:37]
- Python 实现球类:精准计算半径、表面积与体积,附输入验证与异常处理!(阿里通义 | 261点数解答 | 2024-11-28 21:19:39)349
- 揭秘!十进制整数转其他进制用啥存储结构最合适?答案竟是它!(字节豆包 | 57点数解答 | 2024-11-13 01:21:11)236
- 优化高中英语核心词汇短语HTML页面,这些建议不容错过!(DeepSeek | 217点数解答 | 2025-07-01 23:41:02)191
- Android开发必备:多种动画API解析及使用注意事项(阿里通义 | 355点数解答 | 2023-11-07 22:46:27)232
- 2 秒动画搞定!“好句子”如何稳停结束位置( | 456点数解答 | 2024-05-19 16:46:15)275
- 计算机表格数据结构全解析:从基础概念到 CSV 文件编程排序实现 (字节豆包 | 257点数解答 | 2025-12-08 17:31:17)47
- 单机版保质期管理系统 HTML 实现及开发要点(字节豆包 | 2458点数解答 | 2026-04-01 06:49:18)9
- Java JSP 代码:用 List 存储 Map 集合并循环添加姓名和年龄(GPT | 240点数解答 | 2024-11-25 09:17:43)248
- 微信钱包前端演示代码:从问题修正到完善功能及安全提示(字节豆包 | 2097点数解答 | 2025-07-11 18:06:46)152
- 英文打字练习程序:从问题重重到全面优化的蜕变(字节豆包 | 2538点数解答 | 2025-08-20 12:28:06)164
- 巧用 CDN 搭建含照片轮播、社交链接与 AI 对话的单页个人网页(字节豆包 | 485点数解答 | 2024-10-28 23:31:13)248
- 巧用 CDN 搭建单页个人网页:含照片轮播、社交链接与 AI 对话界面 (阿里通义 | 1752点数解答 | 2024-10-28 23:32:45)237