Template:Tag
<tag>...</tag>
Page Module:Documentation/styles.css has no content.
Script error: No such module "about".
Script error: No such module "High-use".
A markup tag is an open angle bracket Template:Char and a close angle bracket Template:Char and the content within them, in a markup language such as XML, HTML, or wikitext (which supports some HTML). For example:
- The
<title>tag provides a title for the Web page.
This template provides a quick way to mention a markup-style tag in a preformatted way. It is mainly used in discussion/help pages.
Syntax
Script error: No such module "Template link general".
(square brackets = optional)
Parameters
Script error: No such module "Labelled list hatnote".
|1=Page Template:Nobold/styles.css has no content. (tagname above) (required)- The XML/HTML tag's name (e.g. Template:Input, Template:Input). Use special value Template:Input for an HTML comment.
|2=Page Template:Nobold/styles.css has no content. (type above)- To indicate which of the tag's types is/are presented:
- Template:Input (Template:Input) (default)
- A matching pair of open/start and close/end tags (e.g.
<div>...</div>).To suppress the ellipsis ("...") between the tags, add an empty|content=parameter (e.g.<div></div>). - Template:Input (Template:Input)
- An open/start tag (e.g.
<span>). - Template:Input (Template:Input)
- A close/end tag (e.g.
</span>). - Template:Input (Template:Input) or Template:Input (Template:Input) or Template:Input (Template:Input)
- An empty element, formed with a single self-terminating tag (e.g.
<hr />); in HTML5 these are now known as "void" elements, though "empty" is the more common term.
|content=- Text to place between open/start and close/end tags.
|attribs=or|params=- Attributes and values to be included as part of an open/start tag.
|wrap=yes- Disable nowrap for long samples, so allowing wraps (line breaks).
|link=yes- Link to the element's entry in the HTML element article. This is only for HTML elements; the page for the link is hard-coded.
|style=- Replace the default CSS style. Use special value
|style=plainas a shortcut forborder:none; background:transparent.
Examples
Page Template:Markup/styles.css has no content.
| Markup | Renders as |
|---|---|
{{tag|ref}} |
|
{{tag|ref|content=}} |
|
{{tag|ref|content=hello}} |
|
{{tag|span|content=foo}} |
|
{{tag|span|open}} |
|
{{tag|span|open|content=hello}} |
|
{{tag|span|close|content=hello}} |
|
{{tag|span|pair|content=hello}} |
|
{{tag|ref|open|attribs=group="note"}} |
|
{{tag|references|single}} |
|
{{tag|br|single}} |
|
{{tag|!--|content=comment}} |
|
{{tag|math|attribs=chem}} |
|
{{tag|a
|attribs=href="<nowiki>https://en.wikipedia.org/</nowiki>"
|content=English Wikipedia
|wrap=yes}} |
|
{{Tag|del|link=y}} |
|
{{tag|div|style=background: cornsilk}} |
|
{{Tag|div|style=plain}} |
|
TemplateData
TemplateData for Tag
This template is for 'displaying' HTML/XML-style tags for elements with code markup. It can contain contents between the start and end tags, as well as attributes for the tag. (Note: To add markup tags, use the #tag magic word.)
| Parameter | Description | Type | Status | |
|---|---|---|---|---|
| Tag name | 1 | Tag's name. Use !-- for an HTML comment.
| String | required |
| Type | 2 | To indicate which of the tag's types is/are presented. For example, using "open" → <span>; "close" → </span>; "empty" → <br />. To suppress the ellipsis ("...") between the tags, add an empty "content" parameter → <span></span>
| String | suggested |
| Disable nowrap | wrap | Disable nowrap for long samples, so allowing wraps (line breaks or newlines).
| Boolean | optional |
| CSS style | style | Replace the default CSS style. Use "plain" for "border:none; background:transparent".
| String | optional |
| Link? | link | Link to an HTML element's entry. This is only for HTML elements; the page for the link is hard-coded.
| Unknown | optional |
| Attributes and values | attribs params | Attributes and values to be included as part of an open/start tag
| String | suggested |
| Content | content | Text to place between open/start and close/end tags. | String | suggested |
Global use and documentation
For a global use of this template in other sister or Wikimedia projects, after copy-pasting in the destination project, remember to change the code:
For template documentation in the sister project, you can use Template:Wikipedia doc.
See also
- HTML tag
- Template:Tl
- Template:Tl
- Template:Tl adds a MediaWiki parser or extension tag that links to the extension page.
- #tag:, the parser function that generates working tags.
Other formatting templates
{{#lsth:Template:Template-linking_templates|Other formatting templates}} Lua error in package.lua at line 80: module 'Module:Navbox/configuration' not found.