bug-texinfo
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: use <a> for hancors without content, not <span>


From: Jean-Christophe Helary
Subject: Re: use <a> for hancors without content, not <span>
Date: Mon, 27 Dec 2021 08:38:37 +0900


> On Dec 27, 2021, at 6:04, Gavin Smith <gavinsmith0123@gmail.com> wrote:
> 
> On Sun, Dec 26, 2021 at 10:18:55AM -0800, Per Bothner wrote:
>> 
>> 
>> On 12/26/21 10:12, Patrice Dumas wrote:
>>> But there is nowhere where id in a lone element is proposed, so this
>>> argument is not very compelling not to use <a> for that purpose.  <a>
>>> was used for that semantically before, while <span> is explicitely
>>> described as being relevant in relation to its content.  For those
>>> reasons, it still seems to me that <a> is better than <span> and
>>> actually the best choice among elements.
>> 
>> Using <a> this way makes me a little uncomfortable, but
>> I don't have a strong objection.
> 
> As far as I understand the original way to do this in HTML was with
> <a name="NAME"></a> but the "name" attribute has been deprecated (as
> you know) in favour of "id", so using <a id="NAME"></a> would be the
> natural thing to do.

https://www.w3.org/TR/1998/REC-html40-19980424/struct/links.html#h-12.1.3

"When the A element's href attribute is set, the element defines a source 
anchor for a link that may be activated by the user to retrieve a Web resource. 
The source anchor is the location of the A instance and the destination anchor 
is the Web resource."

"When the name or id attributes of the A element are set, the element defines 
an anchor that may be the destination of other links."

>  <a> is the "anchor" tag which can represent either
> the source or destination of a link (maybe confusing terminology but
> that's how the word "anchor" is/was used in the context of hypertext).
> Even if the WHATWG don't endorse it there seems to be clear precedent
> for using <a> this way.  I don't feel strongly either way whether <span>
> or <a> is better but your argument against <span> seems valid.

The accepted way to specify a target is just to use "id" in any element. It 
seems to me that adding an "invisible" <a> just to set a location before the 
element that is the location is adding unnecessary cruft to the html output.

-- 
Jean-Christophe Helary @brandelune
https://mac4translators.blogspot.com
https://sr.ht/~brandelune/omegat-as-a-book/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]