Help:HTML in wikitext: Difference between revisions

Content deleted Content added
Reverted 1 edit by Honey aiz (talk): No, "HTML Tidy" is correct. (TW)
Line 240:
}}
 
==== blockquote ====blockquot
{{see|MOS:QUOTE}}
{{tag|blockquote}} presents text in an offset block.
 
{{markup
|<nowiki><blockquote>HyperText Markup Language</blockquote></nowiki>
|<blockquote>HyperText Markup Language</blockquote>
}}
 
Templates: {{tl|quote}}; supports pre-formatted attribution and source parameters. For other specialized quotation templates, see [[:Category:Quotation templates]].
 
==== cite ====
{{tag|cite}} contains the title of a work and by default is formatted in italics. This is a new definition in HTML5— in the previous XML implementation {{tag|cite|o}} was used to contain a citation or a reference to other sources.
 
{{markup
|<nowiki><cite>HyperText Markup Language</cite></nowiki>
|<cite>HyperText Markup Language</cite>
}}
 
==== code ====
{{tag|code}} formats a section of computer code. Styled with CSS through {{elements.css}} as a Courier monospaced slab serif typeface with border.
 
{{markup
|<nowiki><code>HyperText Markup Language</code></nowiki>
|<code>HyperText Markup Language</code>
}}
 
Templates: {{tl|code}} uses {{xtag|syntaxhighlight}}.
 
==== data ====
{{tag|data}} formats a machine-readable version of contents.
 
{{markup
|<nowiki><data value="978-0764502149">HTML for Dummies</data></nowiki>
|2=<data value="978-0764502149">HTML for Dummies</data>
}}
 
Attributes: <code>value</code>
 
==== del ====
{{tag|del}} formats deleted text.
 
{{markup
|<nowiki><del>HyperText Markup Language</del></nowiki>
|<del>HyperText Markup Language</del>
}}
 
==== dfn ====
{{tag|dfn}} is used for indicating a definition.
 
{{markup
|<nowiki><dfn>Definition</dfn></nowiki>
|<dfn>Definition</dfn>
}}
 
Templates: {{tl|dfn}}
 
==== em ====
{{see|MOS:ITALIC}}
{{tag|em}} represents a span of text with emphatic stress.
 
{{markup
|<nowiki><em>HyperText Markup Language</em></nowiki>
|<em>HyperText Markup Language</em>
}}
 
Templates: {{tl|em}}
 
==== i ====
{{see|MOS:ITALIC}}
{{tag|i}} represents a span of text offset from its surrounding content without conveying any extra emphasis or importance, and for which the conventional typographic presentation is italic text.
 
{{markup
|<nowiki><i>HyperText Markup Language</i></nowiki>
|<i>HyperText Markup Language</i>
}}
 
Wikimarkup: Use <code><nowiki>''</nowiki></code> to open and close italic text.
{{markup
|<nowiki>''HyperText Markup Language''</nowiki>
|''HyperText Markup Language''
}}
 
==== ins ====
{{tag|ins}} indicates a range of text that has been added. Styled as underlined text. Used on talk pages to indicate refactored text; see [[WP:REDACT]].
 
{{markup
|<nowiki><ins>HyperText Markup Language</ins></nowiki>
|<ins>HyperText Markup Language</ins>
}}
 
==== kbd ====
{{tag|kbd}} indicates user input such as keyboard input or voice commands.
 
{{markup
|<nowiki>Press <kbd>Enter</kbd></nowiki>
|Press <kbd>Enter</kbd>
}}
 
Templates:
* {{tl|kbd}} applies gray styling
* {{tl|key press}} renders illustrated keys and keystrokes.
 
==== mark ====
{{tag|mark}} represents a run of text in one document marked or highlighted for reference purposes, due to its relevance in another context. Marked text is formatted with a yellow background by default.
 
{{markup
|<nowiki><mark>HyperText Markup Language</mark></nowiki>
|<mark>HyperText Markup Language</mark>
|<nowiki><mark style="background:lightblue;">HyperText Markup Language</mark></nowiki>
|4=<mark style="background:lightblue;">HyperText Markup Language</mark>
}}
 
Support: Not supported by Internet Explorer 8 and below.
 
==== pre ====
{{tag|pre}} element represents a block of preformatted text. In MediaWiki, {{xtag|pre}} is actually a parser tag and not HTML, but the function is the same. It also prevents the parsing of templates.
 
{{markup
|<nowiki><pre>HyperText Markup Language</pre></nowiki>
 
 
|<pre>
HyperText Markup Language
</pre>
}}
 
