Character
Entities
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.
Note that the entities
are case sensitive.
Non-breaking
Space
The most common character entity
in HTML is the non-breaking space.
Normally HTML will truncate spaces in your text. If you write 10
spaces in your text HTML will remove 9 of them. To add spaces to your text, use
the character entity.
Most Common Character Entities
Result
|
Description
|
Entity Name
|
Entity Number
|
|
non-breaking space
|
|
|
<
|
less than
|
<
|
<
|
>
|
greater than
|
>
|
>
|
&
|
ampersand
|
&
|
&
|
"
|
quotation mark
|
"
|
"
|
'
|
apostrophe
|
' (does not work in IE)
|
'
|
Additional Commonly Used Character
Entities
Result
|
Description
|
Entity Name
|
Entity Number
|
¢
|
cent
|
¢
|
¢
|
£
|
pound
|
£
|
£
|
¥
|
yen
|
¥
|
¥
|
§
|
section
|
§
|
§
|
©
|
copyright
|
©
|
©
|
®
|
registered trademark
|
®
|
®
|
×
|
multiplication
|
×
|
×
|
÷
|
division
|
÷
|
÷
|
The
Anchor Tag and the Href Attribute
An anchor can point to any resource on the Web: an HTML page, an
image, a sound file, a movie, etc.
The syntax of creating an anchor:
This anchor defines a link to EEE
111 webpage:
The line above will look like this in a browser:
The
Target Attribute
With the target attribute, you can define where the linked
document will be opened.
The line below will open the document in a new browser window:
The
Anchor Tag and the Name Attribute
The name attribute is used to create a named anchor. When using
named anchors we can create links that can jump directly into a specific
section on a page, instead of letting the user scroll around to find what
he/she is looking for.
Below is the syntax of a named anchor:
The name attribute is used to create a named anchor. The name of
the anchor can be any text you care to use.
The line below defines a named anchor:
You should notice that a named anchor is not displayed in a
special way.
To link directly to the "down" section, add a # sign and
the name of the anchor to the end of a URL, like this:
href="http://faraday.ee.emu.edu.tr/eee111#down">Jump to down section
A hyperlink to the Useful Tips Section from WITHIN the file "firstpage.html"
will look like this: