Tuesday, May 13, 2014

HTML Formatting

// // Leave a Comment

Example:
<!DOCTYPE html>
<html>
<body>
<p><b>This text is bold</b></p>
<p><strong>This text is strong</strong></p>
<p><i>This text is italic</i></p>
<p><em>This text is emphasized</em></p>
<p><code>This is computer output</code></p>
<p>This is<sub> subscript</sub> and <sup>superscript</sup></p>
</body>
</html>
Result:
This text is bold
This text is strong
This text is italic
This text is emphasized
This is computer output
This is subscript and superscript
Often <strong> renders as <b>, and <em> renders as <i>.

However, there is a difference in the meaning of these tags:

<b> or <i> defines bold or italic text only.

<strong> or <em> means that you want the text to be rendered in a way that the user understands as "important". Today, all major browsers render strong as bold and em as italics. However, if a browser one day wants to make a text highlighted with the strong feature, it might be cursive for example and not bold!
Try some text formatting tags:

Tag
Description
<b> Define bold text
<em> Defines emphasized text
<i> Defines a italic text
<small> Defines a smaller text
<strong> Defines a important text
<sub> Defines a subscripted text
<sup> Defines a superscripted text
<Ins> Defines a inserted text
<del> Defines deleted text
<mark> Defines marked/highlighted text
<code> Defines computer code text
<kbd> Defines keyboard text
<samp> Defines sample computer code
<var> Defines variable
<pre> Defines preformatted text
<abbr> Defines abbreviation or acronym
<address> Defines contact information for the author or the owner of the document
<bdo> Defines the text direction
Example: <bdo dir=”rtl>right to left</bdo>
<blockquote> Defines a section that is quoted from another source
<q> Define a inline short quotation
<cite> Defines a title of the work
<dfn> Defines a definition term

0 comments:

Post a Comment