问题描述
对于<form>
,我们可以使用<form name="name">
之类的名称.
For the <form>
we can give name like <form name="name">
.
我们可以用同样的方式将其提供给<table name="table1">
In the same way can we give it to <table name="table1">
推荐答案
name
在HTML5中不是<table>
的允许属性.根据详细说明:
name
is not an allowed attribute of <table>
in HTML5. From the fine specification:
全局属性& 边界
如果您查看全局属性,您将找不到在列表中.
And if you look at the global attributes you won't find name
in the list.
因此,您不能在<table>
上放置name
属性,并且仍然具有有效的HTML. id
是全局属性,因此您可以使用而不是name
(当然,如果您的名字在页面中将是唯一的).
So you can't put a name
attribute on a <table>
and still have valid HTML. id
however is a global attribute so you can use that instead of name
(if of course your name is going to be unique within the page).
尝试运行此:
<!DOCTYPE html>
<head><title>t</title></head>
<body>
<table name="pancakes"></table>
</body>
通过 http://validator.w3.org ,您会发现它不喜欢<table>
.
through http://validator.w3.org and you'll see that it doesn't like a name
on <table>
.
如果您仍在编写HTML4,则仍不能在<table>
上放置name
属性.根据精细规范:
If you're still writing HTML4, you still can't put a name
attribute on a <table>
. From the fine specification:
<!ATTLIST TABLE -- table element --
%attrs; -- %coreattrs, %i18n, %events --
summary %Text; #IMPLIED -- purpose/structure for speech output--
width %Length; #IMPLIED -- table width --
border %Pixels; #IMPLIED -- controls frame width around table --
frame %TFrame; #IMPLIED -- which parts of frame to render --
rules %TRules; #IMPLIED -- rulings between rows and cols --
cellspacing %Length; #IMPLIED -- spacing between cells --
cellpadding %Length; #IMPLIED -- spacing within cells --
>
该列表中没有name
,在 coreattrs
,i18n
中也没有名称或events
.
There's no name
in that list and no name in coreattrs
, i18n
, or events
either.
这篇关于我们可以给html< table>命名吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!