HTML链接标签、列表、表格标签

链接标签

  1. <a> 链接

超链接,从一个页面链接到另一个页面,href属性必须使用,创建指向另一个文档的链接,在浏览器中,链接的默认外观如:

  • 未被访问的链接带有下划线且是蓝色字体

  • 已被访问的链接带有下划线且是紫色字体

  • 活动链接(鼠标点击不放时)带有下划线且时红色字体

默认在当前浏览器窗口显示被链接的页面

<a href="http://www.w3cschool.cn">访问W3Cschool在线教程!</a>

属性

描述

charset

char_encoding

HTML5 不支持。规定目标URL 的字符编码。

coords

coordinates

HTML5 不支持。规定链接的坐标。

downloadNew

filename

指定下载链接

href

URL

规定链接的目标URL。

hreflang

language_code

规定目标URL 的基准语言。仅在 href 属性存在时使用。

mediaNew

media_query

规定目标URL 的媒介类型。默认值:all。仅在 href 属性存在时使用。

name

section_name

HTML5 不支持。规定锚的名称。

rel

alternate

author

bookmark

help

license

next

nofollow

noreferrer

prefetch

prev

search

tag

规定当前文档与目标URL 之间的关系。仅在 href 属性存在时使用。

rev

text

HTML5 不支持。规定目标URL 与当前文档之间的关系。

shape

default

rect

circle

poly

HTML5 不支持。规定链接的形状。

target

_blank

_parent

_self

_top

framename

规定在何处打开目标URL。仅在 href 属性存在时使用。

typeNew

MIME_type

规定目标URL 的 MIME 类型。仅在 href 属性存在时使用。

注:MIME = Multipurpose Internet Mail Extensions。

  1. <link> 外部资源

经常用于链接CSS样式表,定义与外部资源的关系。本元素只能防砸head标签内

<head>
<link rel="stylesheet" type="text/css" href="styles.css">
</head>

属性

描述

charset

char_encoding

HTML5 不支持该属性。 定义被链接文档的字符编码方式。

href

URL

定义被链接文档的位置。

hreflang

language_code

定义被链接文档中文本的语言。

media

media_query

规定被链接文档将显示在什么设备上。

rel

alternate

archives

author

bookmark

external

first

help

icon

last

license

next

nofollow

noreferrer

pingback

prefetch

prev

search

sidebar

stylesheet

tag

up

必需。定义当前文档与被链接文档之间的关系。

rev

reversed relationship

HTML5 不支持该属性。 定义被链接文档与当前文档之间的关系。

sizesNew

HeightxWidth

any

定义了链接属性大小,只对属性rel="icon" 起作用。

target

_blank

_self

_top

_parent

frame_name

HTML5 不支持该属性。 定义在何处加载被链接文档。

type

MIME_type

规定被链接文档的MIME 类型。

  1. <nav> 导航链接 new

表示一个页面中的某个部分,目的是提供导航链接。

<nav>
  <a href="/html/">HTML</a> |
  <a href="/css/">CSS</a> |
  <a href="/javascript/">JavaScript</a> |
  <a href="/jquery/">jQuery</a>
</nav>

列表标签

  1. <ul> 无序列表

HTML页面中的无序列表,与<li>标签一起使用

<ul>
<li>咖啡</li>
<li>茶</li>
<li>牛奶</li>
</ul>  

属性

描述

compact

compact

HTML5 不支持。HTML 4.01 已废弃。 规定列表呈现的效果比正常情况更小巧。

type

disc 实心圆(默认)

square 方块

circle 圈

HTML5 不支持。HTML 4.01 已废弃。 规定列表的项目符号的类型。

  1. <ol> 有序列表

ordered lists 有序列表

<ol>
 <li>咖啡</li>
 <li>茶</li>
 <li>牛奶</li>
</ol>

<ol start="10">
 <li>咖啡</li>
 <li>茶</li>
 <li>牛奶</li>
</ol>

属性

