测试开发进阶(十一)
HTML
HTML 超文本标记语言,网页制作的编程语言
结构
1 |
|
<!DOCTYPE html>: HTML5的声明
<meta>:声明,例如编码
<title>:网页名称
<body>:主体内容

标签
注释:
<!-- 我是注释 -->段落标签:
<p></p>标题:
1 | <h1>标题1</h1> |

换行:
<br>水平线:
<hr>
1 | <p>「测试游记」</p> |

- 块标签:
<div></div>

1 | <div style="width: 300px; height: 200px; background-color: red"> |
增加大小,背景颜色

- 行内元素:
<span></span>不会换行
1 | <span>66666</span> |

- 字体倾斜
<i></i> - 比较重要的字体倾斜
<em></em>
1 | <i>「测试游记」</i> |

- 字体加粗
<b></b> - 比较重要的字体加粗
<strong></strong>
1 | <b>「测试游记」</b> |

- 图片:
<img src="" alt="">
图片无法加载:
1 | <img src="pic.JPG1" alt="背景图片"> |

正常加载
1 | <img src="pic.JPG" alt="背景图片" height="600px" width="300px"> |

- 超链接:
<a href=""></a>
1 | <a href="https://map.baidu.com">百度地图</a> |

- 链接到外部样式:
<link rel="stylesheet" href=""> - 无序列表
1 | <ul> |
快速语法:ul>li*5创建5条内容的列表
1 | <ul> |

- 有序列表
快速语法:ol>li*5创建5条内容的列表
1 | <ol> |

- 表格
<table></table>
1 | <table> |

form表单
简单的编写一个flask测试页面
1 | from flask import Flask |
编写一个表单
action:地址method:方式
1 | <form action="http://127.0.0.1:5000/" method="get"> |
提交:http://127.0.0.1:5000/?user=zx&pwd=123456

点击提交

文本输入框:
<input type="text" name="user">密码输入框:
<input type="password" name="pwd">提交按钮:
<input type="submit">单选框:
提交:http://127.0.0.1:5000/?user=&pwd=&like=python
1 | 编程语言: |

- 多选框:
1 | <input type="checkbox" name="skill" value="Django"> Django |

提交:http://127.0.0.1:5000/?user=&pwd=&skill=Django&skill=Flask&skill=scrapy&skill=pytest
- 文件上传
1 | 文件上传<input type="file" name="hello"> |


- 普通按钮
1 | <input type="button" value="普通按钮"> |

- 重置按钮
1 | <input type="reset" name="resetbtn"> |

输入内容后,点击重置会把填入的内容清空
- 图片按钮
点击图片后会提交
1 | <input type="image" src="pic.JPG" height="300px" width="150px"> |

- 隐藏表单域:
1 | <input type="hidden" name='csrf' value="隐藏表单域" > |
提交的内容:http://127.0.0.1:5000/?user=&pwd=&hello=&csrf=隐藏表单域
- label标签
for属性关联input的id
1 | <label for="user">用户名:</label> |
点击用户名之后激活输入框


1 | <input type="radio" name="like" value="python" id="python"> <label for="python">Python</label> |
点击python文字会自动选中python单选框,点击Java不会选中

- 大文本输入框
1 | <label for="user_info">个人介绍</label> |

- 下拉选择框
1 | <label for="city">城市</label> |

选中「浙江」后提交:http://127.0.0.1:5000/?user=&pwd=&hello=&csrf=隐藏表单域&city=0
city=0
iframe 内联框架
iframe元素会创建包含另外一个文档的内联框架(行内框架)
例子:将其他页面的内容链接到当前页面
1 | <iframe src="https://www.baidu.com/" frameborder="0" height="500px" width="600px">百度</iframe> |
