HTML基础指令
导航
<h1></h1> <div></div> <span></span> <a></a> <img /> <ul><li></li></ul> <table></table> <input type=""> <select><option></option></select> <textarea></textarea>
标题
<h1></h1> <h2></h2> <h3></h3> ...
div
<div> 内容 # 占一整行 </div>
span
<span>内容有多少就占多少</span>
超链接
# 自己的本地网站可以简写(不用http://127.0.0.1:5000) <a href="xxx.html">点击跳转</a> # 在新标签打开 <a href="xxx.html" target="_blank">点击跳转</a>
图片
<img src="图片地址" /> # 本地图片要放在项目下static文件夹中 <img src="/static/图片.png" /> # 设置宽高(可以填百分比等) <img style="height: 100px; width:100px" src="/static/图片.jpg" />
列表
# 无序列表 <ul> <li>1</li> <li>2</li> <li>3</li> </ul> # 有序列表 <ol> <li>1</li> <li>2</li> <li>3</li> </ol>
表格
<table> <thead> <tr> <th>表头第一行</th> <th>表头第二行</th> </tr> </thead> <tbody> <tr> <td>表单第一行</td> <td>表单第二行</td> </tr> </tbody> </table>
input
<input type="text"> # 文本框 <input type="password"> # 密码框 <input type="file"> # 上传文件 <input type="radio" name="n1"> # 选择框(互斥) <input type="radio" name="n1"> # 同上(演示互斥) <input type="checkbox" value="传到给后端的名称"> # 复选框 <input type="button" value="提交"> # 普通按钮 <input type="submit" value="提交"> # 提交表单按钮
下拉框
# 加上multiple可以多选 <select multiple> <option>下拉内容</option> </select>
多行文本
# rows="3"为默认可以写3行,可以拉伸 <textarea rows="3"></textarea>
网络请求
GET请求
可以用 URL方法 或 表单提交
请求后向后台传入数据会拼接在URL上# action为发送路径,method为提交方式 <form action="/login" method="get"> 用户名:<input type="text" name="username"> 密码:<input type="text" name="password"> <input type="submit" value="登录"> </form>
POST请求
仅能使用 表单提交
提交数据不在URL上,而是在请求体中