<html> <head> <title>Character Formatting</title> </head> <body background="../../images/backgrounds/Ridgewater_white.gif"> <div align="center"> <table width="620" bgcolor="#FFFFFF"> <tr> <td> <h1 align="center">Character Formatting</h1> <p>&nbsp; <table> <tr> <td>HTML has two types of styles for individual words or sentences: logical and physical. <em>Logical style</em> tags indicate the meaning of the text, while <b>physical style</b> tags mark the specific appearance of a section of text. For example, in the preceding sentence, the words &quot;logical style&quot; were tagged as &quot;emphasis&quot; and the words &quot;physical style&quot; were tagged as &quot;bold&quot;. The same effect (formatting those words in italics) could have been achieved via a different tag that tells your browser to &quot;put these words in italics&quot;.</td> </tr> </table> <p><br> <h3>Logical Versus Physical Style Tags</h3> <table> <tr> <td>If physical and logical style tags produce the same result on the screen, why are there both? <p>In the ideal SGML universe, content is divorced from presentation. Thus SGML tags a level-one heading as a level-one heading, but does not specify that the level-one heading should be, for instance, 24-point bold Times centered. The advantage of this logical style approach (it's similar in concept to style sheets in many word processors) is that if you decide to change level-one headings to be 20-point left-justified Helvetica, all you have to do is change the definition of the level-one heading in your Web browser. Indeed, many browsers today let you define how you want the various HTML tags rendered on-screen using what are called cascading style sheets, or CSS. <p>Another advantage of logical style tags is that they help enforce consistency in your documents. It's easier to tag something as &lt;H1&gt; than to remember that level-one headings are 24-point bold Times centered or whatever. For example, consider the &lt;STRONG&gt; tag. Most browsers render it in bold text. However, it is possible that a reader would prefer that these sections be displayed in red instead. (This is possible using a local cascading style sheet on the reader's own computer.) Logical styles offer this flexibility. <p>Of course, if you want something to be displayed in italics (for example) and do not want a browser's setting to display it differently, you should use physical styles. Physical styles, therefore, offer consistency in that something you tag a certain way will always be displayed that way for readers of your document. <p>Try to be consistent about which type of style tags you use. If you tag with physical styles, do so throughout a document. If you use logical styles, stick with them within a document. Keep in mind that future releases of HTML might not support certain logical styles, which could mean that browsers will not display your logical-style coding. (For example, the &lt;DFN&gt; tag -- short for &quot;definition&quot;, and typically displayed in italics -- is not widely supported and will be ignored if the reader's browser does not understand it.) <p>The main difference between logical and physical style tags is what they say. <strong>Logical styles say something about the meaning of the Author's text.</strong> <strong>Physical styles say how the Author wants to display the text.</strong></td> </tr> </table> <p><br> <h3>Logical Style Tags</h3> <table> <tr> <td align="right"><font size="-1"><b>Tag</b></font></td> <td><font size="-1"><b>Purpose</b></font></td> <td><font size="-1"><b>Example</b></font></td> </tr> <tr valign="top"> <td align="right"><a name="ABBR"></a>&lt;ABBR&gt;</td> <td>abbreviation: indicates that content is an abbreviation. Typically does not change how the text is displayed in the browser.</td> <td><font face color="Green"><code>&lt;abbr title=&quot;abbreviation&quot;&gt;abbv&lt;/abbr&gt;</code></font><br> <font face color="Blue"><abbr title="abbreviation">abbv</abbr></font></td> </tr> <tr valign="top"> <td align="right"><a name="ACRONYM"></a>&lt;ACRONYM&gt;</td> <td>acronym: indicates that content is an acronym. Typically does not change how the text is displayed in the browser.</td> <td><font face color="Green"><code>&lt;acronym title=&quot;World Wide Web&quot;&gt;WWW&lt;/acronym&gt;</code></font><br> <font face color="Blue"><acronym title="World Wide Web">WWW</acronym></font></td> </tr> <tr valign="top"> <td align="right"><a name="ADDRESS"></a>&lt;ADDRESS&gt;</td> <td>address: for an address. Typically displayed in italics.</td> <td><font face color="Green"><code>&lt;address&gt;15 5&lt;sup&gt;th&lt;/sup&gt; Avenue N.W.&lt;/address&gt;</code></font><br> <font face color="Blue"> <address> 15 5<sup>th</sup> Avenue N.W. </address> </font></td> </tr> <tr valign="top"> <td align="right"><a name="CITE"></a>&lt;CITE&gt;</td> <td>cite: for titles of books, films, etc. Typically displayed in italics.</td> <td><font face color="Green"><code>&lt;cite&gt;HTML for the World Wide Web &lt;font size=&quot;-1&quot;&gt;Fourth Edition&lt;/font&gt;&lt;/cite&gt;</code></font><br> <font face color="Blue"><cite>HTML for the World Wide Web <font size="-1">Fourth Edition</font></cite></font></td> </tr> <tr valign="top"> <td align="right"><a name="CODE"></a>&lt;CODE&gt;</td> <td>code: for computer code. Displayed in a fixed-width font.</td> <td><font face color="Green"><code>&lt;code&gt;The &amp;lt;stdio.h&amp;gt; header file&lt;/code&gt;</code></font><br> <font face color="Blue"><code>The &lt;stdio.h&gt; header file</code></font></td> </tr> <tr valign="top"> <td align="right"><a name="DEL"></a>&lt;DEL&gt;</td> <td>deleted: for text that has been deleted. Allows revision control in HTML documents. Not widely supported.</td> <td><font face color="Green"><code>The last word has been &lt;del&gt;deleted&lt;/del&gt;.</code></font><br> <font face color="Blue">The last word has been <del>deleted</del>.</font></td> </tr> <tr valign="top"> <td align="right"><a name="DFN"></a>&lt;DFN&gt;</td> <td>definition: for a word being defined. Typically displayed in italics.</td> <td><font face color="Green"><code>&lt;dfn&gt;NCSA Mosaic is a World Wide Web browser.&lt;/dfn&gt;</code></font><br> <font face color="Blue"><dfn>NCSA Mosaic is a World Wide Web browser.</dfn></font></td> </tr> <tr valign="top"> <td align="right"><a name="EM"></a>&lt;EM&gt;</td> <td>emphasis: for emphasis. Typically displayed in italics.</td> <td><font face color="Green"><code>&lt;em&gt;Consultants can reset your password if you call the help line.&lt;/em&gt;</code></font><br> <font face color="Blue"><em>Consultants can reset your password if you call the help line.</em></font></td> </tr> <tr valign="top"> <td align="right"><a name="INS"></a>&lt;INS&gt;</td> <td>inserted: for text that has been inserted. Allows revision control in HTML documents. Not widely supported.</td> <td><font face color="Green"><code>The last word has been &lt;ins&gt;inserted&lt;/ins&gt;.</code></font><br> <font face color="Blue">The last word has been <ins>inserted</ins>.</font></td> </tr> <tr valign="top"> <td align="right"><a name="KBD"></a>&lt;KBD&gt;</td> <td>keyboard: for user keyboard entry. Typically displayed in plain fixed-width font.</td> <td><font face color="Green"><code>&lt;kbd&gt;Enter passwd to change your password.&lt;/kbd&gt;</code></font><br> <font face color="Blue"><kbd>Enter passwd to change your password.</kbd></font></td> </tr> <tr valign="top"> <td align="right"><a name="Q"></a>&lt;Q&gt;</td> <td>quotation: for a short quote. Typically displayed in plain fixed-width font with surrounding quotes.</td> <td><font face color="Green"><code>&lt;q&gt;To be or not to be.&lt;/q&gt;</code></font><br> <font face color="Blue"><q>To be or not to be.</q></font></td> </tr> <tr valign="top"> <td align="right"><a name="SAMP"></a>&lt;SAMP&gt;</td> <td>sample: for a sequence of literal characters. Displayed in a fixed-width font.</td> <td><font face color="Green"><code>&lt;samp&gt;Segmentation fault: Core dumped.&lt;/samp&gt;</code></font><br> <font face color="Blue"><samp>Segmentation fault: Core dumped.</samp></font></td> </tr> <tr valign="top"> <td align="right"><a name="STRIKE"></a>&lt;STRIKE&gt;</td> <td>strike-out: for text that has been stricken. Typically displayed with a center line.<br> This works simply as an &lt;S&gt; tag in some browsers -- like:</td> <td><font face color="Green"><code>&lt;strike&gt;The ruling is in favor of the defendant.&lt;/strike&gt;<br> &lt;s&gt;The ruling is in favor of the plaintiff.&lt;/s&gt;</code></font><br> <font face color="Blue"><strike>The ruling is in favor of the defendant.</strike><br> <s>The ruling is in favor of the plaintiff.</s></font></td> </tr> <tr valign="top"> <td align="right"><a name="STRONG"></a>&lt;STRONG&gt;</td> <td>strong: for strong emphasis. Typically displayed in bold.</td> <td><font face color="Green"><code>&lt;strong&gt;NOTE: Always check your links.&lt;/strong&gt;</code></font><br> <font face color="Blue"><strong>NOTE: Always check your links.</strong></font></td> </tr> <tr valign="top"> <td align="right"><a name="VAR"></a>&lt;VAR&gt;</td> <td>variable: for a variable that is replaced with specific information. Typically displayed in italics.</td> <td><font face color="Green"><code>&lt;var&gt;rm filename deletes the file.&lt;/var&gt;</code></font><br> <font face color="Blue"><var>rm filename deletes the file.</var></font></td> </tr> </table> <p><br> <h3>Physical Style Tags</h3> <table> <tr> <td align="right"><font size="-1"><b>Tag</b></font></td> <td><font size="-1"><b>Purpose</b></font></td> <td><font size="-1"><b>Example</b></font></td> </tr> <tr valign="top"> <td align="right"><a name="B"></a>&lt;B&gt;</td> <td>bold: bold text.</td> <td><font face color="Green"><code>&lt;b&gt;Bold text example.&lt;/b&gt;</code></font><br> <font face color="Blue"><b>Bold text example.</b></font></td> </tr> <tr valign="top"> <td align="right"><a name="BIG"></a>&lt;BIG&gt;</td> <td>big: big text. This is the same as using a &lt;font size=&quot;+1&quot;&gt; tag.</td> <td><font face color="Green"><code>&lt;big&gt;Big text example.&lt;/big&gt;</code></font><br> <font face color="Blue"><big>Big text example.</big></font></td> </tr> <tr valign="top"> <td align="right"><a name="BLINK"></a>&lt;BLINK&gt;</td> <td>blink: blinking text.</td> <td><font face color="Green"><code>&lt;blink&gt;Blinking text example.&lt;/blink&gt;</code></font><br> <font face color="Blue"><blink>Blinking text example.</blink></font></td> </tr> <tr valign="top"> <td align="right"><a name="FONT"></a>&lt;FONT&gt;</td> <td>font: font formatting.</td> <td><a href="../../htmlnotes/formatting/FontFormatting.htm">Font Color, Face, and Size Formatting</a></td> </tr> <tr valign="top"> <td align="right"><a name="I"></a>&lt;I&gt;</td> <td>italics: italic text.</td> <td><font face color="Green"><code>&lt;i&gt;Italics text example.&lt;/i&gt;</code></font><br> <font face color="Blue"><i>Italics text example.</i></font></td> </tr> <tr valign="top"> <td align="right"><a name="SMALL"></a>&lt;SMALL&gt;</td> <td>small: small text. This is the same as using a &lt;font size=&quot;-1&quot;&gt; tag.</td> <td><font face color="Green"><code>&lt;small&gt;Small text example.&lt;/small&gt;</code></font><br> <font face color="Blue"><small>Small text example.</small></font></td> </tr> <tr valign="top"> <td align="right"><a name="SUB"></a>&lt;SUB&gt;</td> <td>subscript: subscript text.</td> <td><font face color="Green"><code>H&lt;sub&gt;2&lt;/sub&gt;O</code></font><br> <font face color="Blue">H<sub>2</sub>O</font></td> </tr> <tr valign="top"> <td align="right"><a name="SUP"></a>&lt;SUP&gt;</td> <td>superscript: superscript text.</td> <td><font face color="Green"><code>2&lt;sup&gt;3&lt;/sup&gt; = 8</code></font><br> <font face color="Blue">2<sup>3</sup> = 8</font></td> </tr> <tr valign="top"> <td align="right"><a name="TT"></a>&lt;TT&gt;</td> <td>typewriter: typewriter text (fixed-width font).</td> <td><font face color="Green"><code>&lt;tt&gt;Typewriter text example.&lt;/tt&gt;</code></font><br> <font face color="Blue"><tt>Typewriter text example.</tt></font></td> </tr> <tr valign="top"> <td align="right"><a name="U"></a>&lt;U&gt;</td> <td>underlined: underlined text.</td> <td><font face color="Green"><code>&lt;u&gt;Underlined text example.&lt;/u&gt;</code></font><br> <font face color="Blue"><u>Underlined text example.</u></font></td> </tr> </table> <p><br> <h3>Special Formatting Tags</h3> <table> <tr> <td>There are other formatting tags that used for special purposes, are not widely supported, or have been deprecated. If you want to see them, <a href="../../htmlnotes/formatting/SpecialFormatting.htm">click here</a>.</td> </tr> </table> <h3>Combining Styles</h3> <table> <tr> <td>Character formatting tags also are sometimes not additive. For example, you might expect that: <nobr>&lt;B&gt;&lt;I&gt;some text&lt;/I&gt;&lt;/B&gt;</nobr> would produce bold-italic text. On some browsers it does; other browsers interpret only the innermost tag. If you want to see some style combinations, <a href="../../htmlnotes/formatting/StyleCombinations.htm">click here</a>.</td> </tr> </table> </td> </tr> </table> </div> </body> </html>