현재 XHTML 1.0 Transitional 로 웹페이지를 만들고 있습니다.
그런데 일부 태그에 name 속성을 붙이면 w3c.org 의 검사를 통과하지 못합니다.
(div , ul 등)
해당 태그에서 name 속성을 없애면 통과합니다.
원래 name 속성은 아무 태그에나 붙일 수 있는 것 아니었나요???
name attribute 에 대하여
-
- 서포터즈
- Posts: 101
- Joined: 2004 09 02 06:46 01
- Contact:
Re: name attribute 에 대하여
잘 모르지만, 다른분들이 답을 안달기에 달아봅니다.초보 wrote:현재 XHTML 1.0 Transitional 로 웹페이지를 만들고 있습니다.
그런데 일부 태그에 name 속성을 붙이면 w3c.org 의 검사를 통과하지 못합니다.
(div , ul 등)
해당 태그에서 name 속성을 없애면 통과합니다.
원래 name 속성은 아무 태그에나 붙일 수 있는 것 아니었나요???
name 말고 id 로 쓰셔야 하고요. 정히 name 도 필요한 경우라면 둘 다 쓰시면 될 것 같습니다.
4.10. The elements with 'id' and 'name' attributes
HTML 4 defined the name attribute for the elements a, applet, form, frame, iframe, img, and map. HTML 4 also introduced the id attribute. Both of these attributes are designed to be used as fragment identifiers.
In XML, fragment identifiers are of type ID, and there can only be a single attribute of type ID per element. Therefore, in XHTML 1.0 the id attribute is defined to be of type ID. In order to ensure that XHTML 1.0 documents are well-structured XML documents, XHTML 1.0 documents MUST use the id attribute when defining fragment identifiers on the elements listed above. See the HTML Compatibility Guidelines for information on ensuring such anchors are backward compatible when serving XHTML documents as media type text/html.
Note that in XHTML 1.0, the name attribute of these elements is formally deprecated, and will be removed in a subsequent version of XHTML.
C.8. Fragment Identifiers
In XML, URI-references [RFC2396] that end with fragment identifiers of the form "#foo" do not refer to elements with an attribute name="foo"; rather, they refer to elements with an attribute defined to be of type ID, e.g., the id attribute in HTML 4. Many existing HTML clients don't support the use of ID-type attributes in this way, so identical values may be supplied for both of these attributes to ensure maximum forward and backward compatibility (e.g., <a id="foo" name="foo">...</a>).
Further, since the set of legal values for attributes of type ID is much smaller than for those of type CDATA, the type of the name attribute has been changed to NMTOKEN. This attribute is constrained such that it can only have the same values as type ID, or as the Name production in XML 1.0 Section 2.3, production 5. Unfortunately, this constraint cannot be expressed in the XHTML 1.0 DTDs. Because of this change, care must be taken when converting existing HTML documents. The values of these attributes must be unique within the document, valid, and any references to these fragment identifiers (both internal and external) must be updated should the values be changed during conversion.
Note that the collection of legal values in XML 1.0 Section 2.3, production 5 is much larger than that permitted to be used in the ID and NAME types defined in HTML 4. When defining fragment identifiers to be backward-compatible, only strings matching the pattern [A-Za-z][A-Za-z0-9:_.-]* should be used. See Section 6.2 of [HTML4] for more information.
Finally, note that XHTML 1.0 has deprecated the name attribute of the a, applet, form, frame, iframe, img, and map elements, and it will be removed from XHTML in subsequent versions.
Who is online
Users browsing this forum: No registered users and 3 guests