'''HTML entities'''
 
{{xtag|pre}} parses [[Character encodings in HTML|HTML entities]]. If you want to escape this, replace <code>&</code> with <code>&amp;amp;</code>.
 
{{markup
|<nowiki><pre>&amp;amp;</pre></nowiki>
 
 
|<pre>
&amp;
</pre>
|<nowiki><pre>&amp;lt;</pre></nowiki>
 
 
|<pre>
&lt;
</pre>
|<nowiki><pre>&amp;amp;amp;</pre></nowiki>
 
 
|<pre>
&amp;amp;
</pre>
|<nowiki><pre>&amp;amp;lt;</pre></nowiki>
 
 
|<pre>
&amp;lt;
</pre>
}}
 
Templates:
* {{tl|pre}} wraps text that overflows the page.
* {{tl|pre2}} wraps or uses scrollbox.
 
==== q ====
{{tag|q}} is used to mark a short quotation.
 
{{markup
|<nowiki><q>HyperText Markup Language</q></nowiki>
|<q>HyperText Markup Language</q>
}}
 
==== rp, rt, ruby ====
 
{{see|Ruby character}}
 
{{tag|ruby}} marks spans of phrasing content with ruby annotations.
 
{{tag|rt}} marks the ruby text component of a ruby annotation; the ruby text shows in a reduced size over top of the normal characters.
 
{{tag|rp}} is used to provide parentheses around a ruby text component of a ruby annotation, to be shown by user agents that don’t support ruby annotations.
 
Browsers that do not support ruby characters will show the ruby text in normal size, enclosed in parentheses and after the normal content.
 
{{markup
|<nowiki><ruby>
東<rp>(</rp><rt>とう</rt><rp>)</rp>
京<rp>(</rp><rt>きょう</rt><rp>)</rp>
</ruby></nowiki>
|<ruby>
東<rp>(</rp><rt>とう</rt><rp>)</rp>
京<rp>(</rp><rt>きょう</rt><rp>)</rp>
</ruby>
}}
 
Templates:
* {{tl|ruby}}
* {{tl|ruby-ja}} for Japanese
* {{tl|Ruby-zh-p}} for Chinese pinyin
* {{tl|Ruby-zh-b}} for Chinese bopomofo
 
==== s ====
{{tag|s}} is used to indicate content that is no longer accurate or relevant and that has been struck from the page. It is not appropriate when indicating document edits; to mark a span of text as having been removed from a document, use {{tag|del|o}}.
 
{{markup
|<nowiki><s>HyperText Markup Language</s></nowiki>
|<s>HyperText Markup Language</s>
}}
 
Templates: {{tl|strikethrough}}
 
==== samp ====
{{tag|samp}} indicates sample output from a program or computing system.
 
{{markup
|<nowiki><samp>HyperText Markup Language</samp></nowiki>
|<samp>HyperText Markup Language</samp>
}}
 
Templates: {{tl|samp}} applies gray styling
 
==== small ====
{{see|WP:FONTSIZE}}
{{tag|small}} format small text.
 
{{markup
|<nowiki><small>HyperText Markup Language</small></nowiki>
|<small>HyperText Markup Language</small>
}}
 
Templates:
* {{tl|small}} uses {{tag|small|o|params=style="font-size:85%;"}}. {{tl|small}} is recommended over {{tag|small|o}} since not all browsers render small text the same.
 
==== strong ====
{{tag|strong}} formats a span of text with strong importance.
 
{{markup
|<nowiki><strong>HyperText Markup Language</strong></nowiki>
|<strong>HyperText Markup Language</strong>
}}
 
Templates: {{tl|strong}}
 
==== sub ====
{{see|WP:SUBSCRIPT}}
{{tag|sub}} formats a span of text as a subscript.
 
{{markup
|<nowiki>HyperText <sub>Markup Language</sub></nowiki>
|HyperText <sub>Markup Language</sub>
}}
 
Templates:
* {{tl|sub}} ({{sub|subscript}} text)
* {{tl|subsub}} ({{subsub|subscript subscript}} text)
* {{tl|ssub}} ({{ssub|subscript, small}} text)
* {{tl|sup}} ({{sup|superscript}} text)
* {{tl|su}} ({{su|p=superscript|b=subscript}} text)
* {{tl|sup sub}} (text{{sup sub|sup|sub}})
* {{tl|e}} (1.23{{e|4}})
 
==== sup ====
{{see|WP:SUPSCRIPT}}
{{tag|sup}} formats a span of text as a superscript.
 
