Link to External Pages with Anchor Elements question/improvement?

Link to External Pages with Anchor Elements question/improvement?
0.0 0

#1

In the lesson “Link to External Pages with Anchor Elements” I was confuse why my code <p><a href="http://freecatphotoapp.com"> cat photos</a></p>'was not working. After some troubleshooting I was able to determine, after pasting the code into Notepad++ and seeing there as a space in the example code, I changed it to <p> <a href="http://freecatphotoapp.com"> cat photos</a> </p> with a space between the ‘a’ and ‘p’ elements. Did I miss this in an earlier lesson, am I being to nit picky, or should the lesson be updated to reflect that there should be a space between these elements? I am used to OS and cisco CLI so this type of code is new to me.


#2

I don’t know what code you were using when it didn’t pass, but you don’t need a space between the a and p elements. You can put that anchor tag pretty much anywhere and pass.


#3

I notice in the next lesson they address that there should be a space. LOL sorry that the code I pasted actually worked since it is HTML.


#4

Could it be just in the FreeCodeCamp emulation since it is such a stickler for syntax that it would not let it pass?


#5

I tried jamming the anchor tag all over the place to try to reproduce your problem, but couldn’t find it. Sometimes there are weird errors on the HTML challenges where tests don’t re-run on submit, so you might have hit one of those. Or you might have had a small typo somewhere that you didn’t notice fixing.


#6

i can’t find the wrong in my code according to 1st instruction ‘Your a element should have the anchor text of “cat photos”.’ , anybody help ?

<a href="http://freecatphotoapp.com"><img class="smaller-image thick-green-border" src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back. "></a>

#7

I cleaned up your code.
You need to use triple backticks to post code to the forum.
See this post for details.

Shouldn’t the there be the text cat photos instead of an <img>? Which challenge is this?


#8

Where do you have the anchor text “cat photos”?


#9

i just spent 45 minutes on this exact problem.
codecamp insists on spaces between the elements for some reason
i had tried wrapping the anchor inside paragraph tags, on its own, on different parts of the page…and got nothing.
when i read this post, i tried deleting every space i could find, and then it just worked.

Don’t know where the problem was exactly, as the markup reverted to its previous state as soon as the test was confirmed…see rectangle in graphic, which now resembles the markup exactly as i previously typed it (i.e. the spaces i had to add in to make it work, were removed)

in the graphic, you can also see that the link was showing fine in the status bar, it also opened (in another tab) when clicked,

the oval shows where the error was continually showing (this pic obviously taken after the correction was made to the spaces)

.