I am trying to figure out if the XML styling for void elements is correct for images in HTML 5.

<img src="">


<img src="" />

1 answer

This was chosen as the best answer

You can use either.

http://www.w3.org/TR/html5/introduction.html#html-vs-xhtml has the details.

Answered over 7 years ago by Ben Boyle
  • Yes, but one must be the "more correct" direction of HTML now that we are leaving XHTML. I've always used the XML style - but now that things are changing perhaps it's time I change also. Xeoncross over 7 years ago