Lesson 3 :- Using Tags and Character Entities
(513 reads)
Text Formatting Tags
Tag Description
<b> Defines bold text
<big> Defines big text
<em> Defines emphasized text
<i> Defines italic text
<small> Defines small text
<strong> Defines strong text
<sub> Defines subscripted text
<sup> Defines superscripted text
<ins> Defines inserted text
<del> Defines deleted text
<s> Deprecated. Use <del> instead
<strike> Deprecated. Use <del> instead
<u> Deprecated. Use styles instead
"Computer Output" Tags
Tag Description
<code> Defines computer code text
<kbd> Defines keyboard text
<samp> Defines sample computer code
<tt> Defines teletype text
<var> Defines a variable
<pre> Defines preformatted text
<listing> Deprecated. Use <pre> instead
<plaintext> Deprecated. Use <pre> instead
<xmp> Deprecated. Use <pre> instead
Citations, Quotations, and Definition Tags
Tag Description
<abbr> Defines an abbreviation
<acronym> Defines an acronym
<address> Defines an address element
<bdo> Defines the text direction
<blockquote> Defines a long quotation
<q> Defines a short quotation
<cite> Defines a citation
<dfn> Defines a definition term
In HTML some characters like the < character, have a special meaning, and
therefore cannot be used in the text.
To display in HTML a less than sign (<) , we have to use a character entity.
Entities for Characters
Some characters have a special meaning in HTML, like the less than sign (<)
that defines the start of an HTML tag. If we want the browser to actually display
these characters we must insert character entities in the HTML source.
A character entity has three parts: an ampersand (&), an entity name or
a # and an entity number, and finally a semicolon (;).
To display a less than sign in an HTML document we must write: < or
<
The advantage of using a name instead of a number is that a name is easier
to remember. The disadvantage is that not all browsers support the newest entity
names, while the support for entity numbers is very good in almost all browsers.
Entities are case sensitive.
Non-breaking Space
The most common character entity in HTML is the non-breaking space.
To add spaces to your text, use the character entity.
This is because normally HTML will truncate spaces in your text. If you write
10 spaces in your text HTML will remove 9 of them. |