Help with "2. HTML Content" 9/15


#1

Greetings community :slight_smile:

I am doing 2nd step "HTML Content" and I was wondering regarding "alt" element.
Where am I suppose to use it?

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

In the code above I need to add "alt" element:
src="#" alt="A brown bear"

Now i was wondering...does it need it look like this:
< img src="https://s3.amazonaws.com/codecademy-content/courses/web-101/web101-image_brownbear.jpg" src="#" alt="A brown bear"/>

(when I type the code like this, it says "Duplicate of attribute name [src] was found.") Is this wrong?
Although the Instructions mark the code above to be OK and I can move on with the exercise. I am just wondering if this is the correct way, or there is another one? I am just confused about the "duplicate attribute" part.


#3

I think I got it :smiley: all I need to do is add alt="A brown bear" WITHOUT src="#" right? I think that is it. I was confused about src="#" it stands for the img url right? I thought I needed to add that as well, but I guess I was wrong :slight_smile:


#4

yes src="#" shouldn't be there as you already have the source with the URL

Quick explanation:

src you need to specify its source thus you put in the image URL
alt is alternative text, so if the image doesn't load then alternative text will be shown, alternative text is used for many other uses as well..


#5

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