FAQ: Learn HTML - Common HTML Elements - Linking At Will

Lol thank you my man! This was confusing me so much - my brain was immediately looking at line 9! :sweat_smile:

1 Like

Seems like this exercise was validated without using the target attribute/value. You might want to check on this.

Hello,
When I use:
target="_blank"
and
target=_blank

I’m getting the same result. The link opens in new window. I’d like to know which option is more advisable to be used, and why.

1 Like

target="_blank"

Thank you sooo much. Now I get exactly what I was doing wrong.

I keep a Google Doc with all the definitions and various pieces of code

Is it potentially because we’ve added alt to describe the image?

Might be low on coffee, might be another issue entirely. However; I tried resetting this one a few times, and it still says i screwed up something. The link works as intended though.

<a href="https://en.wikipedia.org/wiki/Brown_bear

" target="_blank">

  <img src="https://s3.amazonaws.com/codecademy-content/courses/web-101/web101-image_brownbear.jpg" />

</a>

Can anyone give me a helping hand here before it drives me nuts? Thanks in advance. :slight_smile:

What kind of error are you getting from this?

Thank you so much. I was confused out of my mind. Are you a beginner as well?

1 Like

Yes, I am :smiley: sometimes struggling but always diligent! Good luck :slight_smile:

Which one is correct and why?

  • <img src="" />
  • <img src="">

They’re both correct. The latter applies to a document served as text/html where the former is XML compliant (read up on XHTML) and only applies when the document is served as application/xml. For our purposes, the latter (<img src="">) is the one to use.

After adding this code, does anyone else notice the broken image? (The code went through on the run)

1 Like

Is HTML5 always text/html then? When would a document be served as applicaton/xml?

That is a use case I am not the least familiar with. HTML5 is backwards compatible with both XHTML and HTML 4.0, which means either older recommendation can be switched to HTML5 with a simple change of DOCTYPE, though there is more to it than that.

The slashes are ignored in HTML5 as text/html so won’t do any harm. Most browsers support text/html, if not all. It’s safe to say that we won’t find ourselves in need of the XML flavors unless our employer expects it for an enterprise system with lots and lots of legacy code still present.

1 Like

My correct code is:

39        <h2>Media</h2>
40        <a href="https://en.wikipedia.org/wiki/Brown_bear" target="_blank"><img src="https://content.codecademy.com/courses/web-101/web101-image_brownbear.jpg" />
1 Like

Yes, I’ve done this too and it shows that it’s correct. The only thing missing in the code you’ve shown it’s the closing tag after the element.

Hi @i8czu59 have you had an answer to this. I have the same issue and still trying to figure out.
I thought the image will appear there.

Thanks soo much!! You made it so clear!! They should have said to code under Media!

1 Like