Home > Computers & Technology > Internet > Web Design
Created on: March 07, 2009 Last Updated: March 11, 2009
XHTML Basics - Part 6
Introduction Consider the following paragraph element:
<p>In mathematics the < symbol is often used.</p>
Note that you have the Less Than sign < inside the content of the paragraph. This less than sign is the open angle bracket. The open angle bracket begins a tag in your text editor. The browser uses this rule to know the beginning of the tag. If we have the < sign in the content of the paragraph element, the browser might consider it as the beginning of a tag. As you can see, this would cause confusion. So if you want the < sign to appear as content in your paragraph, you have to use what is called an entity. You have to use either, < or $#60 in your text editor. So, in your code (text editor), you would type the above paragraph as either
<p>In mathematics the < symbol is often used.</p>
or
<p>In mathematics the < symbol is often used.</p>
and your browser will display the following:
In mathematics the < symbol is often used.
Interpreting Character Entities We now know that
< means <
and
< also means <
An entity is code used in text in place of a character (symbol) that has a special meaning in XHTML. A character entity has three parts. It begins with &. When the browser sees &', it knows that it is dealing with an entity. The second part is either a name or the # sign and a number. lt' above in the first entity is a name. lt' stands for "less than". Even though it is an abbreviation, it is considered as a name in XHTML.
The second part of the entity has to be a name or # and a number. For the Less Than sign if you do not want the second part to be a name, you have to use, "<". Whether, you have used the name or the # and a number, the last part, is a semicolon, that is ;'
Note: it is easier to remember the entities (e.g <) that have names, than the entities (e.g. <), that have numbers.
Wow, when I started learning programming, I found topics like this interesting. I hope you find it interesting. Let us continue.
Special Characters Yes, entities are to be type when you want special characters. In this section, we look at some of the special characters and why they are special.
The reason they are special is simple. Remember, when we talked about attributes; we said that the attribute value should be in double or single quotes. As you can see, quotes are used to identify attribute values. When you type in your text editor, you type
Below are the top articles rated and ranked by Helium members on:
Basics of XHTML character entities
Featured Partner
Taxpayers for Common Sense (TCS) is a nonpartisan budget watchdog serving as an independent voice for American taxpayers. Founded in 1995, TCS dedicates itself to exposing and ending wasteful and harmful spending in order to create a fe...more