html
文章目录
尺寸单位
html 中只有一种单位: px
- px 是一个相对单位, 原因:相同屏幕,dpi 不同 px 代表的实际长度不同
Table 表格
<table>
- border="2" attribute 边界
- cellpadding="10" attribute 单元格内边距,单元格框线与内容间距
cellspacing="10" attribute 单元格外边距,单元格框线与框线间距
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>菜鸟教程(runoob.com)</title> </head> <body> <h4>没有单元格间距:</h4> <table border="1"> <tr> <td>First</td> <td>Row</td> </tr> <tr> <td>Second</td> <td>Row</td> </tr> </table> <h4>单元格间距="0":</h4> <table border="1" cellspacing="0"> <tr> <td>First</td> <td>Row</td> </tr> <tr> <td>Second</td> <td>Row</td> </tr> </table> <h4>单元格间距="10":</h4> <table border="1" cellspacing="10"> <tr> <td>First</td> <td>Row</td> </tr> <tr> <td>Second</td> <td>Row</td> </tr> </table> <h4>border="2", cellspacing="10":</h4> <table border="2" cellspacing="10"> <tr> <td>First</td> <td>Row</td> </tr> <tr> <td>Second</td> <td>Row</td> </tr> </table> </body> </html>
<caption>
<tr>行
<td> and <th> 单元格,标题
- colspan="2" attribute 跨列单元格
- rowspan="2" attribute 跨行单元格
List 列表
<ul> 无序列表
style="list-style-type:circle" attribute 无序列表前面的“符号形状”
- circle 空心圆,白圈
- disc 实心圆,碟子,黑圆点
- square 实心正方形,黑正方形
<ol> 有序列表
type="A" attribute
- "A"
- "a"
- "I"
- "i"
- 没有 type 属性,默认的,1,2,3 标记
<li> 列表条目 list item
<dl> 自定义列表 Defined List
- <dt> 列表条目 defined term
- <dd> 条目解释 defined definition
| |
区块 block
块级元素区块<div> and 内联元素区块<span>
- 没有特定意义,用于划分区块,便于编辑格式
内联元素
- 结尾不解释成换行
- eg:<span>, <b>, <a>, <img>, <td>, <th>
块级元素
- 块级元素在浏览器显示时,通常会以新行来开始(和结束)。
- eg: <div>, <h1>, <p>, <ul>, <table>
布局
- <div> and <table>
- <table>不建议作为布局工具
- css
- 网站模版,省力
form and input 表单与输入
<form> 表单
<input> 输入
- 内联元素,默认不换行
- type="text"
- name="car"
- value="audi"
文本域 text fields
- type="text" 属性
- name="lastname"
| |
密码字段
- type="password" 属性
- name="pwd"
| |
Radio Buttons 单选按钮(相当于单选题)
- type="radio" 属性
- name="sex" 单选,所以 name 都一样
- value="male"
| |
Check Boxes 复选框(相当于多选题)
- type="checkbox" 属性
- name="vehicle"
value="bike"
1 2 3 4<form> <input type="checkbox" name="vehicle" value="Bike">I have a bike<br> <input type="checkbox" name="vehicle" value="Car">I have a car </form>
Submit Button 提交按钮
- type="submit"
- value="Submit 提交" 显示按钮上的文字
| |
下拉选择框 Combo Boxes
<select> <—-> <input>
- action=""
<option>
- value="Audi car" 注意:value 不同,(单选,所以。。。)
- selected 属性,用于预选(预先选定选择内容)<—- <—-
| |
按钮 Buttons <— <input> 标签
简单普通按钮
| |
- type="button" 属性
- value="Press it,按呀!" 按钮显示的文字
Submit Button 提交按钮
- type="submit"
- value="Submit 提交" 显示按钮上的文字
| |
重置按钮 Reset Button
- type="reset"
- value="reset values"
- 点击后,表单输入内容,清空,恢复成默认值
| |
带边框的表单 Form with border
<fieldset> 设置边框
<legend> 设置边框上的文字
| |
<textarea> 文本域
- 大文本框,可以多行编辑
- rows="5" 文本域,行数
- cols="30" 文本域,列数
框架 <iframe>
- 相当于在网页内,再插入一个网页
Attributes
- src="www.baidu.com" 插入内容
- width="200"
- height="200"
- frameborder="0" 取消边框,默认 iframe 是有边框的
- 注意:插入的应当是,本地网页,在线的似乎不行
- –> 再注:我的错误,在线链接,应当把协议也写上,不然不能正常显示
- <ioframe>iframe 之间的内容</iframe>, 用于不支持 iframe 的浏览器,来显示
使用 iframe 来显示,目标链接页面
| |
Attributes
- name="iframe_a" <— <iframe> 标签
- target="iframe_a" <— <a> address 标签
Character Entities 字符实体
- 目的:通过特殊的格式,来显示 html 不能显示的特殊字符
格式:
1 2 3&entity_name; --> 实体名称 或 &#entity_number; --> 实体编号常用字符实体
不间断空格 Non-Breaking Space
- 实体名称: 
音标字符,用于国外字母上带一个符号的语言,如:西班牙语,等等
- 发音符号:字形(glyph)
表格
符号 中文名称 实体名称 实体编号 空格     < 小于号 < < > 大于号 > > & 和号 & & " 引号 " " ' 撇号 &apos (IE 不支持)' ¢ 分 ¢ ¢ £ 镑 £ £ ¥ 人民币/日元 ¥ ¥ € 欧元 &euro € § 小节 § § © 版权 © © ® 注册商标 ® ® ™ 商标 &trade ™ × 乘号 × × ÷ 除号 ÷ ÷
文章作者
上次更新 2024-01-05 (5c92d1c)