Template:Tag/doc#Examples

{{Documentation subpage}}

{{high-use}}

{{About|'displaying' markup tags|'using' markup tags|mw:Help:Magic_words#Miscellaneous{{!}}the #tag magic word|the inline maintenance tag|Template:Fix}}

: {{tc|tag|tagname [|type] [|content=text] [|attribs=attributes and values]}}

A markup tag is an open < and a close > angle brackets and the content within them, in a markup language, as XML or HTML:

:For example, the </strong> tag provides a title for the Web page.</p> <p>This template provides a quick way to mention a markup-style tag in a preformatted way. Mainly used in discussion/help pages.</p></div></section><section class='wiki-section collapsible' id='section--arameters'><h2 class='section-toggle'>Parameters</h2><div class='wiki-body'><p>{{See also|Span and div}}</p> <p>Required parameters shown in <strong><em>bold italics</strong></em>.</p> <p>; {{para|1}} {{nobold| (<em>tagname</em> above)}} : The XML/HTML tag's name (e.g. {{mono|100%|code}}, {{mono|100%|ref}}).</p> <p>; {{para|2}} {{nobold| (<em>type</em> above)}} : To indicate which of the tag's types is/are presented:</p> <p>:; <code>p</code>  (<code>pair</code>) <em>(default)</em> : A matching pair of open/start and close/end tags (e.g. {{tag|div|pair}}).<br/>To suppress the <a href='?title=ellipsis'>ellipsis</a> ("...") between the tags, add an empty {{para|content}} parameter (for example, {{tag|div|pair|content=}}).</p> <p>:; <code>o</code>  (<code>open</code>) : An open/start tag (e.g. {{tag|span|open}}).</p> <p>:; <code>c</code>  (<code>close</code>) : A close/end tag (e.g. {{tag|span|close}}).</p> <p>:; <code>e</code>  (<code>empty</code>)  or  <code>s</code>  (<code>single</code>)  or  <code>v</code>  (<code>void</code>) : An empty element, formed with a single self-terminating tag (e.g. {{tag|hr|single}}); in HTML5 these are now known as "void" elements, though "empty" is the more common term.</p> <p>; {{para|content}} : Text to place between open/start and close/end tags.</p> <p>; {{para|attribs}} : <a href='?title=HTML_attribute'>Attributes and values</a> to be included as part of an open/start tag (this parameter can also be called {{para|params}}).</p> <p>; {{para|wrap|yes}} : Disable <a href='?title=%3ATemplate%3ANowrap'>nowrap</a> for long samples, so allowing wraps (<a href='?title=Help%3ALine-break_handling'>line breaks</a>).</p> <p>; {{para|link|yes}} : Link to the element's entry in the <a href='?title=HTML_element'>HTML element</a> article, For example: {{tnull|Tag|del|link{{=}}y}} produces: {{Tag|del|link=y}}. This is {{em|only}} for HTML elements; the page for the link is hard-coded.</p> <p>; {{para|style}} : Replace the default CSS style (border:none; background:transparent). For example: {{para|style|background: cornsilk}}</p></div></section><section class='wiki-section collapsible' id='section--xamples'><h2 class='section-toggle'>Examples</h2><div class='wiki-body'><p>{{Markup</p> <p>| <nowiki>{{tag|ref}}</nowiki> | {{tag|ref}}</p> <p>| <nowiki>{{tag|ref|content=}}</nowiki> | {{tag|ref|content=}}</p> <p>| <nowiki>{{tag|ref|content=hello}}</nowiki> | {{tag|ref|content=hello}}</p> <p>| <nowiki>{{tag|span|content=foo}}</nowiki> | {{tag|span|content=foo}}</p> <p>| <nowiki>{{tag|span|open}}</nowiki> | {{tag|span|open}}</p> <p>| <nowiki>{{tag|span|open|content=hello}}</nowiki> | {{tag|span|open|content=hello}}</p> <p>| <nowiki>{{tag|span|close|content=hello}}</nowiki> | {{tag|span|close|content=hello}}</p> <p>| <nowiki>{{tag|span|pair|content=hello}}</nowiki> | {{tag|span|pair|content=hello}}</p> <p>| <nowiki>{{tag|ref|open|attribs=group="note"}}</nowiki> | {{tag|ref|open|attribs=group="note"}}</p> <p>| <nowiki>{{tag|references|single}}</nowiki> | {{tag|references|single}}</p> <p>| <nowiki>{{tag|br|single}}</nowiki> | {{tag|br|single}}</p> <p>| <nowiki>{{tag|!--|content=comment}}</nowiki> | {{tag|!--|content=comment}}</p> <p>| <nowiki>{{tag|math|attribs=chem}}</nowiki> | {{tag|math|attribs=chem}}</p> <p>| <nowiki>{{tag|a</p> <p>|attribs=href="<nowiki>https://en.wikipedia.org/</nowiki>"</p> <p>|content=English Wikipedia}}</nowiki> | {{tag|a|attribs=href="<nowiki>https://en.wikipedia.org/</nowiki>"|content=English Wikipedia}}</p> <p>}}</p></div></section><section class='wiki-section collapsible' id='section--lobal-use-and-documentation'><h2 class='section-toggle'>Global use and documentation</h2><div class='wiki-body'><p>For a global use of this template in other sister or Wikimedia projects, after copying it to paste in the destination project, remember to change in the code:</p> <p><pre></p> <p>|p|pair = <{{#if:{{{link|}}}|[[HTML element#</p> <p></pre></p> <p>by this one:</p> <p><pre></p> <p>|p|pair = <{{#if:{{{link|}}}|[[Wikipedia:en:HTML element#</p> <p></pre></p> <p>Remark that the code <strong><code>Wikipedia:en:</code></strong> has been added.</p> <p>For template documentation in the sister project, you can use <a href='?title=m%3ATemplate%3AWikipedia_doc'>Template:Wikipedia doc</a>.</p></div></section><section class='wiki-section collapsible' id='section--ee-also'><h2 class='section-toggle'>See also</h2><div class='wiki-body'><ul> <li><a href='?title=HTML_tag'>HTML tag</a></li> <li>{{tl|HTMLElement}}</li> <li>{{tl|XMLElement}}</li> <li>{{tl|xtag}} adds a MediaWiki parser or extension tag that links to the extension page.</li> <li><a href='?title=mw%3AHelp%3AMagic_words%23Miscellaneous'>#tag:</a>, the <a href='?title=Wikipedia%3AParser_functions'>parser function</a> that generates working tags.</li> </ul></div></section><section class='wiki-section collapsible' id='section--ther-formatting-templates-'><h2 class='section-toggle'>=Other formatting templates=</h2><div class='wiki-body'><p>{{#lsth:Template:Template-linking_templates|Other formatting templates}}</p> <p>{{semantic markup templates}}</p> <p><includeonly>{{sandbox other||</p> <p><!-- CATEGORIES BELOW THIS LINE, PLEASE: --></p> <p><a href='?title=Category%3AHTML_typing-aid_templates'>Category:HTML typing-aid templates</a></p> <p><a href='?title=Category%3AWikitext_typing-aid_templates'>Category:Wikitext typing-aid templates</a></p> <p><a href='?title=Category%3AWikipedia_XHTML_tag-replacing_templates'> </a></p> <p>}}</includeonly></p></div></section></div></main> <footer class="site-footer"> <div class="footer-container"> <div class="footer-links"> <a href="/about.php">About</a> <a href="/help.php">Help</a> <a href="/updates.php">Updates</a> <a href="/contact.php">Contact</a> <a href="/privacy.php">Privacy</a> <a href="/terms.php">Terms</a> <a href="https://github.com/yourusername/friendly-wiki" target="_blank" rel="noopener">GitHub</a> </div> <div class="footer-copy"> © 2025 Friendly Wiki. All rights reserved. </div> </div> </footer> <script> const toggle = document.getElementById('mobileMenuToggle'); const menu = document.getElementById('mobileMenu'); toggle.addEventListener('click', () => { menu.classList.toggle('active'); }); </script> <!-- Collapsible toggle --> <script> document.addEventListener("DOMContentLoaded", function () { const toggles = document.querySelectorAll('.section-toggle'); toggles.forEach(toggle => { toggle.addEventListener('click', function () { const section = toggle.closest('.collapsible'); const body = section.querySelector('.wiki-body'); body.classList.toggle('collapsed'); }); }); }); </script>