www.webdeveloper.com
Results 1 to 2 of 2

Thread: [RESOLVED] Empty anchor element

  1. #1
    Join Date
    Mar 2003
    Posts
    262

    resolved [RESOLVED] Empty anchor element

    Is the empty anchor valid HTML element?

    <a href="/" id="home-link" title="Home"></a>

    Originally code was

    <div id="header">

    <a href="/" id="home-link">Home</a>

    </div>

    but I modified it, since dont want display 'Home' text.
    Taurus

  2. #2
    Join Date
    May 2008
    Posts
    381
    Yes, it is valid HTML. Any element that can contain text doesn't necessarily need text.

    Edit: You should note that not all browsers can find them, however. An excerpt from the HTML4 recommendation (scroll up a little bit in the document to see it in green text):
    Note. User agents should be able to find anchors created by empty A elements, but some fail to do so. For example, some user agents may not find the "empty-anchor" in the following HTML fragment:

    <A name="empty-anchor"></A>
    <EM>...some HTML...</EM>
    <A href="#empty-anchor">Link to empty anchor</A>
    Last edited by rpgfan3233; 11-24-2008 at 06:30 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles