我的第一个网页
<!--声明为html5文档-->
<!DOCTYPE html>
<html lang="en">
<!--head : 网页头部-->
<head>
<!--meta : 表述性标签,用来描述一些网页的信息-->
<!--meta一般用来做SEO-->
<meta charset="UTF-8">
<meta name="keywords" content="我的第一个网页">
<meta name="description" content="学习html">
<!-- title : 网页标题 -->
<title>我的第一个网页</title>
</head>
<!--body : 网页主体-->
<body>
Hello World!
</body>
</html>
基本标签
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>基本标签</title>
</head>
<body>
<!--标题标签-->
<h1>一级标签</h1>
<h2>二级标签</h2>
<h3>三级标签</h3>
<h4>四级标签</h4>
<h5>五级标签</h5>
<h6>六级标签</h6>
<!--段落标签-->
<p>基本标签学习</p>
<!--水平线标签-->
<hr/>
<!--换行标签-->
<br/>
<!--粗体,斜体-->
<string>基本标签</string>
<em>基本标签</em>
<!--特殊符号-->
<br/>
空格
<br/>
大于号 >
<br/>
小于号 <
<br/>
</body>
</html>
图片标签
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<!--
src : 图片地址
相对地址,绝对地址
../ 上一级目录
-->
<img src="../image/1.jpg" alt="图片名字" title="悬停文字" width="300" height="300">
</body>
</html>
链接标签
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>链接标签</title>
</head>
<body>
<!--
href : 表示摇跳转到哪个页面
target : 表示窗口再哪里打开
_blank 在新标签中打开
_self 在自己的网页中打开
-->
<a href="1.我的第一个网页.html" target="_blank"> 点击我跳转到页面一</a>
<br/>
<a href="1.我的第一个网页.html">
<img src="../image/1.jpg" alt="图片名字" title="悬停文字" width="300" height="300">
</a>
<br/>
<!--锚链接
1.需要一个锚标记
2.跳转到标记
-->
<a name="top"></a>
<a href="#top">回到顶部</a>
</body>
</html>
列表
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>列表</title>
</head>
<body>
<!--有序列表-->
<ol>
<li>1</li>
<li>2</li>
<li>3</li>
<li>4</li>
<li>5</li>
<li>6</li>
</ol>
<!--无须列表-->
<ul>
<li>1</li>
<li>2</li>
<li>3</li>
<li>4</li>
<li>5</li>
<li>6</li>
</ul>
<!--无序列表
dl : 标签
dt : 列表名称
dd : 列表内容
-->
<dl>
<dt>学科</dt>
<dd>1</dd>
<dd>2</dd>
<dd>3</dd>
<dd>4</dd>
<dd>5</dd>
<dd>6</dd>
</dl>
</body>
</html>
表格
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>表格</title>
</head>
<body>
<!--表格 table
行 tr
列 td
-->
<table border="1px">
<tr>
<!-colspan 跨列-->
<td colspan="4">1-1</td>
</tr>
<tr>
<!--rowspan 跨行-->
<td rowspan="2">2-1</td>
<td>2-2</td>
<td>2-4</td>
<td>2-5</td>
</tr>
<tr>
<td>3-1</td>
<td>3-2</td>
<td>3-2</td>
</tr>
</table>
</body>
</html>
媒体元素
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>媒体元素</title>
</head>
<body>
<!--音频和视频
str : 资源路径
controls : 控制条
-->
<video src="../video/1.mp4" controls></video>
<audio src="" controls></audio>
</body>
</html>
页面结构分析
header 标题头部区域的内容
footer 标记脚步区域的内容
section web页面中的一块独立区域
article 独立的文章内容
aside 相关内容或应用
nav 导航内辅助内容
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>页面结构</title>
</head>
<body>
<header>
<h2>网页头部</h2>
</header>
<section>
<h2>网页主体</h2>
</section>
<footer>
<h2>网页脚步</h2>
</footer>
</body>
</html>
iframe内联框架
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>iframe内联框架</title>
</head>
<body>
<!--iframe内联框架
src : 地址
w-h : 宽度高度
-->
<!--b站分享视频代码参考-->
<iframe src="//player.bilibili.com/player.html?aid=55631961&bvid=BV1x4411V75C&cid=97257967&page=11"
scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true">
</iframe>
</body>
</html>
表单
<!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="1.我的第一个网页.html" method="post">
<!--文本输入框 : input type="text"
value : 默认初始值
maxlength : 最长能写几个字符
size : 文本框的长度
-->
<p>名字:<input type="text" name="username" value="admin" readonly></p>
<p>密码:<input type="password" name="password" maxlength="8" size="10"></p>
<!--单选框标签
value : 单选框的值
name : 表示组
-->
<p>
性别:
<input type="radio" value="boy" name="sex"> 男
<input type="radio" value="girl" name="sex"> 女
</p>
<!--多选框标签-->
<p>
<input type="checkbox" value="sleep" name="hobby"> 睡觉
<input type="checkbox" value="code" name="hobby"> 敲代码
<input type="checkbox" value="game" name="hobby"> 游戏
</p>
<!--按钮-->
<p>
按钮:
<input type="button" name="btn1" value="点击">
<input type="image" src="../image/1.jpg">
</p>
<!--下拉框,列表框-->
<p>
下拉框,列表框:
<select name="列表名称">
<option value="A">A</option>
<option value="B" selected>B</option>
<option value="C">C</option>
</select>
</p>
<!--文本域-->
<p>
文本
<textarea name="textarea" cols="30" rows="10">文本内容</textarea>
</p>
<!--文件域-->
<p>
文件
<input type="file" name="file">
</p>
<!--邮件验证-->
<p>
邮箱
<input type="email" name="email">
</p>
<!--URL-->
<p>
URL
<input type="url" name="url">
</p>
<!--数字-->
<p>
<input type="number" name="num" max="100" min="0" step="1">
</p>
<!--滑块-->
<p>
<input type="range" name="range">
</p>
<!--搜索框-->
<p>
<input type="search" name="search">
</p>
<p>
<input type="submit">
<input type="reset" value="清空表单">
</p>
</form>
</body>
</html>