HTML links doubt


#1


I dont know why the second image is not appearing here in the forum but in the codeacademy editor it appears. My question is: when i write <a href="url" , Do i need to write http://? Or can i just write www.thewebsiteiwanttouse.com? Because it seems to work either way.


HTML Basics part 12


<!DOCTYPE html>
<html>
	<head>
		<title></title>
	</head>
	<body>
	<a href="https://www.quora.com/"
	<img src="https://s3.amazonaws.com/codecademy-blog/assets/f3a16fb6.jpg" />
	
	<img src="http://orig09.deviantart.net/96a5/f/2009/361/1/e/majin_vegeta_by_aznfanaticwarrior.png" />
	
	</body>
</html>


Replace this line with your code.


#2

you should use http(s).

Uhm.. your <a> opening tag is missing the > and the closing tag (</a>) seem to be missing altogether.


#3

But in the instructions it says that when inserting a link, he first "<a" tag doesnt have the ">"closing tag. But yes i am missing the closing "</a>" tag.


#4

that is not possible, <a> should still have a closing >:

<a href="url">click me</a>

#5

Oh yes sorry i didnt explain my self very well. I meant it didnt have it right after the "a" like in other tags such as "p" or "h3".


#6

what? no? if you add attributes (like href) the > should be after the attribute, paragraphs can also have attributes:

<p style="color: red">i am a paragraph</p>

see how the > is after the attribute? (in case it isn't obvious, this will make the text red)

attributes are in essences added to opening tag (like <a> or <p>) which means they come before the closing > of the opening tag


#7

I understand now. Sorry but its my first time learning code in my life, I didnt understand what the attribute is. The attribute is what's between the tag right?


#8

attributes are things we add to opening tag, so far you have seen 3:
href
src
and i just showed you style

so anything which is added to opening tag, is an attribute. There are obviously more, which you will learn while you progress through the course


#9

Wait about the http part. In the examples of the instructor it shows <a href="https://www.codecademy.com" but if i write just www.codeacademy.com it still works. So is the "https://" part actually important?


#10

the code will work in both cases (it is a valid url), but if you right click the linked image, and select: open in new tab, only the one with http(s) will work, since then codecademy it has to open a specific webpage, where www.codecademy.com it thinks it need to open the file called www.codecademy.com from the same directory as the current page. Bit tricky maybe a bit for now, read this later again :stuck_out_tongue:

Both will work to pass the exercise, that is important for now


#11

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