...

View Full Version : How To Code An Anchor...?



Daniel_A_Varney
07-13-2011, 12:51 AM
Tip: In XHTML, the name attribute of the <a> tag is deprecated, and will be removed. Use the id attribute instead.

So how do I write an anchor in my code?

alykins
07-13-2011, 12:52 AM
still <a> ... they are saying you cannot do <a name="whatever"> use <a id="whatever">

Daniel_A_Varney
07-13-2011, 02:18 AM
So, do I still use:

<a href="page1.htm#here">Click here</a>

while using:

<a id="here">Bookmark</a> ?

It's just name exchanged for id, is it?

Thank you.

Apostropartheid
07-13-2011, 02:02 PM
So, do I still use:

<a href="page1.htm#here">Click here</a>

while using:

<a id="here">Bookmark</a> ?

It's just name exchanged for id, is it?

Thank you.

Yes. The only time you could be using name is for forms.

VIPStephan
07-13-2011, 02:06 PM
So, do I still use:

<a href="page1.htm#here">Click here</a>

while using:

<a id="here">Bookmark</a> ?

It's just name exchanged for id, is it?

Thank you.

In fact, you don’t need anchors as – well – anchors, you can link to any element with an ID. For example:


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title></title>

</head>
<body>
<div id="container">
<div id="header">…</div>
<hr />
<div id="content">…</div>
<hr />
<div id="footer">

<a href="#container">link</a>
</div>
</div>
</body>
</html>

The link would make the page jump to the element with ID “container”, e. g. the top.

abduraooft
07-13-2011, 02:07 PM
Wait.. you shouldn't use an extra anchor tag to specify the target of another anchor. You may set the id attribute on any element, and target it using an anchor with #<id> in the href. See http://www.w3.org/TR/html4/struct/links.html#h-12.2.3

rosesmark
07-13-2011, 02:19 PM
Opens In Same Browser Window

1.The <a> tag in html code is an Anchor Text Tag. The following example will provide some common uses of the <a> Anchor Tag.

In html you begin the <a> Anchor Tag with:

<a href=”http://yourdomain.com”>

You close the html Anchor Tag with:

</a>
The end of this 1st step looks like this:
<a href=”http://yourdomain.com”>Your Anchor Link Text Goes Here</a>
This is one way that this anchor text Hyperlink will finally look (Could Depend on Cascading Style Sheets-CSS):

Your Anchor Link Text Goes Here

Cut & Paste the following into your html editor and modify the information:
<a href=“http://yourdomain.us”>Change the Domain URL then place your Keyword Rich Text Here!</a>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum