These forums are currently read-only due to receiving more spam than actual discussion. Sorry.

It is currently Sat Dec 02, 2017 4:21 pm Advanced search

Death of the <a> element.

Here you can discuss things related to HTML and the Web in general that do not fit in to other categories.

Death of the <a> element.

Postby wgabrie » Thu Apr 19, 2007 7:13 pm

The <a> tag is used to create links and anchors. I see a common trend towards killing the <a> tag. First, WHATWG is keeping the <a> for links but the dfn tag can be used to mark an anchor. Next, the W3.org is adding link abilities to all of their xhtml 2.0 tags. So, the <a> isn't needed.

Why is everyone hostile to the <a> tag? Has it served us badly? :shock:

Moderator Edit: There are no such things as "tags" in (X)HTML. Please use the correct terminology, thanks! - JAB Creations
wgabrie
<h4>
 
Posts: 25
Joined: Thu Apr 05, 2007 8:55 pm

Postby anne » Tue Apr 24, 2007 1:44 pm

HTML5 still has <a> for links. <a> for "anchors" is quite old though. Since HTML4 you can specify the id= attribute on each element which makes it sort of an "anchor". No need for <a name>.
User avatar
anne
<h4>
 
Posts: 32
Joined: Tue Feb 06, 2007 11:17 pm
Location: Utrecht, NL

Postby Cowboy_X » Wed Apr 25, 2007 8:31 pm

hm, I just registered here so I could ask this same question. The XHTML 2 group sez:
Linking: In HTML 3, only a elements could be the source and target of hyperlinks. In HTML 4 and XHTML 1, any element could be the target of a hyperlink, but still only a elements could be the source. In XHTML 2 any element can now also be the source of a hyperlink, since href and its associated attributes may now appear on any element. So for instance, instead of <li><a href="home.html">Home</a></li>, you can now write <li href="home.html">Home</li>. Even though this means that the a element is now strictly-speaking unnecessary, it has been retained.


This strikes me as extremely sensible. I find myself resorting to "onclick=document.location..." javascript calls all the time due to creative formatting and other issues. There's no reason why anything in a web page couldn't simply be a link.

What are WHATWG's thoughts?
Cowboy_X
<h6>
 
Posts: 1
Joined: Wed Apr 25, 2007 8:28 pm

Postby Cerbera » Sat Apr 28, 2007 12:28 pm

Anne's article Problems with letting every element be a link gives some reasons why you might not want every element to be linkable.

I think backwards compatibility is the most obvious and important reason to retain <a>, particularly <a href>.
Cerbera
<h4>
 
Posts: 34
Joined: Wed Feb 21, 2007 1:04 pm

Postby Sander Aarts » Thu May 10, 2007 8:11 pm

How about nested 'links' if all elements can be links?
Sander Aarts
<h5>
 
Posts: 15
Joined: Sat May 05, 2007 12:19 am
Location: +31(0)13

Postby Xano » Fri May 11, 2007 2:34 pm

I'm looking at it like this: If the A tag is going to be 'deprecated', why not do the same with elements like ABBR? Just like <span href="/">Root</span> you could do <span title="Web Hypertext Application Technology Working Group">WHATWG</span> too.

Just a matter of keeping thing overseeable for me. I'm a n00b at these things, but I hope someone can explain this to me :)
Xano
<h6>
 
Posts: 5
Joined: Fri May 11, 2007 2:29 pm
Location: Almelo, The Netherlands

Postby Cerbera » Sat May 12, 2007 3:57 am

AFAIK, WHATWG do not intend to remove <a> from (X)HTML5.

I think <span title> and <abbr title> have very different meanings:
  • The former is just an inline level grouping element which has a title providing supplemental information.
  • The latter is an abbreviated form of a term, the expanded form of which is present in the title attribute.
The more sophisticated screen readers already make use of this distinction. A user may set all abbreviations to be expanded automatically. This works fine in pages where <abbr> is used correctly. But if abbreviations had to be done using <span>, automatic expansion of all <span> elements could mean the user gets supplemental information instead of useful non-abbreviated content whenever <span> was used for a different purpose.
Cerbera
<h4>
 
Posts: 34
Joined: Wed Feb 21, 2007 1:04 pm

Postby Xano » Sat May 12, 2007 8:48 am

Good point. Thanks for the explanation.
Xano
<h6>
 
Posts: 5
Joined: Fri May 11, 2007 2:29 pm
Location: Almelo, The Netherlands

Postby bfrohs » Wed May 16, 2007 9:42 pm

I don't remember exactly where I read it, but it was said that adding a href attribute to all (or many, considering that <input> with a type of text would not want to have a href attribute) would be very difficult to implement into browsers. I'm not going to say whether or not this is true, because I honestly don't know, but I read it earlier today when researching (X)HTML 5. Also, the other problem would be choosing which tags to allow to have the href attribute.

Even with these problems, I would love to see it implemented into at least a few tags, such as <li> and <acronym>.
bfrohs
<h4>
 
Posts: 28
Joined: Wed May 16, 2007 7:44 pm
Location: Kalkaska, Michigan, United States

Postby Pacoup » Mon Aug 18, 2008 2:52 pm

Note that in Anne's blog article about the href everywhere being bad I quote:
The specified algorithm for HTML parsing supports putting the a element around paragraph (block) level elements. It’s just the definition of the element that forbids this at the moment, but that should be fixable.

This is wrong in every possible way. Why would anyone need to put an <a> around <p> tags when they can just enclose the text in it. If you want to make the same link with two paragraphs, I admit it would be useful though.

But in any cases, as far as content logic goes, linking a huge chunk of text is ugly and shouldn't even be allowed. Anyone thinks so?

However, I admit that some elements should have the ability to possess an href. Much the same as XHTML 2, some other elements should have the ability to possess images. The <object> tag is a good idea. <img> and <li> could well contain an href. And that doesn't forbit backwards compatibility. It would just be a question of conforming to a new, not backwards compatible method, or sticking to the old.

So instead of forcing a spec on the industry, the industry's entities would choose what they want to use, much like choosing between HTML or XHTML serializations.

Anyone thinks this would eventually make HTML 5 bloated for nothing? Problems of who's teaching what could eventually arise also. What do you think?
User avatar
Pacoup
<h5>
 
Posts: 12
Joined: Mon Aug 18, 2008 2:20 pm
Location: Canada, Ontario, Ottawa

Postby Aidan » Fri Aug 29, 2008 10:36 am

Hi
This is my old code:
Code: Select all
<html>
(...)
<body>
<a name="up"></a>
(...)Few pages of text(...)
<a href="#up">Go to the up</a>
</body></html>

I want to make it waild with html5.
I know I must remove "<a name="up"></a>" but what i should use to replace it?

Yes I know my english is not good.
Aidan
<h6>
 
Posts: 2
Joined: Sat Jun 23, 2007 1:26 pm
Location: Poland

Postby zcorpan » Fri Aug 29, 2008 10:57 am

Aidan wrote:Hi
This is my old code:
Code: Select all
<html>
(...)
<body>
<a name="up"></a>
(...)Few pages of text(...)
<a href="#up">Go to the up</a>
</body></html>

I want to make it waild with html5.
I know I must remove "<a name="up"></a>" but what i should use to replace it?

Yes I know my english is not good.
You could replace it with <a id='up'></a> or even <body id='up'>.
zcorpan
<article>
 
Posts: 807
Joined: Tue Feb 06, 2007 8:29 pm
Location: Sweden

Postby Aidan » Fri Aug 29, 2008 2:44 pm

zcorpan:thx. it is working.
Aidan
<h6>
 
Posts: 2
Joined: Sat Jun 23, 2007 1:26 pm
Location: Poland

Postby JAB Creations » Mon Sep 01, 2008 11:25 am

1.) There is no such thing as a "tag", the correct terminology is element.

2.) Unless you're targeting an anchor to give it focus there is very little other reason you should not be giving it an id.

3.) <all_elements href="virus.exe" /> is retarded.

HTML5 looks like it's not just going to BREAK the web but destabilize the standards professional web designers have been pressing for if people who have no professional sense of (X)HTML and CSS start having their way with HTML5. I also question the direction XHTML 2 is headed. XHTML 1.1 is the only way to go right now of course with fall back to 1.0 Strict for those waking up at noon...err four...no...sunset?
User avatar
JAB Creations
<aside>
 
Posts: 566
Joined: Tue Mar 13, 2007 4:48 am
Location: Sarasota Florida, USA

Postby troxy » Tue Sep 02, 2008 12:04 am

JAB Creations wrote:1.) There is no such thing as a "tag", the correct terminology is element.

The words tag and element are not interchangeable.
We use tags to build elements. For example, here we have two tags (start- and end-tag), which forms the a-element:
Code: Select all
<a href="http://www.whatwg.org/">WHATWG</a>

JAB Creations wrote:I also question the direction XHTML 2 is headed

Well, to me it seems like XHTML 2 is heading nowhere at all.
troxy
<h6>
 
Posts: 1
Joined: Mon Sep 01, 2008 11:48 pm

Next

Return to General Discussion

Who is online

Users browsing this forum: No registered users and 1 guest