custom element | custom object
[This documentation is preliminary and is subject to change.]
Represents a user-defined element.
Standards information
There are no standards that apply here.
HTML information
| Closing Tag | required |
|---|---|
| CSS Display | inline |
Remarks
To declare a namespace, use the XMLNS attribute of the HTML element.
When defining custom tags, you must enclose custom tag definitions within an @media wrapper.
Custom tags become much more interesting when applied with a Dynamic HTML (DHTML) behavior. Dynamic HTML (DHTML) behaviors (or behaviors) and styles are applied to elements on a page the same way—using Cascading Style Sheets (CSS) attributes. More specifically, the proposed CSS behavior attribute enables a document author to specify the location of the behavior and apply that behavior to an element.
The Windows Internet Explorer support for custom tags on an HTML page requires that a namespace be defined for the tag. Otherwise, the custom tag is treated as an unknown tag when the document is parsed. Although navigating to a page with an unknown tag in Internet Explorer does not result in an error, unknown tags have the disadvantage of not being able to contain other tags, nor can they have behaviors applied to them.
This element is available in HTML and script as of Microsoft Internet Explorer 5.
Examples
This example uses the custom element to create custom RED, GREEN, and BLUE elements. These elements change the color of the text to red, green, or blue, depending on whether it is surrounded by RED, GREEN, or BLUE tags. In this example, the RED, GREEN, and BLUE tags are defined within a namespace called CUSTOMTAG.
Code example: http://samples.msdn.microsoft.com/workshop/samples/author/dhtml/refs/custom.htm
<HTML XMLNS:CUSTOMTAG>
<HEAD>
<STYLE>
@media all {
CUSTOMTAG\:RED { color: red; }
CUSTOMTAG\:GREEN { color: green; }
CUSTOMTAG\:BLUE { color: blue; }
}
</STYLE>
</HEAD>
<BODY>
<CUSTOMTAG:RED>
This text is red because it is enclosed within opening
and closing CUSTOMTAG:RED tags.
</CUSTOMTAG:RED>
<CUSTOMTAG:GREEN>
This text is green because it is enclosed within opening
and closing CUSTOMTAG:GREEN tags.
</CUSTOMTAG:GREEN>
<CUSTOMTAG:BLUE>
This text is blue because it is enclosed within opening
and closing CUSTOMTAG:BLUE tags.
</CUSTOMTAG:BLUE>
</BODY>
</HTML>
See also
- Using Custom Tags in Internet Explorer
Build date: 3/8/2012
N.B. The namespace (eg. CUSTOMTAG) is part-of the tagName: eg. <CUSTOMTAG:RED>... neg. <RED>... n'even enclosed <CUSTOMTAG><RED><BLUE><GREEN><RED>... does-not-work.
(Furthermore, W3C namespace is not-fully supported in MSIE.)
-----------------
SUGGESTION:/
We might-like namespace fully separable:--
eg. (advanced suggestive)
<HTML:B> and <HTML><B>...
<MINE:B> and <MINE><B>... ie. in-namespace-MINE <B>... (user-local/temporary B)
<P:B> and <HTML><P><B>... being the generalized notion of conditioned-elements.
<P.CLASSNAME> and <P CLASS=CLASSNAME>... comparable ibid, better HTML-notation.
/:SUGGESTION
(PS. This posting-mechanism is compressing paragraphs to unspaced-lines....)
- 9/7/2008
- Mr. Raymond Kenneth Petry
- 4/19/2009
- Stanley Roark