0

I am wandering what the general rule of doing the above is, my editor still gives me a warning saying that the div is in an invalid location. Most questions regarding this are pushing on for 6 years old. Is it still bad to wrap a div element with an <a> attribute? for example, is the following code an acceptable thing to do now or should it be avoided?

<a href="/somelink.html">
  <div class="fancyBox">
    <p> some content </p>
  </div>
</a>
Chris
  • 103
  • 3
  • 15

1 Answers1

1

Your editor is out of date.

As of HTML 5 (published as a W3C recommendation on 28 October 2014), <div> elements are allowed as child elements of <a> elements.

This wasn't the case in HTML 4.

Quentin
  • 914,110
  • 126
  • 1,211
  • 1,335