描述

compact

compact

HTML5中不支持,不赞成使用。请使用样式取代它。规定列表呈现的效果比正常情况更小巧。

reversedNew

reversed

指定列表倒序(9,8,7...)

start

number

HTML5不支持,不赞成使用。请使用样式取代它。规定列表中的起始点。如列表2

type

1 罗马数字

A 大写字母

a 小写字母

I 大写希腊数字

i 小写希腊数字

规定列表的类型。不赞成使用。请使用样式代替。

  1. <li> 列表项

本标签可以用在<ol><ul><menu>中。

属性

描述

type

1

A

a

I

i

disc

square

circle

HTML5 不支持该属性。HTML 4.01 已废弃该属性。 不赞成使用。请使用样式取代它。规定使用哪种项目符号。

value

number

不赞成使用。请使用样式取代它。规定列表项目的数字。

  1. <dir> 目录列表 HTML5

表示一个目录(文件名的集合),在HTML5中已禁用

<dir>
 <li>html</li>
 <li>xhtml</li>
 <li>css</li>
</dir>

属性

描述

compact

compact

HTML5 不支持。HTML 4.01 已废弃。规定列表必须比常规状态小一号呈现。

  1. <dl> 定义列表

代表一个描述标签,标签的常用用途是实现词汇表或者键值对列表,需要与<dt>和<dd>一起使用。

<dl>
 <dt>Coffee</dt>
   <dd>Black hot drink</dd>
 <dt>Milk</dt>
   <dd>White cold drink</dd>
</dl> 
  1. <dt> 定义列表的项目

只能作为<dl>标签的一个子元素出现,后面跟着<dd>标签。一行中的多个<dt>标签表示紧邻的下一个<dd>元素定义的多个术语。

<dl>
 <dt>Coffee</dt>
   <dd>Black hot drink</dd>
 <dt>Milk</dt>
   <dd>White cold drink</dd>
</dl>
  1. <dd> 定义列表项目的描述

在标签内,可以放置段落、换行、图片、链接、列表等

  1. <menu> 菜单列表

定义菜单列表,显示效果个无序列表相同,<menu>标签通常用于文本菜单、工具条和命令列表选项。

<menu type="toolbar">
<li> 
    <menu label="File"> 
    <button type="button" onclick="file_new()">New...</button> 
    <button type="button" onclick="file_open()">Open...</button> 
    <button type="button" onclick="file_save()">Save</button> 
    </menu>
</li>
<li> 
   <menu label="Edit"> 
   <button type="button" onclick="edit_cut()">Cut</button> 
   <button type="button" onclick="edit_copy()">Copy</button> 
   <button type="button" onclick="edit_paste()">Paste</button> 
   </menu>
</li>
</menu>

属性

描述

labelNew

text

描述菜单项的标记。

typeNew

context

toolbar

list

描述显示菜单类型. 默认为 "list"。

  1. <command> 用户可能调用的命令 new

定义HTML的命令按钮,在<menu>标签内使用时command元素将作为菜单或者工具栏的一部分显示出来

<menu>
<command type="command" label="Save" onclick="save()">Save</command>
</menu>

属性

描述

checkedNew

checked

规定当页面加载时,command 是否被选中。仅用于 radio 或 checkbox 类型。

disabledNew

disabled

规定command 是否可用。

iconNew

URL

规定作为command 来显示的图像的 URL。

labelNew

text

必需。规定command 的名字,对用户可见。

radiogroupNew

groupname

规定可进行切换且将被切换的command 所属的组名。仅在类型为 radio 时使用。

typeNew

checkbox

command

radio

定义command 的类型。默认是 "command"。

表格标签

  1. <table> 表格

定义HTML表格,一个表格包括table元素,一个或多个tr、th、td元素。

<table border="1">
<tr>
<th>Month</th>
<th>Savings</th>
</tr>
<tr>
<td>January</td>
<td>$100</td>
</tr>
</table>

属性

描述

