All language subtitles for 018 HTML Links and Anchor Tags.en_US

af Afrikaans
sq Albanian
am Amharic
ar Arabic Download
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bn Bengali
bs Bosnian
bg Bulgarian
ca Catalan
ceb Cebuano
ny Chichewa
zh-CN Chinese (Simplified)
zh-TW Chinese (Traditional)
co Corsican
hr Croatian
cs Czech
da Danish
nl Dutch
en English
eo Esperanto
et Estonian
tl Filipino
fi Finnish
fr French
fy Frisian
gl Galician
ka Georgian
de German
el Greek
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
hu Hungarian
is Icelandic
ig Igbo
id Indonesian
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
km Khmer
ko Korean
ku Kurdish (Kurmanji)
ky Kyrgyz
lo Lao
la Latin
lv Latvian
lt Lithuanian
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mn Mongolian
my Myanmar (Burmese)
ne Nepali
no Norwegian
ps Pashto
fa Persian
pl Polish
pt Portuguese
pa Punjabi
ro Romanian
ru Russian
sm Samoan
gd Scots Gaelic
sr Serbian
st Sesotho
sn Shona
sd Sindhi
si Sinhala
sk Slovak
sl Slovenian
so Somali
es Spanish
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
te Telugu
th Thai
tr Turkish
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu
or Odia (Oriya)
rw Kinyarwanda
tk Turkmen
tt Tatar
ug Uyghur
Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated: 1 00:00:00,420 --> 00:00:04,410 Now, if we compare our current site against Jon Kleinbergs, 2 00:00:04,410 --> 00:00:09,410 the only major difference that you will see now is that his has a whole bunch 3 00:00:09,990 --> 00:00:13,260 of hyperlinks interspersed in the homepage 4 00:00:13,500 --> 00:00:16,980 whereas ours is completely devoid of any hyperlinks. 5 00:00:17,370 --> 00:00:20,700 If we think back to what HTML stands for, 6 00:00:20,790 --> 00:00:23,460 we've talked about the markup language part already 7 00:00:23,700 --> 00:00:27,900 but we haven't yet talked about the hypertext part of HTML. 8 00:00:28,230 --> 00:00:32,820 So hypertext is basically just a bunch of text documents that can be linked 9 00:00:32,820 --> 00:00:37,020 together using these hyperlinks. So when you click on one of them, 10 00:00:37,260 --> 00:00:39,540 it takes you to a different text document, 11 00:00:39,900 --> 00:00:44,250 and then you click on the link there and it takes you to another different text 12 00:00:44,250 --> 00:00:48,660 document. And that's where the HT part of HTML comes from. 13 00:00:48,960 --> 00:00:53,610 And in fact, if you're interested, there is even a game called the Wiki game 14 00:00:53,910 --> 00:00:54,060 where 15 00:00:54,060 --> 00:00:59,060 you have a starting Wikipedia article and a goal Wikipedia article 16 00:00:59,520 --> 00:01:04,520 and you have to click through the links on Wikipedia to try and navigate to the 17 00:01:05,490 --> 00:01:06,720 goal article. 18 00:01:06,960 --> 00:01:11,430 And it's basically an association game that's played using hyperlinks. Now, 19 00:01:11,430 --> 00:01:13,710 what are these links made of? 20 00:01:14,040 --> 00:01:17,010 If you have a look at each and every one of these links, 21 00:01:17,280 --> 00:01:20,850 if you right click on it and click inspect, you know 22 00:01:20,850 --> 00:01:25,470 that you can bring up the Google Chrome developer tools. And if we have a look, 23 00:01:25,530 --> 00:01:28,800 you can see that it's actually pointing towards a 24 00:01:29,070 --> 00:01:34,070 a-tag with a hyperlink reference to the destination that this link is going to 25 00:01:34,740 --> 00:01:39,720 take you to. And before the a tag gets closed, that's the link text 26 00:01:39,750 --> 00:01:44,130 so in this case it's the word computer science that gets underlined. 27 00:01:44,160 --> 00:01:47,640 And when you click on it, it takes you to cs.cornell.edu. 28 00:01:48,390 --> 00:01:51,720 Let's go ahead and implement this for our website. 29 00:01:52,200 --> 00:01:56,220 So there's many places where maybe you'd want to direct people away. 30 00:01:56,520 --> 00:01:59,910 So maybe I can link them to the App Brewery's website here, 31 00:02:00,390 --> 00:02:05,390 or I could show them examples of me brewing beer or me riding motorcycles. 32 00:02:07,260 --> 00:02:09,300 Let's go ahead and try that in code. 33 00:02:09,570 --> 00:02:14,570 So the first place that I want to add a link to is this part where it says the 34 00:02:14,880 --> 00:02:16,860 App Brewery. So I'm going to put an 35 00:02:16,890 --> 00:02:20,820 a tag or an anchor tag just in front and close the 36 00:02:20,820 --> 00:02:22,350 a tag just behind. 37 00:02:22,710 --> 00:02:26,010 And if you want to have a look at the structure of the anchor tag, 38 00:02:26,250 --> 00:02:30,270 then as you remember, you can always go to the MDN web docs 39 00:02:30,720 --> 00:02:35,130 and you can read all about the anchor element and all of its attributes. 40 00:02:35,790 --> 00:02:39,930 Now, the main attribute that we're going to be concerned with is the href. 41 00:02:40,260 --> 00:02:44,280 And this is a URL that the hyperlink is going to point to, 42 00:02:44,580 --> 00:02:47,790 or the destination of that hyperlink. In my case, 43 00:02:47,820 --> 00:02:51,360 the destination is going to be appbrewery.co. 44 00:02:52,320 --> 00:02:53,760 And if I just copy that, 45 00:02:54,360 --> 00:02:57,540 then I can head over here and add an 46 00:02:57,750 --> 00:03:02,750 a tag or an anchor tag just before where it says the App Brewery and this is 47 00:03:04,240 --> 00:03:07,320 what the autofill is going to write for me. 48 00:03:07,530 --> 00:03:11,940 So let's have a look at the structure in a bit more detail. As with the other 49 00:03:11,940 --> 00:03:12,840 HTML elements 50 00:03:12,840 --> 00:03:17,250 we've seen, the anchor tag has the a as the element name, 51 00:03:17,640 --> 00:03:20,940 and then the most important attribute that you're going to find yourself using 52 00:03:20,970 --> 00:03:22,170 is the href 53 00:03:22,560 --> 00:03:27,150 and this is set to equal the link destination. 54 00:03:27,390 --> 00:03:31,680 So where are you going to take your user when they click on this link? 55 00:03:32,130 --> 00:03:35,250 And the anchor tag is not a self-closing tag. 56 00:03:35,520 --> 00:03:40,520 So it has a closing tag at the end and between the open tag and the closing tag 57 00:03:42,060 --> 00:03:44,130 is our link text. 58 00:03:44,550 --> 00:03:48,750 So that's the bit of text that's going to be underlined and highlighted in blue 59 00:03:49,140 --> 00:03:52,200 so that the user knows that when they click on this word, 60 00:03:52,470 --> 00:03:56,610 this is going to take them to that link. So in our case, 61 00:03:56,640 --> 00:04:01,640 our href is going there to be this URL and between the open anchor tag and 62 00:04:04,770 --> 00:04:08,790 the closing anchor tag, we're going to put the link text, 63 00:04:08,820 --> 00:04:12,690 so the bit of text that's going to be underlined. And in my case, 64 00:04:12,720 --> 00:04:17,720 I'm just going to cut this phrase here and put it inside the anchor tag. 65 00:04:21,150 --> 00:04:26,150 So now you can see there's actually two sets of HTML elements that enclose this 66 00:04:26,910 --> 00:04:31,890 line of text. It is simultaneously going to be strong, 67 00:04:31,950 --> 00:04:33,060 i.e. bolded. 68 00:04:33,540 --> 00:04:38,540 And it's also going to act as a link to the appbrewery.co website. 69 00:04:39,840 --> 00:04:44,840 So if we hit save and let's go back over here and hit refresh, 70 00:04:45,180 --> 00:04:50,180 you can see that this has now been underlined and it's highlighted in a 71 00:04:50,550 --> 00:04:53,190 different color. Now by convention, 72 00:04:53,250 --> 00:04:58,250 the highlight is going to be blue if its a link that we've never clicked on and 73 00:04:58,380 --> 00:05:02,400 it's going to be purple if we have clicked on it in the past. 74 00:05:02,580 --> 00:05:04,950 And just to confirm, if we click on it, 75 00:05:05,220 --> 00:05:08,550 it takes us to appbrewery.co. Brilliant. 76 00:05:08,700 --> 00:05:11,700 So that is working as expected. Now, 77 00:05:11,730 --> 00:05:16,350 why don't you go ahead and add some links to your hobbies? 78 00:05:16,680 --> 00:05:18,780 So you know how they say in interviews, 79 00:05:18,780 --> 00:05:22,830 you should always prove that you've done what you say you've done. 80 00:05:22,920 --> 00:05:24,450 Go ahead and add some links 81 00:05:24,480 --> 00:05:28,260 maybe to images on the internet or to YouTube videos, 82 00:05:28,440 --> 00:05:31,890 anything that you like. Um, and it doesn't have to be in your hobbies. 83 00:05:31,920 --> 00:05:35,880 It could be in your books and teaching or education or any part of your 84 00:05:35,880 --> 00:05:40,500 website basically. So go ahead and the video and add some more links. 85 00:05:44,010 --> 00:05:47,190 So adding links to the ordered list 86 00:05:47,310 --> 00:05:51,690 or the unordered list is exactly the same as what we've done up here. 87 00:05:52,110 --> 00:05:56,310 So I'm going to go ahead and add an anchor tag to beer brewing. 88 00:05:56,730 --> 00:06:00,440 Then I'm going to hit enter to create my anchor tag. 89 00:06:00,830 --> 00:06:05,690 I'm going to put the words beer brewing in between my anchor tag so that 90 00:06:05,690 --> 00:06:07,670 that will act as the link text. 91 00:06:08,060 --> 00:06:13,060 And my href is going to be a YouTube video that I've got where I show people my 92 00:06:15,260 --> 00:06:16,093 beer brewing. 93 00:06:16,700 --> 00:06:20,960 So let's go ahead and copy that and paste it into here. 94 00:06:21,680 --> 00:06:26,680 And then I'm going to add another anchor tag here just to fill up the motorcycle 95 00:06:28,280 --> 00:06:28,660 part. 96 00:06:28,660 --> 00:06:29,493 All right. 97 00:06:33,850 --> 00:06:35,950 All right. So now I've added two links, 98 00:06:35,980 --> 00:06:40,980 one for beer brewing and one for the word motorcycles, 99 00:06:41,590 --> 00:06:43,810 both inside my ordered list. 100 00:06:44,050 --> 00:06:47,650 So if we hit save and we hit refresh then you'll see 101 00:06:47,650 --> 00:06:52,060 we've now got two links and they are blue because we've never clicked on it 102 00:06:52,060 --> 00:06:52,840 before. 103 00:06:52,840 --> 00:06:57,840 So if I hold down the command button on my keyboard or control on Windows and 104 00:06:58,270 --> 00:07:00,280 click on each of these links, 105 00:07:00,610 --> 00:07:05,610 then they'll open up in new tabs and we can have a look at my evidence that I 106 00:07:06,460 --> 00:07:10,780 have indeed done some beer brewing or motorcycling. 107 00:07:11,500 --> 00:07:14,020 Now that we've seen how to create some anchor tags 108 00:07:14,020 --> 00:07:16,600 that point to links on the internet, 109 00:07:17,230 --> 00:07:20,980 what if I wanted to create a separate page for the 110 00:07:20,980 --> 00:07:25,980 my hobbies section and I wanted to create a link that linked to my own page? 111 00:07:27,190 --> 00:07:32,190 Let's head back into Atom and inside this HTML personal site folder where we've 112 00:07:35,020 --> 00:07:36,580 got our index.html, 113 00:07:36,580 --> 00:07:40,720 so this file, I'm going to right-click and I'm going to click new file. 114 00:07:41,140 --> 00:07:44,560 And the new file is going to be called hobbies.html 115 00:07:45,490 --> 00:07:50,200 and it's going to be created inside the same folder as index. 116 00:07:50,200 --> 00:07:54,940 So you can see they're the same hierarchical level. Now for hobbies.html 117 00:07:54,940 --> 00:07:59,940 I'm first gonna add the HTML boilerplate code and the title is going to be My 118 00:08:00,250 --> 00:08:03,580 hobbies. In the body 119 00:08:03,610 --> 00:08:08,610 I'm just going to copy all of this and I'm going to hit command + X or control + X 120 00:08:10,120 --> 00:08:13,660 to cut, and then I'm going to paste it over here. 121 00:08:13,810 --> 00:08:18,810 So now if I hit save for hobbies and I go back to the index.html and I create 122 00:08:19,240 --> 00:08:24,240 a new anchor tag and it's going to have the link text of my hobbies. 123 00:08:28,480 --> 00:08:31,870 And the href is going to be the file name. 124 00:08:32,080 --> 00:08:35,770 So in this case it will be hobbies.html. Now, 125 00:08:35,770 --> 00:08:39,460 if I hit save and I go back to my website, 126 00:08:39,550 --> 00:08:44,550 hit refresh that ordered list has disappeared and is now replaced by this 127 00:08:44,650 --> 00:08:46,720 hyperlink. And if I click on it, 128 00:08:46,960 --> 00:08:51,960 it takes me to this brand new page that I've created called my hobbies. 129 00:08:53,350 --> 00:08:54,970 So now you can see how 130 00:08:55,140 --> 00:08:59,910 you can really easily start to create multiple pages of your website. 131 00:09:00,300 --> 00:09:04,410 And as long as you've got it inside the same folder 132 00:09:04,680 --> 00:09:09,540 or you can specify a path for the browser to get to it, 133 00:09:10,020 --> 00:09:15,020 then you can start linking up your homepage with all of these different 134 00:09:15,150 --> 00:09:16,350 satellite pages 135 00:09:16,620 --> 00:09:21,620 and you start to build up a website rather than just a web page. As a challenge 136 00:09:23,190 --> 00:09:28,190 I want you to create another page that is going to contain your contact details. 137 00:09:29,400 --> 00:09:30,750 So how do you get in touch? 138 00:09:30,780 --> 00:09:35,580 So say if somebody came across your personal site and they wanted to hire you or 139 00:09:35,580 --> 00:09:37,650 they wanted to message you, now 140 00:09:37,680 --> 00:09:40,830 it's probably quite cluttering to have it on the homepage. 141 00:09:41,040 --> 00:09:45,930 So we want to create another link down here that says, contact me 142 00:09:46,500 --> 00:09:50,310 and it's going to link to another page, just like my hobbies, 143 00:09:50,610 --> 00:09:53,970 but it's going to contain, maybe your address, maybe your email, 144 00:09:53,970 --> 00:09:54,990 maybe your telephone, 145 00:09:55,260 --> 00:09:59,070 whatever you're comfortable with giving to the internet. Go ahead, 146 00:09:59,280 --> 00:10:00,960 pause the video and give it a go. 147 00:10:05,340 --> 00:10:09,450 All right. So it's going to be exactly the same as what we did for my hobbies. 148 00:10:09,750 --> 00:10:13,050 So we're going to go to our HTML personal site folder, 149 00:10:13,050 --> 00:10:14,400 we're gonna right-click on it, 150 00:10:14,730 --> 00:10:19,730 we're going to create a new file and this is going to be called contact-me. 151 00:10:20,910 --> 00:10:24,240 html. And here we're going to, again, 152 00:10:24,240 --> 00:10:29,240 start with the HTML boilerplate and the title is going to be contact me. And in 153 00:10:30,930 --> 00:10:34,470 the body, we're going to have an h1 that's, uh, 154 00:10:34,530 --> 00:10:36,900 my contact details. 155 00:10:37,470 --> 00:10:42,470 And then below that, maybe a paragraph that's going to be my fictional address 156 00:10:46,290 --> 00:10:51,000 and maybe another one that's going to be some fictional number, 157 00:10:52,830 --> 00:10:56,100 telephone number to contact me with. Um, 158 00:10:56,190 --> 00:11:01,190 and then it will be myemail@gmail.com. 159 00:11:04,290 --> 00:11:07,500 OK. So that looks pretty good. Let's go ahead and hit save, 160 00:11:07,590 --> 00:11:12,590 go back to index.html and add another anchor tag where we'd link to this page 161 00:11:14,100 --> 00:11:17,790 called contact-me.html. 162 00:11:18,480 --> 00:11:23,480 And the link text will just be contact me and we're going to hit save and 163 00:11:25,230 --> 00:11:30,150 refresh. And now we can click on here to this brand new page. 164 00:11:31,110 --> 00:11:31,440 All right. 165 00:11:31,440 --> 00:11:36,270 So today's lesson was all about the anchor tag and be sure to check out the 166 00:11:36,270 --> 00:11:38,820 anchor tag reference on MDN web docs. 167 00:11:39,090 --> 00:11:42,660 And there's a whole bunch of other attributes that you can read about. 168 00:11:43,050 --> 00:11:46,830 And there's really good examples that can show you some of the other 169 00:11:46,830 --> 00:11:50,760 functionality that you can have by simply including the anchor tag. 170 00:11:51,180 --> 00:11:55,710 So that's all from me for today. Um, I'll see you on the next lesson. 15243

Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.