Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8229455
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T16:47:59+00:00 2026-06-07T16:47:59+00:00

Context: Currently, Wt (Web Toolkit) will render a WAnchor object as a <span> tag

  • 0

Context: Currently, Wt (Web Toolkit) will render a WAnchor object as a <span> tag rather than an <a> tag if the link that the anchor should point to, is empty.

However, there are some problems with this approach, notably that it adds unnecessary complexity to CSS styling (when using Twitter Bootstrap, for example).

I’ve been involved in a discussion with one of the Wt developers proposing a patch to change this behavior: http://redmine.emweb.be/issues/1348

He noted that the current behavior was implemented as a result of certain browsers having problems rendering <a> tags without an href attribute (possibly older mobile browsers?).

According to the official HTML specifications, there is no problem with this:

  • http://dev.w3.org/html5/spec/single-page.html#the-a-element 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.
  • http://www.w3.org/TR/html401/struct/links.html#edef-A Authors may also create an A element that specifies no anchors, i.e., that doesn’t specify href, name, or id. Values for these attributes may be set at a later time through scripts.

And as far as I am aware…

<a>Link</a> // OK
<a href>Link</a> or <a href="">Link</a> // Undefined? (but common behavior is to navigate to the current URL)
<a href="/items">Link</a> // OK

I also checked the following document with the W3C HTML5 validator:

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<a>Example of an anchor with no href attribute.</a>
<a href>Example of an anchor with a null href attribute.</a>
<a href="">Example of an anchor with an empty string href attribute.</a>
<a href="http://www.google.com/">Example of an anchor that links to Google.</a>
</body>
</html>

I received one warning:

Line 9, Column 8: Attribute href without an explicit value seen. The
attribute may be dropped by IE7. <a href>Example of an anchor with a
null href attribute.</a>

So my question is: are there any known situations where the total lack of an href attribute on an <a> tag causes problems in certain browsers? IE? Mobile Safari?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T16:48:01+00:00Added an answer on June 7, 2026 at 4:48 pm

    An a element without an href attribute has always been valid in HTML, and there is no reason to expect any browser to have an issue with this. Such an element is effectively similar to span, i.e. lacks any semantics. Traditionally <a name="...">...</a> has been used to set up a destination anchor, usually without an href attribute, and such elements work across browsers, though it is more modern and recommendable to use the id attribute (on any element).

    Using href="" is formally correct, with an empty URL, which is interpreted as same-document reference.

    Using href without any value is invalid according to current HTML specs. By HTML5 drafts, it can be used in HTML serialization and it is equivalent to href="". There is no guarantee that browsers behave that way.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am currently creating a web application that will be deployed in an intranet
In Apress Pro Android 4 the author has said that: [...] context of currently
I currently have a web application that is utilizing Spring Security hosted on a
We have a web application that uses Spring (3.0.5) and CXF (currently 2.4.2 for
Background: We are developing a web application that includes charts. Currently one can left-click
I'm currently building a Web Service that sends files this also obtains the mime-type
I have a web app that currently uses the current HttpContext to store a
I currently have a web application project that also includes web services within the
I am currently working on an advanced web application that contains a number of
Let's say I have a web page that currently accepts a single ID value

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.