inline tags:

Inline tags

In html the very finest level of formatting we can achieve is done at character level, the same way in which you can effect an individual characters formatting with text editing and word processing software.

Quick Links:
Basic tags
Bold text
Italic text
Quick Links:
Small text
Teletype text
Span tags

Basic inline tags

These are the most commonly  used inline formatting  elements in html.

  • Bold text<b> )
  • Italic text  (<i> )
  • Big text (<big> )
  • Small text (<small> )
  • Emphasised text  (<em> )
  • Strong text (<strong> )
  • Teletype text (monospaced) (<tt> )
Note icon several of the inline tags  have now been deprecated in the current html specification, these are tags  such as <strike> tag,  used to strikethrough text, and also the <u> tag  which was used to underline text.
The <font> tag has also been deprecated in favour of using the <span> tag  and CSS styles to achieve the same effects.
The span tag  allows you the freedom to apply  formatting stylistically  wherever you want it in the document.

Bold text

To make text appear Bold you can use the <b> tags  or <strong> tags.
As you can see in the example below the <strong> tags  will make the text between the tags  appear bold.

Downloads:
Download the strong tags example.
Download the strong tags example
Download the source code in a text file.
Download the source code in a text file
<html>
<head>
  <title>html strong tags</title>
</head>
<body>
<h1>html strong tags</h1>
<p>
This word is <strong>bold</strong> in this
short sentence...
</p>
<p>
None of the words in this short sentence
have been formatted.

</p>
</body>
</html>
Top of pageTop of page

You can find more information on the W3Schools web site on the strong tags.

Italic text

To make text appear in italics  you can use the <i> tags  or <em> tags.
As you can see in the example below the text that is between the <em> tags  will appear italic  (emphasized).

Downloads:
Download the em tags example.
Download the em tags example
Download the source code in a text file.
Download the source code in a text file
<html>
<head>
  <title>html em tags</title>
</head>
<body>
<h1>html em tags</h1>
<p>
This word is <em>italic </em> in this
short sentence...
</p>
<p>
None of the words in this short sentence
have been formatted.

</p>
</body>
</html>

You can find more information at the W3Schools web site on the em tags.

Note icon Not every font has an italic   or a bold variant so when it is possible the browser will substitute a similar font when bold or italic is requested but not available.
Unfortunately not all user agents are font  savvy so usage of these tags may vary depending upon what user agent is in use.
Top of pageTop of page

   

Small text

To make text in your document appear smaller you can use the <small> tags,  in the same way that the text in the example below has been made smaller

Downloads:
Download the small tags example.
Download the small tags example
Download the source code in a text file.
Download the source code in a text file
<html>
<head>
  <title>html small tags</title>
</head>
<body>
<h1>html small tag</h1>
<p>
This word is <small>smaller</small> than the
other words in this sentence...
</p>
<p>
None of the words in this short sentence
have been formatted.

</p>
</body>
</html>
Top of pageTop of page

You can find more information at the W3Schools web site about the small tags.

Teletype text

The teletype <tt> or monspaced tags  informs the client browser that the text should be rendered in a monospaced font.
This could be used for reserved words in a document or examples of code, the tag  after the teletype terminals that were used with the first computers, which were only capable of printing in a monospaced font.

Downloads:
Download the teletype tags example.
Download the teletype tags example
Download the source code in a text file.
Download the source code in a text file
<html>
<head>
  <title>html tt tags</title>
</head>
<body>
<h1>html tt tags</h1>
<p>
This word is <tt>monospaced</tt> in its
appearance in this sentence ...
</p>
<p>
None of the words in this short sentence
have been formatted.

</p>
</body>
</html>
Top of pageTop of page

You can find more information at the W3Schools web site on the tt tags.

Span tags

The span tags look like this <span>, and they are used to span inline  styles across mulitple  characters, or just single words  or characters depending upon what is required.
The span tags  allows us the freedom to define inline  styles wherever they are needed in the document, as the example below illustrates.
To see the example below rendered in a browser click on this link span

Downloads:
Download the span tags example.
Download the span tags example
Download the source code in a text file.
Download the source code in a text file
<html>
<head>
  <title>html span tags</title>
</head>
<body>
<p>
This word is highlighted
<span style="color:#00ff00;">
green
</span>
in this short sentence...
</p>
<p>
None of the words in this short sentence
have been formatted.

</p>
</body>
</html>

The example above uses a CSS style to specify the colour  of a word in the first paragraph, it is possible to apply the attributes directly to the span tag, but it is better practice to use a CSS styles to format the text within the span tags.

You can find more information at the W3Schools web site on the span tags.

Now that we have covered the basics of creating an html document and populating the document with content and formatting the content you are ready to look at the other elements that can be used in an html document such as special characters, lists, tables, images etc...
You can now work through the rest of the pages in whatever order is best for you.

Google
 
Top of page
Valid XHTML1.0 Transitional. Valid CSS. Copyright © 2005 –
www.syntaxsandbox.co.uk