{{markup
|<nowiki>HyperText <sup>Markup Language</sup></nowiki>
|HyperText <sup>Markup Language</sup>
}}
 
Templates:
* {{tl|sub}} ({{sub|subscript}} text)
* {{tl|subsub}} ({{subsub|subscript subscript}} text)
* {{tl|ssub}} ({{ssub|subscript, small}} text)
* {{tl|sup}} ({{sup|superscript}} text)
* {{tl|su}} ({{su|p=superscript|b=subscript}} text)
* {{tl|sup sub}} (text{{sup sub|sup|sub}})
* {{tl|e}} (1.23{{e|4}})
 
==== time ====
{{tag|time}} defines either a time (24 hour clock), or a date in the Gregorian calendar, optionally with a time and a time-zone offset.
 
{{markup
|<nowiki><time>10:00</time></nowiki>
|<time>10:00</time>
}}
 
Attributes: <code>datetime</code>
 
Support: Not supported by Internet Explorer 8 and below.
 
==== u ====
{{see|MOS:BADEMPHASIS|MOS:QUOTE}}
{{tag|u}} represents a span of text offset from its surrounding content without conveying any extra emphasis or importance, and for which the conventional typographic presentation is underlining; for example, a span of text in Chinese that is a proper name (a Chinese proper name mark), or span of text that is known to be misspelled.
 
{{markup
|<nowiki><u>HyperText Markup Language</u></nowiki>
|<u>HyperText Markup Language</u>
}}
 
Templates: {{tl|underline}}
 
==== var ====
{{see|MOS:ITALIC}}
{{tag|var}} formats text in italics to indicate a variable in a mathematical expression or programming context, or placeholder text that the reader is meant to mentally replace with some other literal value.
 
{{markup
|<nowiki><var>HyperText Markup Language</var></nowiki>
|<var>HyperText Markup Language</var>
}}
 
Templates:
* {{tl|var}}
* {{tl|varserif}} formatted in italic serif to differentiate characters
 
==== wbr ====
{{see| Wikipedia:Line-break handling}}
{{tag|wbr|o}} is a word break opportunity; that is, it specifies where it would be OK to add a line-break where a word is too long, or it is perceived that the browser will break a line at the wrong place.
 
{{markup
|<nowiki>Now is the time to become a power editor, by learning HyperText Markup Language</nowiki>
|Now is the time to become a power editor, by learning HyperText Markup Language
 
|<nowiki>Now is the time to become a power editor, by learning Hyper<wbr>Text Markup Language</nowiki>
|Now is the time to become a power editor, by learning Hyper<wbr />Text Markup Language
}}
 
As the browser window is adjusted narrower, the second example wraps between ''Hyper'' and ''Text''.
 
=== Lists ===
{{see|Help:List|MOS:LIST}}
 
Do not leave blank lines between items in a list unless there is a reason to do so, since this causes the MediaWiki software to interpret each item as beginning a new list.
 
==== dl, dt, dd ====
{{tag|dl}}, {{tag|dt}} and {{tag|dd}} are used to create a description list (formerly definition list) with terms and descriptions. Terms are displayed in bold and descriptions are indented. Each term <em>must</em> include one or more descriptions.
 
{{markup
|<nowiki><dl>
<dt>Term</dt>
<dd>Definition 1</dd>
<dd>Definition 2</dd>
<dd>Definition 3</dd>
<dd>Definition 4</dd>
</dl></nowiki>
|<dl>
<dt>Term</dt>
<dd>Definition 1</dd>
<dd>Definition 2</dd>
<dd>Definition 3</dd>
<dd>Definition 4</dd>
</dl>
}}
 
Wikimarkup: {{tag|dt|o}} is created using <code>;</code> while automatically enclosed in {{tag|dl}}. {{tag|dd|o}} is created using <code>:</code> for each value. For a single or first value the <code>:</code> can be placed on the same line after <code>;</code> where subsequent values must be placed on separate lines.
 
{{markup
|<nowiki>; Term
: Definition 1
: Definition 2
: Definition 3
: Definition 4</nowiki>
|<dl><!-- this wikimarkup does not render in this template -->
<dt>Term</dt>
<dd>Definition 1</dd>
<dd>Definition 2</dd>
<dd>Definition 3</dd>
<dd>Definition 4</dd>
</dl>
}}
 
Templates: {{tl|defn}}
 
==== ol, ul, li ====
{{tag|ol}} represents an ordered list; {{tag|ul}} represents an unordered list; {{tag|li}} represents a list item within either type of list.
 