align

left

center

right

HTML5 不支持。HTML 4.01 已废弃。 规定表格相对周围元素的对齐方式。

bgcolor

rgb(x,x,x)

#xxxxxx

colorname

HTML5 不支持。HTML 4.01 已废弃。 规定表格的背景颜色。

border

1

""

规定表格单元是否拥有边框。

cellpadding

pixels

HTML5 不支持。规定单元边沿与其内容之间的空白。

cellspacing

pixels

HTML5 不支持。规定单元格之间的空白。

frame

void

above

below

hsides

lhs

rhs

vsides

box

border

HTML5 不支持。规定外侧边框的哪个部分是可见的。

rules

none

groups

rows

cols

all

HTML5 不支持。规定内侧边框的哪个部分是可见的。

summary

text

HTML5 不支持。规定表格的摘要。

width

pixels

%

HTML5 不支持。规定表格的宽度。

  1. <caption> 表格标题

表示HTML表格的标题,并且需要放置在table元素之前或之后,每一个表格是能有一个标题,默认显示在表格上续重显示。

<table border="1">
  <caption>Monthly savings</caption>
  <tr>
    <th>Month</th>
    <th>Savings</th>
  </tr>
  <tr>
    <td>January</td>
    <td>$100</td>
  </tr>
</table>

属性

描述

align

left

right

top

bottom

HTML5 不支持。HTML 4.01 已废弃。 定义标题的对齐方式。

  1. <th> 表头单元格

HTMLM表格的表头部分,标签中的内容会以粗体显示并居中

<table border="1">
<tr>
<th>Month</th>
<th>Savings</th>
</tr>
<tr>
<td>January</td>
<td>$100</td>
</tr>
</table>

属性

描述

abbr

text

HTML5 不支持。 规定表头单元格中内容的缩写版本。

align

left

right

center

justify

char

HTML5 不支持。 规定表头单元格内容的水平对齐方式。

axis

category_name

HTML5 不支持。 对表头单元格进行分类。

bgcolor

rgb(x,x,x)

#xxxxxx

colorname

HTML5 不支持。HTML 4.01 已废弃。 规定表头单元格的背景颜色。

char

character

HTML5 不支持。 规定根据哪个字符来进行内容的对齐。

charoff

number

HTML5 不支持。 规定对齐字符的偏移量。

colspan

number

规定表头单元格可横跨的列数。

headers

header_id

规定与表头单元格相关联的一个或多个表头单元格。

height

pixels

%

HTML5 不支持。HTML 4.01 已废弃。 规定表头单元格的高度。

nowrap

nowrap

HTML5 不支持。HTML 4.01 已废弃。 规定表头单元格中的内容是否折行。

rowspan

number

规定表头单元格可横跨的行数。

scope

col

colgroup

row

rowgroup

规定表头单元格是否是行、列、行组或列组的头部。

valign

top

middle

bottom

baseline

HTML5 不支持。 规定表头单元格内容的垂直排列方式。

width

pixels

%

HTML5 不支持。HTML 4.01 已废弃。 规定表头单元格的宽度。

  1. <tr> 行

定义HTML表格中的一行单元格,一个tr元素包含一个或多个th或td元素

<table border="1">
<tr>
<th>Month</th>
<th>Savings</th>
</tr>
<tr>
<td>January</td>
<td>$100</td>
</tr>
</table>

属性

描述

align

right

left

center

justify

char

HTML5 不支持。定义表格行的内容对齐方式。

bgcolor

rgb(x,x,x)

#xxxxxx

colorname

HTML5 不支持。HTML 4.01 已废弃。规定表格行的背景颜色。

char

character

HTML5 不支持。规定根据哪个字符来进行文本对齐。

charoff

number

HTML5 不支持。规定第一个对齐字符的偏移量。

valign

top

middle

bottom

baseline

HTML5 不支持。规定表格行中内容的垂直对齐方式。

  1. <td> 单元格

