Okay, so we've talked about basic HTML concepts,
we've talked about basic HTML codes and formatting and a little bit CSS.
Now it's time to start talking about slightly more advance topics.
And in this video we're gonna talk about links.
So every website in the world has links and how do you create them?
Well a link Is very easy to do.
First, let's create an tag.
This is Page 1.
And go ahead and save it.
Let's go click Reload.
This is Page 1.
Okay, so let's come up here and right click on this folder and click new file.
And I'm gonna call this page2.html.
And I'm just gonna copy all this, gonna open up Page 2 and change this to Page 2.
So save it.
So how do we link these two pages together?
We've created these two pages, but if we head back over to our website,
they're not linked in any way.
I can't get from one to another.
I can get there by typing in page2 and then it shows up.
But you don't want your users to have to type in things into the Browser to
navigate your website.
So links are the way to do it.
So let's create a link here.
I'm gonna give this a line break.
And to create a link, it's very easy.
You just go <a.
<a is the link tag, href.
href is an attribute.
It's a link attribute.
And then we have a closing tag.
So to do this in this case, we can do it a couple of different ways.
You can create a hard coded link, and
to do that you get the URL, copy it and paste it in there.
And let's call this Page 2.
And this text right in the middle, that's called, anchor text.
And that's the text that's gonna show up on the page.
So if we save this, go back to our Page 1 and hit Reload.
Actually we need another line break.
Let's put two of them in there.
But now if we click Reload, we see this link right here.
If we click on it, it goes to the next page.
Now that's sort of a hard coded URL.
We don't actually need to do all that and I suggest that you don't do that,
because that URL can change.
What you wanna do is just put it like this, or even like that.
And click Save and if we come back here and hit Reload.
Now if we view our page source.
You can see it just says Page 2, but if we click it, boom it goes to Page 2.
So we can copy all of this and open up our page 2.
Paste this in here and let's change this.
Now what would we have for the URL here, we wanna go to our index page.
So that's index.html and
let's call this Home Page.
So if we save this, come back here and hit Reload, now we have this Home Page link.
And we have Page 2 link and we can navigate back and
forth between them on our website.
So that's pretty cool.
So this is an internal link, right?
If we come back to our index page here, we can create external links as well.
Allow us to put that in there.
And let's go <a href equals
http://google.com.
Type in Google, save it, hit Reload.
Go back to our main page.
Now we see we have this link to Google.
If we click it, we leave the website.
An external link, it goes away from our website.
So, internal link looks like this, external link looks like that.
Pretty simple,
you can also sort of tell the web browser to open up another tab, right?
So say for an internal link, you just wanna keep this tab open.
But if somebody clicks on this external link, maybe you wanna open a whole other
web browser, to do that you just designate a target.
And in this one we give this target = blank.
And blank says hey, open up a blank web browser, a whole other web browser.
If we save this and head back to here and click Reload.
So we hit Page 2, nothing happens if we stay on this web browser.
But if we click this Google, boom, you see up here at the top a whole other browser
window opened and our website still is sitting here.
So that's kind of a good thing to do.
I like to do that whenever I'm pointing out an external link away from my website.
I just sort of like something that I like to do.
So those are links, pretty simple, pretty straight forward.
And in the next video, I wanna start to talk about images.