{{markup
|<nowiki><ol>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
<li>Item 4</li>
</ol></nowiki>
|<ol>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
<li>Item 4</li>
</ol>
|<nowiki><ul>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
<li>Item 4</li>
</ul></nowiki>
|<ul>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
<li>Item 4</li>
</ul>
}}
 
Wikimarkup: use <code>*</code> for items in an unordered list and <code>#</code> for ordered lists.
{{markup
|1=<nowiki># Item 1
# Item 2
# Item 3
# Item 4</nowiki>
|2=<nowiki />
# Item 1
# Item 2
# Item 3
# Item 4
|3=<nowiki>* Item 1
* Item 2
* Item 3
* Item 4</nowiki>
|4=<nowiki />
* Item 1
* Item 2
* Item 3
* Item 4
}}
 
Templates: for a variety of specialized uses, see [[:Category:List formatting and function templates]].
 
=== Containers ===
 
==== div ====
{{see|Span and div}}
{{tag|div}} is a generic container for flow content that displays as a block element.
 
{{markup
|<nowiki>HyperText <div>Markup</div> Language</nowiki>
|HyperText <div>Markup</div> Language
}}
 
==== span ====
{{see|Span and div}}
{{tag|span}} is a container for flow content that displays as an inline element.
 
{{markup
|<nowiki>HyperText <span>Markup</span> Language</nowiki>
|HyperText Markup Language
}}
 
=== Tables ===
{{see|Help:Table|MOS:TABLES}}
 
==== table, td, tr ====
{{tag|table}} defines a table.
 
{{tag|tr}} defines a table row.
 
{{tag|td}} defines a data cell with contents that may include text, links, images, lists, forms, other tables, etc.
 
{{markup
|<nowiki><table border=1>
<tr>
<td>data</td>
<td>data</td>
</tr>
</table></nowiki>
|2=<table border=1>
<tr>
<td>data</td>
<td>data</td>
</tr>
</table>
}}
 
Attributes:
* {{tag|table|o}}:
*: Allowed but not recommended: <code>border=""</code> and <code>border="1"</code>
*: Allowed but obsolete: <code>border</code> (with a non-empty value different from "1"), <code>align</code>, <code>bgcolor</code>, <code>cellpadding</code>, <code>cellspacing</code>, <code>frame</code>, <code>rules</code>, <code>summary</code>, <code>width</code><ref name="w3c_obsolete" />
* {{tag|td|o}}: <code>colspan</code>, <code>headers</code>, <code>rowspan</code>
*: Allowed but obsolete: <code>abbr</code>, <code>align</code>, <code>axis</code>, <code>bgcolor</code>, <code>scope</code>, <code>height</code>, <code>nowrap</code>, <code>valign</code>, <code>width</code><ref name="w3c_obsolete" />
 
==== th ====
{{tag|th}} defines a table header; styled as centered and bold.
 
{{markup
|<nowiki><table border="1">
<tr>
<th>Header</th>
<th>Header</th>
</tr>
<tr>
<td>data</td>
<td>data</td>
</tr>
</table></nowiki>
|2=<table border="1">
<tr>
<th>Header</th>
<th>Header</th>
</tr>
<tr>
<td>data</td>
<td>data</td>
</tr>
</table>
}}
 
Attributes:
* {{tag|th|o}}: <code>colspan</code>, <code>headers</code>, <code>rowspan</code>, <code>scope</code>
*: Allowed but obsolete: <code>abbr</code>, <code>align</code>, <code>axis</code>, <code>bgcolor</code>, <code>scope</code>, <code>height</code>, <code>nowrap</code>, <code>valign</code>, <code>width</code><ref name="w3c_obsolete" />
 
==== caption ====
{{tag|caption}} adds a caption to a table.
 
{{markup
|<nowiki><table border=1>
<caption>Caption</caption>
<tr>
<td>data</td>
<td>data</td>
</tr>
</table></nowiki>
|2=<table border=1>
<caption>Caption</caption>
<tr>
<td>data</td>
<td>data</td>
</tr>
</table>
}}
 
Attributes:
* {{tag|caption|o}}:
*: Allowed but obsolete: <code>align</code><ref name="w3c_obsolete" />
 
==== thead, tfoot, tbody ====
{{tag|thead|o}}, {{tag|tfoot|o}} and {{tag|tbody|o}} are not supported, but are automatically generated when the page is rendered.
 
== Obsolete/deprecated elements ==