表示HTML表格的单元格,标签内的内容通常显示为左对齐文本。属性见<th>标签属性

<table border="1">
<tr>
<td>Cell A</td>
<td>Cell B</td>
</tr>
</table>
  1. <thead> 表格表头内容

定义一组HTLM表格的头部,元素内部必须包含一个或多个<tr>标签

<table border="1">
<thead>
<tr>
<th>Month</th>
<th>Savings</th>
</tr>
</thead>
<tfoot>
<tr>
<td>Sum</td>
<td>$180</td>
</tr>
</tfoot>
<tbody>
<tr>
<td>January</td>
<td>$100</td>
</tr>
<tr>
<td>February</td>
<td>$80</td>
</tr>
</tbody>
</table>

属性

描述

align

right

left

center

justify

char

HTML5 不支持。定义<thead> 元素中内容的对齐方式。

char

character

HTML5 不支持。规定<thead> 元素中内容根据哪个字符来对进行文本对齐。

charoff

number

HTML5 不支持。规定<thead> 元素中内容的第一个对齐字符的偏移量。

valign

top

middle

bottom

baseline

HTML5 不支持。规定<thead> 元素中内容的垂直对齐方式。

  1. <tbody> 表格主体内容

用于组合HTML表格的主体内容,属性见<thead>标签

<table border="1">
<thead>
<tr>
<th>Month</th>
<th>Savings</th>
</tr>
</thead>
<tfoot>
<tr>
<td>Sum</td>
<td>$180</td>
</tr>
</tfoot>
<tbody>
<tr>
<td>January</td>
<td>$100</td>
</tr>
<tr>
<td>February</td>
<td>$80</td>
</tr>
</tbody>
</table>
  1. <tfoot> 表格表注(脚注)内容

表示HTML表格的页脚,用于组合HTML表格中的表注内容

<table border="1">
<thead>
<tr>
<th>Month</th>
<th>Savings</th>
</tr>
</thead>
<tfoot>
<tr>
<td>Sum</td>
<td>$180</td>
</tr>
</tfoot>
<tbody>
<tr>
<td>January</td>
<td>$100</td>
</tr>
<tr>
<td>February</td>
<td>$80</td>
</tr>
</tbody>
</table>
  1. <col> 一个或多个列的属性值

用于为表格中的一列或多列设置属性值,只能在<table>标签和<colgroup>标签内部使用。可以为整个列应用样式

<table border="1">
  <colgroup>
    <col span="2" style="background-color:red">
    <col style="background-color:yellow">
  </colgroup>
  <tr>
    <th>ISBN</th>
    <th>Title</th>
    <th>Price</th>
  </tr>
  <tr>
    <td>3476896</td>
    <td>My first HTML</td>
    <td>$53</td>
  </tr>
</table>

属性

描述

align

left

right

center

justify

char

HTML5 不支持。规定与<col> 元素相关的内容的水平对齐方式。

char

character

HTML5 不支持。规定根据哪个字符来对齐与<col> 元素相关的内容。

charoff

number

HTML5 不支持。规定第一个对齐字符的偏移量。

span

number

规定<col> 元素应该横跨的列数。

valign

top

middle

bottom

baseline

HTML5 不支持。规定与<col> 元素相关的内容的垂直对齐方式。

width

%

pixels

relative_length

HTML5 不支持。Specifies the width of a <col> element

  1. <colgroup> 供格式化的列组

用于表示HTML的表格列组,定义表中的一组列表,只能用在<table>元素之内,在任何一个<thead>、<tbody>、<tfoot>、<tr>元素前使用

<table border="1">
  <colgroup>
    <col span="2" style="background-color:red">
    <col style="background-color:yellow">
  </colgroup>
  <tr>
    <th>ISBN</th>
    <th>Title</th>
    <th>Price</th>
  </tr>
  <tr>
    <td>3476896</td>
    <td>My first HTML</td>
    <td>$53</td>
  </tr>
</table>

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值