Login

Username:

Password: 

Join us Now |  Forgot Password? | Forgot UserName?

HTML

Learn step by step



HTML Phrase Tags

While some of these phrase elements are displayed in a similar manner to the <b>, <i>, <pre>, and <tt> elements as we have seen in previous chapters, they are designed for specific purposes. For example, the <em> and <strong> elements provide text emphasis and strong emphasis respectively and there are several elements for marking up quotes.
We will be covering most of phrase tags in this section with examples.

Emphasized Text - The <em> Element:

The content of an <em> element is to be used to provide emphasis on any word or line in your document, and it is usually displayed in italicized text. In below example emphasis is on words such as "must" in the following sentence:


<p>You <em>must</em> provide closing elements in XHTML.</p>

Output

You must provide closing elements in XHTML.
Strong Text - The <strong> Element:

The <strong> element is used to show strong emphasis for its content; stronger emphasis than the <em> element. As with the <em> element, the <strong> element should only be used when you want to add strong emphasis to part of a document.


<p>You <strong>must</strong> provide closing elements in XHTML.</p>

Output

You must remember provide closing elements in XHTML.
Text Abbreviation - The <abbr> Element :

You can define abbreviate form by placing the abbreviation between opening <abbr> and closing </abbr> tags.


title="Abhishek">Abhy</abbr>.</p>

Output

I have a friend called Abhy.
Using Acronym - The <acronym> Element :

The <acronym> element indicate that the text between an opening <acronym> and closing </acronym> element is an acronym.
If possible provide a title attribute whose value is the full version of the acronyms on the <acronym> element, and if the acronym is in a different language, include an xml:lang attribute in XHTML documents.


<p>This chapter covers marking up text in <acronym title="Extensible Hypertext Markup Language">XHTML</acronym>.</p>

Output

This chapter covers marking up text in XHTML.

At present, the major browsers do not change the appearance of the content of the <acronym> element.

Special Terms - The <dfn> Element :

The <dfn> element allows you to specify that you are introducing a special term. Its use is similar to the words that are in italics in the midst of paragraphs in this book when new key concepts are introduced.
Typically, you would use the <dfn> element the first time you introduce a key term and only in that instance. Most recent browsers render the content of a <dfn> element in an italic font.


<p>This tutorial teaches you how to mark up your documents for the web using <dfn>XHTML</dfn>.</p>

Output

This tutorial teaches you how to mark up your documents for the web using XHTML.
Quoting Text - The <blockquote> Element :

When you want to quote a passage from another source, you should use the <blockquote> element.
Text inside a <blockquote> element is usually indented from the left and right edges of the surrounding text, and sometimes uses an italicized font.


<p>The following description of XHTML is taken from the W3C Web site:</p>
<blockquote> XHTML 1.0 is the W3C's first Recommendation for XHTML, following on from earlier work on HTML 4.01, HTML 4.0, HTML 3.2 and HTML 2.0. </blockquote>

Output

The following description of XHTML is taken from the W3C Web site:
XHTML 1.0 is the W3C's first Recommendation for XHTML, following on from earlier work on HTML 4.01, HTML 4.0, HTML 3.2 and HTML 2.0.

You can use the cite attribute on the <blockquote> element to indicate the source of the quote.


<p>The following description of XHTML is taken from the W3C Web site:</p>
<blockquote cite="http://www.w3.org/markup/"> XHTML 1.0 is the W3C's first Recommendation for XHTML, following on from earlier work on HTML 4.01, HTML 4.0, HTML 3.2 and HTML 2.0. </blockquote>
Short Quotations - The <q> Element :

The <q> element is intended to be used when you want to add a quote within a sentence rather than as an indented block on its own.


<p>Amit is in Spain, <q>He is their at my home. I think I am wrong</q>.</p>

Output

Amit is in Spain, He is their at my home. I think I am wrong.

The <q> element can also carry the cite attribute. The value should be a URL pointing to the source of the quote.

Citations - The <cite> Element :

If you are quoting a text, you can indicate the source placing it between an opening <cite> tag and closing </cite> tag
As you would expect in a print publication, the content of the <cite> element is rendered in italicized text by default.


<p>This HTML Tutorial is derived from <cite>World Wide Web Standard for HTML</cite>.</p>

Output

This HTML Tutorial is derived from World Wide Web Standard for HTML.
Computer Code - The <code> Element :

Any code to appear on a Web page should be placed inside a <code> element. Usually the content of the <code> element is presented in a monospaced font, just like the code in most programming books


<h1> <code>This is inside code element</code></h1>

Output

This is inside code element

Keyboard Text - The <kbd> Element :

When you are talking about computers, if you want to tell a reader to enter some text, you can use the <kbd> element to indicate what should be typed in, as in this example.
The content of a <kbd> element is usually represented in a monospaced font rather like the content of the <code> element


<h1> <kbd>This is inside kbd element</kbd></h1>

Output

This is inside kbd element

Programming Variables - The <var> Element :

This element is usually used in conjunction with the <pre> and <code> elements to indicate that the content of that element is a variable that can be supplied by a user.


<p><code>document.write("<var>user-name</var>")</code></p>

Output

document.write("user-name")

Program Output - The <samp> Element :

The <samp> element indicates sample output from a program, script, or the like. Again, it is mainly used when documenting programming concepts. For example:


<p>Result produced by the program is <samp>Hello World</samp></p>

Output

Result produced by the program is Hello World

Addresses - The <address> Element :

The <address> element is used to contain any address. For example:


<address>304, Menna Colony, Mumbai - INDIA, 400609</address>

Output

304, Menna Colony, Mumbai - INDIA, 400609
Block and Inline Elements:

We can categories all the elements into two sections:

  • Block-level elements - Block-level elements appear on the screen as if they have a carriage return or line break before and after them. For example the <p>, <h1>, <h2>, <h3>, <h4>, <h5>, <h6>, <ul>, <ol>, <dl>, <pre>, <hr />, <blockquote>, and <address> elements are all block level elements. They all start on their own new line, and anything that follows them appears on its own new line.
  • Inline elements - Inline elements, on the other hand, can appear within sentences and do not have to appear on a new line of their own. The <b>, <i>, <u>, <em>, <strong>, <sup>, <sub>, <big>, <small>, <li>, <ins>, <del>, <code>, <cite>, <dfn>, <kbd>, and <var> elements are all inline elements.

The elements which we have not discussed till now, will be discussed in subsequent chapters.



Related Videos