<!DOCTYPE html> <html lang="en"> # 设置为中文:lang="zh-CN" <head> <meta charset="UTF-8"> <title>Title</title> </head> <body> </body> </heml>
属性
<!--2秒后跳转到对应的网址,注意引号--> <meta http-equiv="refresh" content="2;URL=https://www.oldboyedu.com"> <!--指定文档的编码类型--> <meta http-equiv="content-Type" charset=UTF8"> <!--告诉IE以最高级模式渲染文档--> <meta http-equiv="x-ua-compatible" content="IE=edge">
<meta name="keywords" content=""> name属性:主要用于描述网页 设置关键字keyword 帮助查询
<meta name="description" content=""
<b>加粗</b> <i>斜体</i> <u>下划线</u> <s>删除</s> <p>段落标签</p> <h1>标题1</h1> <h2>标题2</h2> <h3>标题3</h3> <h4>标题4</h4> <h5>标题5</h5> <h6>标题6</h6> <!--换行--> <br> <!--水平线--><hr>
特殊字符
内容 | 对应代码 |
---|---|
空格 | |
> | > |
< | < |
& | & |
¥ | ¥ |
版权 | © |
注册 | ® |
div标签和span标签
div标签用来定义一个块级元素,并无实际的意义。
span标签用来定义内联(行内)元素,并无实际的意义。
块级元素与行内元素的区别:
所谓块元素,是以另起一行开始渲染的元素,行内元素则不需另起一行。如果单独在网页中插入这两个元素,不会对页面产生任何的影响。
这两个元素是专门为定义CSS样式而生的。
注意:
块级元素可以包含内联元素或某些块级元素,但内联元素不能包含块级元素,它只能包含其它内联元素。
p标签不能包含块级标签,p标签也不能包含p标签。
img标签
<img src="图片的路径" alt="图片未加载成功时的提示" title="鼠标悬浮时提示信息" width="宽" height="高(宽高两个属性只用一个会自动等比缩放)">
a标签
<a href="http://www.sogo.com" target="_blank" >SOGO</a>
href属性指定目标网页地址。
target:
列表
1.无序列表
<ul type="None"> <li>aaa</li> <li>bbb</li> <li>ccc</li> </ul>
type属性:
2.有序列表
<ol type="1" start="2"> <li>aaa<li> <li>bbb<li> <li>ccc<li> </ol> type属性: 1:数字列表,默认值 A:大写字母 a:小写字母 I:大写罗马 i:小写罗马
3.标题列表
<dl> <dt>标题1</dt> <dd>内容</dd> <dt>标题2</dt> <dd>内容</dd> <dd>内容</dd> </dl>
<table> <thread> # 规定表格的列 <tr> <th>序号</th> <th>姓名</th> <th>爱好</th> <tr> <thread> <tbody> <tr> <td>1</td> <td>小明</td> <td>打球</td> <tr> </tbody> </table>
属性:
border、cellpadding、cellspacing 设置在 <table ...> 里
rowspan、colspan 设置在 <td ...> 里
功能:
表单用于向服务器传输数据,从而实现用户与Web服务器的交互
表单能够包含input系列标签,比如文本字段、复选框、单选框、提交按钮等等。
表单还可以包含textarea、select、fieldset和 label标签。
表单属性:
input标签
type属性值 | 表现形式 | 对应代码 |
---|---|---|
text | 单行输入文本 | <input type=text" /> |
password | 密码输入框 | <input type="password" /> |
date | 日期输入框 | <input type="date" /> |
checkbox | 复选框 | <input type="checkbox" checked="checked" /> |
radio | 单选框 | <input type="radio" /> |
submit | 提交按钮 | <input type="submit" value="提交" /> |
reset | 重置按钮 | <input type="reset" value="重置" /> |
button | 普通按钮 | <input type="button" value="普通按钮" /> |
hidden | 隐藏输入框 | <input type="hidden" /> |
file | 文本选择框 | <input type="file" /> |
属性说明:
select标签
<select name="form1" id="s1"> <option value="bj">北京</option> <option value="sh">上海</option> <option value="sc">四川</option> </select> <select name="form2" id="s2"> <optgroup label="北京"> <option value="cp">昌平</option> <option value="cy">朝阳</option> </optgroup> <optgroup label="上海"> <option value="pd">浦东</option> <option value="mh">闵行</option> </optgroup> <optgroup label="四川"> <option value="pzh">攀枝花</option> <option value="zg">自贡</option> </optgroup> </select>
属性说明:
label标签
定义:<label> 标签为 input 元素定义标注(标记)。
说明:
<label for="r1">男</label> <input id="r1" name="gender" type="radio" value="1"> <label>男 # 写法2 <input name="gender" type="radio" value="1"> </label> <label for="r2"> 女</label> <input id="r2" name="gender" type="radio" value="0"> <label for="r3">保密</label> <input id="r3" checked name="gender" type="radio" value="2">
textarea多行文本
<textarea name="memo" id="memo" cols="30" rows="10">内容</textarea>
属性说明:
原文:https://www.cnblogs.com/Chen-char/p/10668665.html