前端 html基础篇
<!-- DOCTYPE:告诉游览器,我们要使用什么规范 -->
<!DOCTYPE html>
<html lang="en">
<!-- head标签代表网页头部 -->
<head>
<!-- meta标书性标签,它用来描述我们网站的一些信息 -->
<!-- meta一般用来做SEO -->
<meta charset="UTF-8">
<!-- title网页标签 -->
<title>Title</title>
</head>
<!-- body标签代表网页主体 -->
<body>
Hello,World!
</body>
</html>
html的排版:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<!-- 标题标签 -->
<h1> 一级标题 </h1>
<h2> 二级标题 </h2>
<h3> 三级标题 </h3>
<h4> 四级标题 </h4>
<h5> 五级标题 </h5>
<h6> 六级标题 </h6>
<!-- 段落标签 -->
<p>一只小老虎</p>
<p>两只小老虎</p>
<!-- 换行标签 -->
一只小老虎<br/>
两只小老虎<br/>
<!-- 粗体,斜体 -->
<h1>字体样式标签</h1>
粗体:<strong>强壮的小老虎</strong><br/>
斜体:<em>em瘦弱的小老虎</em>
<p></p>
<!-- 特殊符号 -->
空 格<br/>
牛逼的空 格<p></p>
©Settle<br/>
><br/>
<<br/>
</body>
</html>
图像:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>图像标签学习</title>
</head>
<body>
<!-- img学习
src:图片地址
相对地址(推荐使用),绝对地址(可能很长)或同一目录下
../ --上级目录
-->
<img src="bird.png" alt="flybird" title="bird" width="150" height="150">
</body>
</html>
超链接(反复横跳):
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>链接标签学习</title>
</head>
<body>
<!-- name作为标记 -->
<!-- 标签 href : 必填,表示要跳转到那个页面
target : 表示窗口在哪里打开
_blank 在新标签中打开
_self 在自己的网页中打开-->
<a href="第一个网页.html" target="_blank">点击我跳转到第一个页面</a>
<a href="https://www.baidu.com" target="_self">点击我跳转到百度</a>
<p></p>
<a href="第一个网页.html">
<img src="bird.png" alt="bird" height="200" width="200">
</a>
<p></p>
<a href="第一个网页.html">
<img src="bird.png" alt="bird" height="200" width="200">
</a>
<p></p>
<a href="第一个网页.html">
<img src="bird.png" alt="bird" height="200" width="200">
</a>
<a name = "top">顶部</a>
<!-- 锚链接
1. 需要一个锚标记
2. 跳转到标记-->
<a href="#top">回到顶部</a>
<a name="down">down</a>
<!-- 功能性链接
邮件: maiilto:
QQ连接:
-->
<a href = "mailto:2472342@qq.com">联系我</a>
<a target="_blank" href="http://wpa.qq.com/msgrd?v=3&uin=&site=qq&menu=yes">
<img border="0" src="http://wpa.qq.com/pa?p=2::53" alt="你好,加我ddd" title="你好,加我ddd"/></a>
</body>
</html>
…
列表:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>列表学习</title>
</head>
<body>
<!--有序列表
应用范围:试卷,问答 ...
-->
<ol>
<li>Java</li>
<li>Python</li>
<li>运维</li>
<li>前端</li>
<li>C/c++</li>
</ol>
<hr/>
<!--无序列表
应用范围:导航, 侧边栏 ...
-->
<ul>
<li>Java</li>
<li>Python</li>
<li>运维</li>
<li>前端</li>
<li>C/c++</li>
</ul>
<!--自定义列表
dl : 标签
dt : 列表名称
dd : 列表内容
-->
<dl>
<dt>学科</dt>
<dd>Java</dd>
<dd>Python</dd>
<dd>运维</dd>
<dd>C</dd>
<dt>位置</dt>
<dd>西安</dd>
<dd>北京</dd>
<dd>新疆</dd>
</dl>
</body>
</html>
表格
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>表格学习</title>
</head>
<body>
<!--表格table
行 tr rows
列 td -->
<table border = "1px">
<tr>
<!--colspan 跨列-->
<td colspan="3">学生成绩</td>
</tr>
<tr>
<!--rowspan 跨行-->
<td rowspan="2">小天</td>
<td>语文</td>
<td>100</td>
</tr>
<tr>
<td>数学</td>
<td>100</td>
</tr>
<tr>
<!--rowspan 跨行-->
<td rowspan="2">Settle</td>
<td>语文</td>
<td>100</td>
</tr>
<tr>
<td>数学</td>
<td>100</td>
</tr>
</table>
</body>
</html>
视频和音频
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>媒体学习</title>
</head>
<body>
<!--音频和视频
src : 资源路径
controls : 控制条
autoplay :自动播放-->
<video src="../resources/video/xxx.mp4" controls autoplay></video>
<audio src="../resources.audio/xxxx.mpe"></audio>
</body>
</html>
我没有资源这里就不上结果了。
页面架构分析:
iframe内联框架
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>iframe学习</title>
</head>
<!--视频内嵌-->
<body>
<iframe src="https://www.baidu.com" frameborder="0" width="1000px" height="800px"></iframe>
<!--<iframe src="//player.bilibili.com/player.html?aid=82042680&bvid=BV1JJ41177di&cid=140371738&page=1"-->
<!-- scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true"> </iframe>-->
</body>
</html>
post和get的提交
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>注册登录</title>
</head>
<body>
<h1>注册</h1>
<!--表单form
action : 表单提交的位置,可以是网站,也可以是一个请求处理地址
method : post , get提交方式
get方式提交:我们可以在url中看到我们的提交信息,不安全,高效
post:比较安全,传输大文件
-->
<form action = "第一个网页.html" method = "post">
<!-- 文本输入框 : input type = "text" -->
<p>名字: <input type="text" name="username"></p>
<!-- 密码框 : input type="password"-->
<p>密码:<input type="password" name="pwd"></p>
<!-- 邮件 : input type="mail" -->
<p>邮件:<input type="email" name="mail"></p>
<p>
<input type="submit">
<input type="reset">
</p>
</form>
</body>
</html>
post安全点
表单语法
<!-- 多选框:checkbox
复选框:radio-->
<p>
<input type="checkbox" value="boy" name="sex"/>男
<input type="radio" value="girl" name="sex"/>女
</p>
<!-- 按钮
input type="button"
input type="image"
input type="submit"
input type="reset"
-->
<p>
<input type="button" name="btn1" value="点击变长">
<input type="image" src="bird.png">
</p>
文本域和文件域
<!-- 文本域 -->
<p>反馈:
<textarea name="textarea" cols="50" rows="10" >文本内容</textarea>
</p>
<!-- 文件区域 -->
<p>
<input type="file" name="files">
<input type="button" value="上传" name="upload">
</p>
<p>
<input type="submit">
<input type="reset">
</p>
搜索框和简单验证
<!-- URL -->
<p> URL:
<input type="url" name="url">
</p>
<!-- 数字 -->
<p>
<input type="number" name="number" max="100" min="0" step="1">
</p>
<!-- 滑块 -->
<p>音量:
<input type="range" name="voice" min="0" max="100" step="2">
</p>
<!-- 搜索框 -->
<p>搜索 :
<input type="search" name="search">
</p>
<p>
<input type="submit">
<input type="reset">
</p>
表单的应用
只读
readonly
禁用
disabled
复选默认禁选
checked disabled
隐藏
hidden
增强鼠标可用性:
<!-- 搜索框 -->
<p>搜索 :
<input type="search" name="search" id="mark">
</p>
<!-- 增强鼠标可用性 -->
<p>
<label for="mark">选中输入框</label>
<input type="text">
</p>
表单验证初级:
placeholder提示信息
required非空判断
pattern正则表达式
<p>名字: <input type="text" name="username" placeholder="请输入用户名" required></p>
<p>邮件:<input type="email" name="mail" pattern="^\d{50}$" placeholder="至少输入50个字符" required></p>