Thank you for the clear and detailed explanation.
I understand and noticed that this topic was 44 days ago, however - I think the instructions should specify that you’re replacing the original image and not adding a “transform” image, as this is confusing and frustrating for some of us. The grading system doesn’t care if you have a transform image if it sees anything on the page that it doesn’t like.
For instance, I made the mistake of doing this:
a href=“https://en.wikipedia.org/wiki/Brown_bear” target="_blank"img src="#" alt=“Brown Bears”
When really, it wants you to do this:
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”
But it doesn’t tell you that you did it incorrectly, you just see a broken link on the page.
src attribute we are expecting a URL. When none is available, we use the location hash as a placeholder. If that were a link, with
href="#" when it is clicked the page would scroll to top.
<a href="#">Return to Top of Page</a>
Hello everybody. I jave a quick question about the followng code:
<a href="https://en.wikipedia.org/wiki/Opuntia" target="_blank"><img src="#" alt="A red prickly pear fruit"/></a>
What exactely does the
src="#" mean? I know its ment for the source. But here I don’t quite get it why thert is a # and what it does. As for the rest of the code is clear as day.
Thanks for your help fellas
The hash is a placeholder so the URL is not empty. It is only temporary, though, until an actual URL is written to replace it.
My question is why is the “#” sign used and not something else? Is this “#” sign replacing the whole source, meaning the hyperlink? Is this sign applicable in other cases?
An empty src or href value is invalid HTML, that is why we use a temporary placeholder, and in particular the hash symbol while we compose the document. It is not important to have the URLs in order to render the page. Once the page is composed and looking the way we want, then we can add in the URLs (which tend to take up lots of space and clutter the markup).
In more technical terms, the hash symbol is part of a URL and it represents a page fragment if it is followed by a name, or just the location bar if it is alone.
<a href="#">Top of page</a> <a href="#info">Info</a> <a href="https://www.example.com#info">Example site info</a>
The latter two links refer to the page fragment,
<div id="info"> </div>
Thank you very much. I really appreciate your help.
For anyone still confused about this exercise in 2020…
When they say to wrap the image in the index.html, they don’t mean the relative path under code line no.9 but the general file name - if you look to the top of your workspace you’ll see the name of the sheet is index.html.
There is only one image we’ve put on our page during the course and it’s under Media. So wrap that one up in anchor tag with the url that is given in exercise as a hyperlink reference (href) and add a blank target attribute. And that’s it.