一、HTML的基本结构
<html>
<head> </head>//内含:<title><meta><link><style><script><base>等结构
<body></body>//内含:段落与文字、列表、表格、图像、超链接、表单、多媒体、框架等结构
</html>
二、文本标签
1、结构化标记
<h1>~<h6>标题、<p>段落、<br />换行符、<hr />水平线
<b>粗体、<i>斜体、<sup>上标、<sub>下标、<big>大字号标签、<small>小字号标签、特殊符号等
2、语义化标记
<strong>加粗、<em>强调、<blockquote>长引用、<q>短引用、<abbr>缩写字、<acronym>首字母缩写词
<cite>引用、<dfn>定义术语、<address>设计者联系详情、<ins>用来显示已经插入到文档中的内容(有下划线)
<del>带有删除线(已经应该删除的文本、词语)、<s>带有删除线(价格)、<u>下划线标签
三、列表
有序列表:<ol type="a">、<li> //type属性:1,a,A,i,I
无序列表:<ul>、<li> //type属性:disc、circle、square
定义列表:<dl>、<dt>术语、<dd>定义
应用:可嵌套列表
四、链接
常用:<a href="目标地址">text</a> //目标地址可为url(不同网站)、html文件(同一网站内部)
Email链接:<a href="mailto:hahaha@163.com">text</a>
target属性:target="_black" // 作用:在新窗口打开链接
链接到页面某个位置:href="#top"
五、图像
<img src="images/quokka.jpg" alt="A family of quokka" width="600" height="450">
src:图像路径;alt:对图像的文本说明;title:图像的附加信息;width、height:图像的宽度和高度
旧代码中:align:left图像置左;right:图像置右;top\middle\bottom:将图像与它周围文本的对齐方式
图像格式:JPEG、GIF动画、PNG
HTML5中的图像:<figure>图像标签、<figcaption>图像说明
exp:<figure><img src="*.jpg" ><figcaption>说明</figcaption></figure>
六、表格
1、表格
<table>
<caption>表格标题</caption>
<tr><th>标题1</th><th>标题2</th></tr>
<tr><td>内容1</td><td>内容2</td></tr>
</table>
跨列:<td colspan="2" rowspan="2">内容1</td>
2、长表格
<table>
<thead>
<tr>
<th>列标题</th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<th>行标题</th>
<td></td>
</tr>
</tbody>
<tfoot>
<tr>
<td></td>
<td></td>
</tr>
</tfoot>
</table>
宽度和间隔:<table width="400px" cellpadding="10" cellspacing="5" ></table>
边框和背景:<table border="2" bgcolor="#efefef" ></table>
七、表单
1、表单的结构
<form action="URL" method="get/post"></form>
action属性:服务器上一个页面的URL。method:表单的提交方法。
常用控件:
单行文本框:
<input type="text" name="username" size="15" maxlength="30"/>
size在旧表单中使用,用于制定文本宽度(可见字符数量)、maxlength限制用户在文本区域输入字符的数量
密码框:
<input type="password" name="password" size="15" maxlength="30">
文本域:
<textarea name="comments" cols="20" rows="4"></textarea>
cols用于指定文本域有多宽,rows指定文本域在纵向上占据的行数
单选按钮:
<input type="radio" name="genre" value="rock" checked="checked"/>
复选框:
<input type="checkbox" name="service" value="itunes" checked="checked" />
下拉列表:
<select name="devices">
<option value="ipad">ipad</option>
<option value="radio">radio</option>
</select>
下拉列表也有selected选项
多选框:
<select name="instruments" size="3" multiple="multiple">
<option value="guitar" selected="selected">Guitar</option>
<option value="drums">Drums</option>
</select>
multiple可允许用户从列表中方选择多个选项
文件上传域:
<input type="file" name="user-song" />
<input type="submit" value="Upload" />
表单按钮:
<input type="button" value="普通按钮的取值" onclick="JavaScript脚本程序"/>
提交按钮:
<input type="submit" name="subscribe" value="Subscribe"/>
图像作为提交按钮:
<input type="image" src="images/subscribe.jpg" width="100" height="20">
按钮:
<button><img src="" alt="" width="" height=""/></button>//可以将图像作为按钮
隐藏控件:
<input type="hidden" name="bookmark" value="lyrics"/>
标签表单控件:
<label>Age:<input type="text" name="age" /></label><br/>
Gender:<input id="female" type="radio" name="gender" value="f">
<label for="female">Female</label>
<label id="male" type="radio" name="gender" value="m">
<label for="male">Male</label>
for属性用来说明标签控件用来标注的是哪个表单控件
组合表单元素:
<fieldset>
<legend></legend>
<label></label>
</fieldset>
HTML5表单验证:required属性值
<input type="text" name="username" required="required"/>
HTML5日期控件:type="date"
<input type="date" name="depart"/>
HTML5电子邮件和URL控件:type="email",type="url"
<input type="url" name="website"/>
<input type="email" name="email">
HTML5搜索输入控件:type="search",placeholder
<input type="search" name="search" placeholder="Enter keyword"/>
其他标记:<div><span>
内联框架:
<iframe width="450" height="350" src=""></iframe>
html4:scrolling、frameborder
html5:seamless应用在不需要滚动条的地方
页面信息
<meta name="description/keywords/robots" content="a text words">
<meta http-equiv="author/robots/pragma/expries" content="Fri,04 Apr...">
description:页面描述信息,keywords:关键词,robots:是否将页面加入搜索引擎的搜索结果
author:定义网页设计者,pragma:防止浏览器对页面的缓存,expries:制定页面过期时间
八、Flash、视频和音频
1、音频:
<embed src="media/青花瓷.mp3" width="400px" height="80px"/>
2、视频:
<embed src="media/小苹果.wmv" width="400px" height="80px"/>
3、flash动画:
<embed src="App_images/lesson/hj/helloworld.swf"/>
九、浮动框架iframe
<iframe src="浮动框架的源文件" width="浮动框架的宽" height="浮动框架的高"></iframe>