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

  • SEARCH
  • Home
  • 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 6920745
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T10:11:14+00:00 2026-05-27T10:11:14+00:00

So according to the w3c validation tool, wrapping a div (especially one which floats)

  • 0

So according to the w3c validation tool, wrapping a div (especially one which floats) with an anchor tag is incorrect markup. Although this works in every browser tested so far (includes most phones and tablets), is there a better way to do this?

I found that you can use the HTML4 < button > with block-level content, which I can use and make work just fine. But what is the correct way to make these into a link? I would prefer to not use javascript for these links.

I considered using a < form > tag with an action, which is a lot of extra markup for such a simple task, but Internet Explorer 6 does not recognize the button as a submit button, so the link is still dead without javascript. To make matters worse, some links should open in a lightbox – with javascript I could just event.preventDefault(), but how do you accomplish this with a form?

Is there a better way to make a link out of block-level elements? Or should I just ignore the validation since this still works in nearly all browsers (if not every single one)?

(Using HTML4, but HTML5 solutions are welcome)

  • 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-05-27T10:11:15+00:00Added an answer on May 27, 2026 at 10:11 am

    Validators certainly do flag links wrapped around block-level elements in (X)HTML4 as invalid, but this has become something of an artificial use-case. Surrounding a block-level element with a tags is such a common and well-supported practice (even in older browsers) that you really needn’t worry about its invalidity.

    The HTML5 spec includes near-arbitrary link wrapping. In other words, you can surround many elements, block-level and inline, with a single pair of a tags and the browser can apply the link target to each element between the tags as it sees fit. Bruce Lawson wrote a nice summary of the changes to link behavior on HTML5 Doctor.

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

Sidebar

Related Questions

Is a div inside a table allowed or not according to W3C?
Is there any deprecated elements and properties checker (according to w3c) like w3c validator?
According to W3C standards, if you have a nillable element with a nil value,
According to the info in: Which values browser collects as a postback data? the
According W3C XML specification, element is declared in form of : [45] elementdecl ::=
So the autocomplete=off attribute is invalid HTML according to the w3c. Are there valid
I have a div named footerWrap, which contains 3 unordered lists. I floated left,
According the validator w3c, the scrolling attribute on the iframe element is obsolete. It
Will a tag like <span id=suchAndSuch class=blah rel=this.that.other name=this.name></span> or <div id=suchAndSuch class=blah rel=this.that.other
I just learned, here , about nxml-mode , which, according to the README, is

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.