Search code examples
htmlhyperlinksemantic-markup

What (semantic?) markup should one use to indicate a known dead link? (clarification: a dead URL displayed as text)


I have a page where I'm going to list several links to sites that are long gone, but may be stored in archives or otherwise be identified by their old URLs. Is there a way I can express this idea in HTML?


Solution

  • I recommend the <s> element. The HTML5 spec says

    The s element represents contents that are no longer accurate or no longer relevant.

    So you could do

    <s class="dead-link">http://example.com/dead-link</s>
    

    By default, the text will typically be struck through, so if you don't want that, add CSS to the effect of

    s.dead-link { text-decoration: none }
    

    By this way, you can add an <a> element around the <s> element if you have a link to an archived copy of the page and thus distinguish that it is the old URL which is no longer accurate, from the archive link, which is.

    Or, if you don't have a link to an archived copy, you can omit the <a> element, and still express the idea that the URL is no longer accurate.