|
<a The <a> tag is one of the most important; it allows you to set up jumps. You use it to link to other pages or sites, another section on the same page or to any file such as a sound file, movie clip, picture, zip file and so on. A link has two ends, called anchors, and a direction. The link starts at the source anchor and points to the destination. You must specify either a name or an href attribute or both. The name attribute allows you to use the anchor as a destination of a link and the href attribute tells the browser where you want a link to lead. You must enter the end-tag. Some examples: <a href="myhelp.html">My Help File</a> <a href="http://www.mysite.com">My home page</a> <a href="../images/pc.jpg">A picture of a computer</a> <a target="viewer" href="sample.htm">Load page</a> <a href="auldlang.mid">Auld Lang Syne (5 kB Midi)</a> <a href="mailto:a.gilliver@lineone.net">a.gilliver</a> Attributesaccesskey=key Specifies a shortcut key for the link. You activate the link by pressing Alt and the access key together; like standard menu shortcuts in Windows applications. charset=charset The character set encoding. An example is ISO-8859-1 (often called Latin-1). This character set covers the most common characters in western European languages. Indicates the class to which the tag belongs. You can use the class attribute in a style sheet to create different styles that you want apply to a single HTML tag. For example, you might create three different styles for an anchor <a> tag. See Using the class attribute as a selector for more details. coords=coords Specifies the co-ordinates that define the anchor's shape. Measured from the upper left corner of the picture. You can specify pixels or percentages: For a rectangle, the coordinates are left-x, top-y, right-x, bottom-y. For a circle, the coordinates are centre-x, centre-y, radius. For a polygon, the coordinates are in pairs (i.e. "x1,y1,x2,y2,x3,y3... ") that define the coordinates of the various points of the hotspot. dir=ltr|rtr Specifies the direction of text. This can be left-to-right (ltr) or right-to-left (rtl). For example, English characters are presented left-to-right, Hebrew characters are presented right-to-left. This tells the browser where you want the link to lead. Here are some examples: To link to a page on another web site: Visit <a href="http/www.annhome.com/index.html">Ann’s Web site</A> You need to give the full web address (the URL). You should include the double quotation marks around the URL. To link to another page on your intranet:
<a href="sales.htm">Sales
brochure</a> If you don’t enter a path or domain name, the browser searches for the file in the same location as the current page. To jump to a specific position on an HTML page: <a href="#usingmh">Using My Help File</a> You must use the name attribute to set up the destination for this type of link. To use a picture as a link: <a href="http://www.ann.com"><img src="annlogo.gif"></a> The text or picture between the <a> and </a> tags becomes a hypertext link. You usually see this in blue and underlined. If you click on the link, you move to the destination page or location. You can also use this attribute to link to other web resources such as an FTP site, a gopher server, a newsgroup or a WAIS index server. You can also start a telnet session or open a send mail dialogue box. For example, to allow a user to send mail to you: Contact <a href="mailto:a.gilliver@lineone.net">Ann Gilliver</a> If you want to send mail to more than one person, use commas to separate the addresses. Some browsers allow you to specify the content of various fields so that they are automatically filled in. For example: Contact <a href="mailto:a.gilliver@lineone.net?subject="Subscribe to mailing list">Ann Gilliver</a> Use a question mark to separate the address from the fields and an ampersand to separate each field. hreflang=language Specifies which language the <a> tag uses. You can enter any valid ISO standard language abbreviation, for example, “en” for English, “de” for German and so on. For example, <span lang="es">hola! como esta?</span>. This attribute helps search engines understand different languages as different languages rather than just misspelled English. It may also help spelling and grammar checkers and allow speech synthesizers to use language-dependent pronunciation rules. Specifies a unique name for the tag. No two tags can have the same id on a single page. The value must begin with a letter followed by any alphanumeric character, a hyphen, and underscore, a colon or a full stop. You use it to reference a unique style for a tag or to manipulate the tag with a script. A reference within an HTML page that you can use as a target of a link. You might use the name attribute to jump to specific sections within a page. For example: <h1><a name="printing">Printing documents</h1> You can then jump to this heading from somewhere else in the same page or from another page. <a href="#printing">how to print</a> Note: The reference is case sensitive and it cannot contain spaces. Defines the relationship of a link from the current page to the linked page. The following example indicates that glossary.html is a glossary for the current page: <a href="glossary.html" rel="glossary">...</a> One of:
Specifies the reverse link from the target to the current. The following example indicates that the current page is a subsection of page.html: <a href="page.html" rev="subsection">...</a> The values are the same as for rev. shape=shape-type The shape of the hot spot. The default is a rectangle. One of:
You also need to specify the co-ordinates for the area Specifies style information. See Style sheets for more information. tabindex=n Specifies the position in the tabbing order. A number between 0 and 32767 You can associate a name with browser windows and frames that links can refer to. When you click on the link, the browser displays the destination page in the named window or frame. Only supported by browsers that can handle frames. The target can be one of the following:
For information only. Some browsers display the title when you move the mouse over the tag (like a tool tip). You could use it to give a brief description where the link goes. This may be useful if your link is a graphic. If you enter a title for an anchor, you might want to enter the title of the destination page. Some browsers also use the tile as the subject for the e-mail message if you use the link to send e-mail. |
More information Linking to another page on your site |