HTML Basics 11/14 Broken


#1

https://www.codecademy.com/en/courses/web-beginner-en-HZA3b/2/3?curriculum_id=50579fb998b470000202dc8b

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>
<html>
	<head>
		<title></title>
	</head>
	<body>
		<img src="https://s3.amazonaws.com/codecademy-blog/assets/f3a16fb6.jpg" />
		<img src="https://s3.amazonaws.com/codecademy-blog/assets/ninja_zpsa5dbe37a.jpg"/>
	</body>
</html>.


#2

Is that full stop in your code?


#3

Do you really need a full stop in your code?


#4

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


#5

That's the default code for the lesson


#6

Exact same problem. No clue...

<!DOCTYPE html>
<html>
	<head>
		<title>Adding Images</title>
	</head>
	<body>
		<img src="http://s3.amazonaws.com/codecademy-blog/assets/f3a16fb6.jpg" />
		<img src="https://s3.amazonaws.com/codecademy-blog/assets/ninja_zpsa5dbe37a.jpg"/>
	</body>
</html>

#7

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?


#8

Same problem with this


#9

Please share your code and we can help.


#10

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.


#11

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.


#12

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


#13

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

img src="https://s3.amazonaws.com/codecademy-blog/assets/ninja_zpsa5dbe37a.jpg" />


#14

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