HTML Basics 11/14 Broken


So, it said to
"Add a second image below the first one. (Make sure it's before the closing tag!) If you can't think of a good picture, use this"
And then provided a link. Which I used. (see below) and when I click save and submit I get the following message.

"Oops, try again,"

<!DOCTYPE html>
		<img src="" />
		<img src=""/>


Is that full stop in your code?


Do you really need a full stop in your code?


I am having the same problem and would love to know what is going on with it?


That's the default code for the lesson


Exact same problem. No clue...

<!DOCTYPE html>
		<title>Adding Images</title>
		<img src="" />
		<img src=""/>


One thing we can see is inconsistency in the self-closing of the IMG tags. One has a leading space, the other does not. Could that be the issue?


Same problem with this


Please share your code and we can help.


Roy ( @mtf ) has nailed it in his post above:

For this exercise to pass you need to close the img elements using the following syntax:

<img src="image_url" />

IMPORTANT : Notice the space between the "image_url" and the />

Before HTML5, img elements were closed by using a /> at the end of the element. One version of an old web browser (I think it was Netscape 4) required there to be a space before the /> which meant that web developers included the space as a best practice.

Now with HTML5, img elements are still self-closing but you can omit the forward-slash if you want to, so the syntax becomes:

<img src="image_url">

But this lesson was written a few years ago, and the author decided to stick with the best practice of the time, which was to include the space.


HTML5 served as text/html follows HTML 4 syntax rules, for the most part. This means HTML 4 documents will validate as HTML5 with the exception of a few deprecated/obsolete attributes (and a few tags). This means we can write an image or input, or other self-closing tag as simply,

<img src="" alt="">

It is only when serving HTML5 as XML that we need to conform to that syntax model, the way XHMTL does. For that language the above would be invalid, and must be written,

<img src="" alt="" />

with the leading space before the closing slash. With HTML5, the leading space is optional, and the following is also valid:

<img src="" alt=""/>

What some folks would like to say is required is only the case given the XML conformance requirement when serving as application/xml. Don't let anyone tell you it is a must for our purposes. It is not. Some exercises may require it, but that is up to the author, and may be somewhat misleading. One thing is certain, though, consistency is a best practice, so whatever way we choose to write our self-closing tags should be consistent.


it was the space at the end of the code between the url and the closing /> tag. Good call


place a space between your ...jpg"/> on the second img.

img src="" />


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.