Template:Tag/doc

From Wikipedia, the free encyclopedia

Script error: No such module "about".

Page Module:Message box/ombox.css has no content.

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=plain as a shortcut for border:none; background:transparent.

Examples

Page Template:Markup/styles.css has no content.

Markup Renders as
{{tag|ref}}

<ref>...</ref>

{{tag|ref|content=}}

<ref></ref>

{{tag|ref|content=hello}}

<ref>hello</ref>

{{tag|span|content=foo}}

<span>foo</span>

{{tag|span|open}}

<span>

{{tag|span|open|content=hello}}

<span>hello

{{tag|span|close|content=hello}}

hello</span>

{{tag|span|pair|content=hello}}

<span>hello</span>

{{tag|ref|open|attribs=group="note"}}

<ref group="note">

{{tag|references|single}}

<references />

{{tag|br|single}}

<br />

{{tag|!--|content=comment}}

<!--comment-->

{{tag|math|attribs=chem}}

<math chem>...</math>

{{tag|a
 |attribs=href="<nowiki>https://en.wikipedia.org/</nowiki>"
 |content=English Wikipedia
 |wrap=yes}}

<a href="https://en.wikipedia.org/">English Wikipedia</a>

{{Tag|del|link=y}}

<del>...</del>

{{tag|div|style=background: cornsilk}}

<div>...</div>

{{Tag|div|style=plain}}

<div>...</div>

TemplateData

This is the TemplateData for this template used by TemplateWizard, VisualEditor and other tools. Template:Template parameter usage

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.)

Template parameters

This template prefers inline formatting of parameters.

ParameterDescriptionTypeStatus
Tag name1

Tag's name. Use !-- for an HTML comment.

Example
includeonly
Stringrequired
Type2

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>

Suggested values
pair open close empty void single p o c e v s
Default
pair
Example
open
Stringsuggested
Disable nowrapwrap

Disable nowrap for long samples, so allowing wraps (line breaks or newlines).

Default
no
Auto value
yes
Booleanoptional
CSS stylestyle

Replace the default CSS style. Use "plain" for "border:none; background:transparent".

Example
background: cornsilk
Stringoptional
Link?link

Link to an HTML element's entry. This is only for HTML elements; the page for the link is hard-coded.

Suggested values
yes y
Unknownoptional
Attributes and valuesattribs params

Attributes and values to be included as part of an open/start tag

Example
class="plainlinks"
Stringsuggested
Contentcontent

Text to place between open/start and close/end tags.

Stringsuggested

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:

Template:Stringdiff

For template documentation in the sister project, you can use Template:Wikipedia doc.

See also

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.