[Top][All Lists]

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

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

From: Patrice Dumas
Subject: Re: use <a> for hancors without content, not <span>
Date: Sun, 26 Dec 2021 19:12:04 +0100

On Sun, Dec 26, 2021 at 09:48:35AM -0800, Per Bothner wrote:
> On 12/26/21 09:33, Patrice Dumas wrote:
> > Hello,
> > 
> > Currently <span id="id"></span> is used for anchors, whether they
> > originate from @anchor, in some cases from @node and sectionning
> > @-commands, @*index, ...  It is syntactically correct, but I think that
> > it would be semantically better to use <a> and keep <span> for inline
> > text that needs some kind of formatting information.
> > 
> > Also I propose to add class to the anchors to distinguish their source.
> > 
> > Any opposition/idea?
> I don't think using <a> for anchors is a good idea.  The WHATHG spec says:
>    "If the a element has no href attribute, then the element represents a 
> placeholder
>    for where a link might otherwise have been placed, if it had been 
> relevant, consisting of just the element's contents."
> https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a does not suggest 
> or give
> any examples of using <a> without an href attribute.

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.


reply via email to

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