Chapter: 9.5 HTML Links Topic: 9.5.1 HTML Links: Anchor Destination
Chapter: 9.5 HTML Links Topic: 9.5.1 HTML Links: Anchor Destination
HTML Links
• The HTML <a> tag defines a hyperlink.
• An anchor tag (a) is used to define a link, but you also need to add something to
the anchor tag – the destination of the link.
• A hyperlink (or link) is a word, group of words, or image that you can click on to
jump to another document.
• When you move the cursor over a link in a Web page, the arrow will turn into a
little hand.
• The most important attribute of the <a> element is the href attribute, which
indicates the link's destination.
• By default, links will appear as follows in all browsers,
An unvisited link is underlined and blue.
A visited link is underlined and purple.
An active link is underlined and red.
HTML Link Syntax
• The HTML code for a link is simple. It looks like this,
Page | 40
E-Content of
INTERNET TECHNOLOGY AND WEB DESIGN
HTML Lists
• A list is any ordered set of data. HTML offers us several mechanisms for
specifying lists of information.
• Lists are a part of everyday life. To-do lists determine what to get done.
• Navigational routes provide turn-by-turn lists of directions. Recipes provide lists
of ingredients and lists of instructions.
• With a list for nearly everything, it’s easy to understand why they are also popular
online.
• When we want to use a list on a website, HTML provides three different types to
choose from,
Unordered List
Ordered List
Description List
Page | 41
E-Content of
INTERNET TECHNOLOGY AND WEB DESIGN
• Choosing which type of list to use or whether to use a list at all comes down to
the content and the most semantically appropriate option for displaying that
content.
• For example, we can choose what type of marker to use on a list. The marker
could be square, round, numeric, alphabetical, or perhaps nonexistent.
• Also, we can decide if a list should be displayed vertically or horizontally. All of
these choices play significant roles in the styling of our web pages.
• Unordered List
An unordered list is simply a list of related items whose order does not matter.
Creating an unordered list in HTML is accomplished using the unordered list
block-level element,<ul>.
Each item within an unordered list is individually marked up using the list item
element,<li>.
By default, most browsers add a vertical margin and left padding to the <ul>
element and precede each <li> element with a solid dot.
Example program
Output
• Ordered List
The ordered list element, <ol>, works very much like the unordered list
element; individual list items are created in the same manner.
Page | 42
E-Content of
INTERNET TECHNOLOGY AND WEB DESIGN
The main difference between an ordered list and an unordered list is that with
an ordered list, the order in which items are presented is important.
Because the order matters, instead of using a dot as the default list item
marker, an ordered list uses numbers.
Example Program
Output
• Description List
Another type of list seen online (but not as often as unordered or ordered
lists) is the description list.
Description lists are used to outline multiple terms and their descriptions, as
in a glossary.
Creating a description list in HTML is accomplished using the description list
block-level element, <dl>.
Instead of using a <li> element to mark up list items, the description list
requires two block-level elements the description term element, <dt>, and the
description element, <dd>.
A description list may contain numerous terms and descriptions, one after the
other.
Additionally, a description list may have multiple terms per description, as well
as multiple descriptions per term.
A single term may have multiple meanings and warrant multiple descriptions.
Conversely, a single description may be suitable for multiple terms.
Page | 43
E-Content of
INTERNET TECHNOLOGY AND WEB DESIGN
When adding a description list, the <dt> element must come before the <dd>
element.
The definition term and the description that directly follows it correspond to
one another thus, the order of these elements is important.
By default, the <dl> element will include vertical margins, just like the <ul>
and <ol>elements.
Additionally, the <dd> element includes a left margin by default.
Page | 44