HTML学习
什么是HTML
- HTML
- Hyper Text Markup Language(超文本标记语言)
HTML发展

HTML5的优势
- 世界知名浏览器厂商对HYML5的支持
- 市场的需求
- 跨平台
W3C标准
- W3C
- World Wide Web Consortium(万维网联盟)
- 成立于1994年,Web技术领域最权威和具影响力的国际中立性技术标准机构
- http://www.w3.org/
- http://www.chinaw3c.org/
- W3C标准包括
- 结构化标准语言(HTML、XML)
- 表现标准语言(CSS)
- 行为标准(DOM、ECMAScript)
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>
<p>桃花坞里桃花庵,桃花庵里桃花仙;</p>
<p>桃花仙人种桃树,又摘桃花卖酒钱。</p>
<p>酒醒只在花前坐,酒醉还须花下眠;</p>
<p>半醒半醉日复日,花落花开年复年。</p>
<p>但愿老死花酒间,不愿鞠躬车马前;</p>
<p>车尘马足富者趣,酒盏花枝贫者缘。</p>
<p>若将富贵比贫贱,一在平地一在天;</p>
<p>若将贫贱比车马,他得驱驰我得闲。</p>
<p>别人笑我太疯癫,我笑他人看不穿;</p>
<p>不见五陵豪杰墓,无花无酒锄作田。</p>
<hr/>
《桃花庵歌》<br/>
桃花坞里桃花庵,桃花庵里桃花仙;<br/>
桃花仙人种桃树,又摘桃花卖酒钱。<br/>
酒醒只在花前坐,酒醉还须花下眠;<br/>
半醒半醉日复日,花落花开年复年。<br/>
但愿老死花酒间,不愿鞠躬车马前;<br/>
车尘马足富者趣,酒盏花枝贫者缘。<br/>
若将富贵比贫贱,一在平地一在天;<br/>
若将贫贱比车马,他得驱驰我得闲。<br/>
别人笑我太疯癫,我笑他人看不穿;<br/>
不见五陵豪杰墓,无花无酒锄作田。<br/>
<h1>字体样式标签</h1>
粗体:<strong>ink</strong>
斜体:<em>ink</em>
<br/>
空 格:
<br/>
大于:>
<br/>
小于:<
<br/>
©版权符号ink
</body>
</html>
图像标签

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>图像标签学习</title>
</head>
<body>
<img src="../resources/image/1.jpg" alt="蝴蝶忍" title="悬停文字(蝴蝶忍)" width="1920" height="1080">
</body>
</html>
超链接标签

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>连接标签学习</title>
</head>
<body>
<a name="top"></a>
<a href="1.我的第一个网页.html" target="_blank">点击我跳转到页面一</a>
<a href="www.baidu.com">点击我跳转到百度</a>
<br/>
<a href="1.我的第一个网页.html">
<img src="../resources/image/1.jpg" alt="蝴蝶忍" title="悬停文字(蝴蝶忍)" width="1920" height="1080">
</a>
<a href="#top">回到顶部</a>
<a href="mainto:1035077875@qq.com">点击联系我</a>
</body>
</html>
行内元素和块元素
- 块元素
- 行内元素
- 内容撑开宽度,左右都是行内元素的可以排在一行
- (a、strong、em…)
列表
- 什么是列表
- 列表就是信息资源的一种展示形式,它可以使信息结构化和条理化,并以列表的样式显示出来,以便浏览者能更快捷地获得相应的信息
- 列表的分类
<!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>学科</dt>
<dd>Java</dd>
<dd>Python</dd>
<dd>运维</dd>
<dd>C/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 border="1px">
<tr>
<td colspan="4">1-1</td>
</tr>
<tr>
<td rowspan="2">2-1</td>
<td>2-2</td>
<td>2-3</td>
<td>2-4</td>
</tr>
<tr>
<td>3-1</td>
<td>3-2</td>
<td>3-3</td>
</tr>
</table>
</body>
</html>
视频和音频
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>媒体元素学习</title>
</head>
<body>
<video src="../resources/video/拳拳到肉.mp4"controls autoplay></video>
<audio src="../resources/audio/BenCaoGangMu.mp3" controls></audio>
</body>
</html>
页面结构分析

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>页面结构分析</title>
</head>
<body>
<head>
<h2>网页头部</h2>
</head>
<section>
<h2>网页主体</h2>
</section>
<footer>
<h2>网页脚部</h2>
</footer>
</body>
</html>
iframe内联框架

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<iframe src="https://www.baidu.com" name="百度" frameborder="0" width="1000px" height="800px"></iframe>
<a href="1.我的第一个网页.html" target="百度">点击跳转</a>
</body>
</html>
表单语法

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>登录注册</title>
</head>
<body>
<h1>注册</h1>
<form action="1.我的第一个网页.html" method="post">
<p>名字:<input type="text" name="username"></p>
<p>密码:<input type="password" name="password"></p>
<input type="submit">
<input type="reset">
</form>
</body>
</html>
表单元素格式

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>登录注册</title>
</head>
<body>
<h1>注册</h1>
<form action="1.我的第一个网页.html" method="post">
<p>名字:<input type="text" name="username" placeholder="请输入用户名" required></p>
<p>密码:<input type="password" name="password" placeholder="请输入密码" required></p>
<p>性别:
<input type="radio" value="boy" name="sex" required/>男
<input type="radio" value="girl" name="sex" required/>女
</p>
<p>爱好
<input type="checkbox" value="sleep" name="hobby">睡觉
<input type="checkbox" value="code" name="hobby">敲代码
<input type="checkbox" value="chat" name="hobby">聊天
<input type="checkbox" value="game" name="hobby">打游戏
</p>
<p>按钮
<input type="button" name="button1" value="点击变长">
<input type="image" src="../resources/image/1.jpg">
</p>
<p>下拉框
<select name="列表名称" >
<option value="china">中国</option>
<option value="us">美国</option>
<option value="eth">瑞士</option>
<option value="yingdu">印度</option>
</select>
</p>
<p>反馈:
<textarea name="textarea" cols="30" rows="10">文本内容</textarea>
</p>
<p>
<input type="file" name="files">
<input type="button" value="上传" name="upload">
</p>
<p>邮箱:
<input type="email" name="email">
</p>
<p>URL:
<input type="email" name="email">
</p>
<p>数字:
<input type="number" name="number" max="100" min="10" step="10">
</p>
<p>滑块:
<input type="range" min="0" max="100" step="2">
</p>
<p>搜索:
<input type="search" name="search">
</p>
<p>
<label for="mark">你点我试试</label>
<input type="text" id="mark">
</p>
<p>自定义邮箱:
<input type="text" name="diymail" pattern="/^([a-z0-9_\.-]+)@([\da-z\.-]+)\.([a-z\.]{2,6})$/
/^[a-z\d]+(\.[a-z\d]+)*@([\da-z](-[\da-z])?)+(\.{1,2}[a-z]+)+$/或\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*">
</p>
<input type="submit">
<input type="reset" value="清空表单">
</form>
</body>
</html>
表单的应用
- 隐藏域 hidden
- 只读 readonly
- 禁用 disabled
<p>
<label for="mark">你点我试试</label>
<input type="text" id="mark">
</p>
表单初级验证
- 思考?为什么要进行表单验证
- 常用方法
- 提示信息:placeholder
- 不能为空:required
- 正则表达式:pattern
<p>自定义邮箱:
<input type="text" name="diymail" pattern="/^([a-z0-9_\.-]+)@([\da-z\.-]+)\.([a-z\.]{2,6})$/
/^[a-z\d]+(\.[a-z\d]+)*@([\da-z](-[\da-z])?)+(\.{1,2}[a-z]+)+$/或\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*">
</p>