All language subtitles for 014 Images and Attributes.en_US

af Afrikaans
ak Akan
sq Albanian
am Amharic
ar Arabic
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bem Bemba
bn Bengali
bh Bihari
bs Bosnian
br Breton
bg Bulgarian
km Cambodian
ca Catalan
ceb Cebuano
chr Cherokee
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
ee Ewe
fo Faroese
tl Filipino
fi Finnish
fr French
fy Frisian
gaa Ga
gl Galician
ka Georgian
de German
el Greek
gn Guarani
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
hu Hungarian
is Icelandic
ig Igbo
id Indonesian
ia Interlingua
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
rw Kinyarwanda
rn Kirundi
kg Kongo
ko Korean
kri Krio (Sierra Leone)
ku Kurdish
ckb Kurdish (Soranî)
ky Kyrgyz
lo Laothian
la Latin
lv Latvian
ln Lingala
lt Lithuanian
loz Lozi
lg Luganda
ach Luo
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mfe Mauritian Creole
mo Moldavian
mn Mongolian
my Myanmar (Burmese)
sr-ME Montenegrin
ne Nepali
pcm Nigerian Pidgin
nso Northern Sotho
no Norwegian
nn Norwegian (Nynorsk)
oc Occitan
or Oriya
om Oromo
ps Pashto
fa Persian Download
pl Polish
pt-BR Portuguese (Brazil)
pt Portuguese (Portugal)
pa Punjabi
qu Quechua
ro Romanian
rm Romansh
nyn Runyakitara
ru Russian
sm Samoan
gd Scots Gaelic
sr Serbian
sh Serbo-Croatian
st Sesotho
tn Setswana
crs Seychellois Creole
sn Shona
sd Sindhi
si Sinhalese
sk Slovak
sl Slovenian
so Somali
es Spanish
es-419 Spanish (Latin American)
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
tt Tatar
te Telugu
th Thai
ti Tigrinya
to Tonga
lua Tshiluba
tum Tumbuka
tr Turkish
tk Turkmen
tw Twi
ug Uighur
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
wo Wolof
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu
Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated: 1 00:00:01,470 --> 00:00:03,380 One thing that our blog post 2 00:00:03,380 --> 00:00:06,880 is still missing right now is some images. 3 00:00:06,880 --> 00:00:11,033 And so let's now learn how to use the HTML <img> element. 4 00:00:12,320 --> 00:00:15,470 So, if we check out the demo page, 5 00:00:15,470 --> 00:00:18,050 then we notice that here we have two 6 00:00:18,050 --> 00:00:19,940 kind of important images. 7 00:00:19,940 --> 00:00:22,150 So, we have this big image here, 8 00:00:22,150 --> 00:00:25,090 which kind of illustrates the blog post. 9 00:00:25,090 --> 00:00:29,270 And then we also have this photo here of the author. 10 00:00:29,270 --> 00:00:33,530 And so let's now start by incorporating this image here 11 00:00:33,530 --> 00:00:34,693 into our blog. 12 00:00:36,250 --> 00:00:39,920 So, the images are, of course, in our project folder. 13 00:00:39,920 --> 00:00:42,560 So, they came with the starter files. 14 00:00:42,560 --> 00:00:45,530 And the one that we are going to include here, 15 00:00:45,530 --> 00:00:47,860 is this post image. 16 00:00:47,860 --> 00:00:49,700 So you see when you double click, 17 00:00:49,700 --> 00:00:51,150 so when you open this file, 18 00:00:51,150 --> 00:00:55,350 then VSCode is actually able to display image files, 19 00:00:55,350 --> 00:00:56,663 and without any problems. 20 00:00:58,380 --> 00:01:03,380 So we want this image right here after this author. 21 00:01:04,000 --> 00:01:06,430 So basically the image serves as a barrier 22 00:01:06,430 --> 00:01:08,970 between the beginning of the article, 23 00:01:08,970 --> 00:01:12,690 and the rest of the page, so the top part. 24 00:01:12,690 --> 00:01:16,400 Now I think that here, actually this title here, 25 00:01:16,400 --> 00:01:20,693 so this <h2> element should be before the author. 26 00:01:22,260 --> 00:01:24,423 Let's move that down here. 27 00:01:26,570 --> 00:01:28,410 Right, so first, of course, 28 00:01:28,410 --> 00:01:32,090 like we have it here, needs to come the actual title. 29 00:01:32,090 --> 00:01:35,150 So the heading element, and only then the author, 30 00:01:35,150 --> 00:01:36,463 and then this image here. 31 00:01:39,200 --> 00:01:43,950 Okay, but anyway, let's now include the <img> element. 32 00:01:43,950 --> 00:01:47,170 So again, right here after this paragraph, 33 00:01:47,170 --> 00:01:49,240 we want to include this image. 34 00:01:49,240 --> 00:01:51,540 So just like any other element, 35 00:01:51,540 --> 00:01:55,020 we start by writing it like this. 36 00:01:55,020 --> 00:01:57,340 But now remember how I actually told you 37 00:01:57,340 --> 00:01:59,860 in the first lecture of this section, 38 00:01:59,860 --> 00:02:02,770 that the <img> element is a special element, 39 00:02:02,770 --> 00:02:05,720 and that's because it doesn't have any content, 40 00:02:05,720 --> 00:02:09,160 and therefore it also doesn't have a closing tag. 41 00:02:09,160 --> 00:02:12,400 Instead, what we do is to simply add the slash 42 00:02:12,400 --> 00:02:15,580 here at the very end of the element. 43 00:02:15,580 --> 00:02:19,740 Now you might wonder if we don't specify any content here 44 00:02:19,740 --> 00:02:21,250 for this <img> element, 45 00:02:21,250 --> 00:02:25,810 then how will HTML know which element it should display. 46 00:02:25,810 --> 00:02:28,520 And that is an excellent question, 47 00:02:28,520 --> 00:02:31,240 which brings us to something new in HTML, 48 00:02:31,240 --> 00:02:33,320 which are attributes. 49 00:02:33,320 --> 00:02:36,440 So attributes are basically pieces of data, 50 00:02:36,440 --> 00:02:39,590 which we can use to describe elements. 51 00:02:39,590 --> 00:02:43,140 So there are lots of different attributes in HTML, 52 00:02:43,140 --> 00:02:46,420 and one of them is the <source> attribute. 53 00:02:46,420 --> 00:02:49,710 And so that's the one we are interested in right now. 54 00:02:49,710 --> 00:02:54,710 So <source> goes like this, SRC, and then an equal, 55 00:02:55,400 --> 00:02:58,670 and then we need double quotes like this, 56 00:02:58,670 --> 00:03:02,680 and then we can simply specify the name of the image. 57 00:03:02,680 --> 00:03:06,530 So remember, that is post-img.jpg. 58 00:03:06,530 --> 00:03:10,640 And so we just write post-img, 59 00:03:10,640 --> 00:03:13,650 and we could even allow VSCode to auto complete 60 00:03:13,650 --> 00:03:16,560 that code for us, like by clicking here, 61 00:03:16,560 --> 00:03:20,340 or going down, and actually that didn't work. 62 00:03:20,340 --> 00:03:22,630 But if we just hit enter here, 63 00:03:22,630 --> 00:03:24,720 then that would work just fine. 64 00:03:24,720 --> 00:03:26,430 So again, we can write it manually, 65 00:03:26,430 --> 00:03:30,900 or just use VSCode's auto complete functionality. 66 00:03:30,900 --> 00:03:32,250 And that's actually it, 67 00:03:32,250 --> 00:03:34,310 that's the very basics that we need 68 00:03:34,310 --> 00:03:35,893 in order to display an image. 69 00:03:36,860 --> 00:03:38,630 So if we reload this now, 70 00:03:38,630 --> 00:03:42,240 you will see that indeed here it is. 71 00:03:42,240 --> 00:03:46,610 Great, so again, let's just quickly recap. 72 00:03:46,610 --> 00:03:48,740 We did not specify the image 73 00:03:48,740 --> 00:03:51,760 using some content in this element. 74 00:03:51,760 --> 00:03:55,720 Instead, what we needed to do was to specify an attribute. 75 00:03:55,720 --> 00:03:58,810 And in this case, it's the <source> attribute. 76 00:03:58,810 --> 00:04:00,360 And remember that an attribute 77 00:04:00,360 --> 00:04:03,100 is basically like a piece of data, 78 00:04:03,100 --> 00:04:06,730 so a piece of information describing this element. 79 00:04:06,730 --> 00:04:08,960 So here we are describing the source 80 00:04:08,960 --> 00:04:13,670 from which the browser should basically read the image. 81 00:04:13,670 --> 00:04:15,160 All right. 82 00:04:15,160 --> 00:04:17,110 Now, besides the <source> attribute, 83 00:04:17,110 --> 00:04:20,500 there are other attributes that we can specify for images, 84 00:04:20,500 --> 00:04:24,573 and one that we should never skip is the alt attribute. 85 00:04:25,900 --> 00:04:27,880 So we write it like this, 86 00:04:27,880 --> 00:04:30,880 and alt stands for alternative text. 87 00:04:30,880 --> 00:04:33,250 So basically what we need to specify here 88 00:04:33,250 --> 00:04:37,480 is some text that should describe what the image is about. 89 00:04:37,480 --> 00:04:41,110 And this is very important for various reasons. 90 00:04:41,110 --> 00:04:43,820 One of them is that it will allow search engines, 91 00:04:43,820 --> 00:04:45,510 such as Google Chrome, 92 00:04:45,510 --> 00:04:48,320 to actually know what is in the image, 93 00:04:48,320 --> 00:04:50,140 because without this description, 94 00:04:50,140 --> 00:04:53,200 search engines don't really have a know of knowing 95 00:04:53,200 --> 00:04:55,320 what the image is actually about. 96 00:04:55,320 --> 00:04:58,580 And second, and probably even more important, 97 00:04:58,580 --> 00:05:02,670 is that by specifying the description of the image, 98 00:05:02,670 --> 00:05:07,300 we can also allow blind people to use a website. 99 00:05:07,300 --> 00:05:09,790 So users who use a screen reader 100 00:05:09,790 --> 00:05:11,330 will not see the image, 101 00:05:11,330 --> 00:05:14,070 but instead they will have the screen reader 102 00:05:14,070 --> 00:05:18,650 read the alternative text, so the description to them. 103 00:05:18,650 --> 00:05:20,460 So never skip this attribute. 104 00:05:20,460 --> 00:05:24,080 It's very important to always write a good description. 105 00:05:24,080 --> 00:05:29,080 So here, let's say that this image here is HTML code 106 00:05:30,710 --> 00:05:31,783 on a screen. 107 00:05:32,900 --> 00:05:35,740 Okay, now this will not visually change 108 00:05:35,740 --> 00:05:38,260 actually what we see here. 109 00:05:38,260 --> 00:05:42,280 So let's reload, unless the image for some reason 110 00:05:42,280 --> 00:05:44,190 can not be found. 111 00:05:44,190 --> 00:05:47,490 So let's say that we forgot the G here, for example. 112 00:05:47,490 --> 00:05:51,133 And so now this image path is completely wrong. 113 00:05:52,060 --> 00:05:54,200 So if we now reload, 114 00:05:54,200 --> 00:05:57,000 then the browser will not be able to find the image, 115 00:05:57,000 --> 00:05:58,630 but instead, what it will do 116 00:05:58,630 --> 00:06:01,960 is to then print our description here. 117 00:06:01,960 --> 00:06:05,463 So that's the HTML code on a screen that we gave it here. 118 00:06:06,750 --> 00:06:11,313 Okay, so that is actually another use case of the alt text. 119 00:06:12,390 --> 00:06:17,390 Let's put it back, and we are actually still not done. 120 00:06:17,470 --> 00:06:20,530 So we can specify some more attributes here, 121 00:06:20,530 --> 00:06:23,280 which are quite important in this case. 122 00:06:23,280 --> 00:06:24,610 So the ones that I mean 123 00:06:24,610 --> 00:06:28,090 are the image width and the image height. 124 00:06:28,090 --> 00:06:31,390 So right now this image here is a little bit too big. 125 00:06:31,390 --> 00:06:36,030 And so let's specify its width to 500 pixels, 126 00:06:36,030 --> 00:06:39,540 and don't worry yet about what these 500 pixels mean, 127 00:06:39,540 --> 00:06:42,190 or exactly what a pixel is. 128 00:06:42,190 --> 00:06:46,590 We will talk more about that once we reach the CSS section, 129 00:06:46,590 --> 00:06:50,873 but for now let's just write width, and set it to 500, 130 00:06:52,338 --> 00:06:53,803 and then let's see, okay. 131 00:06:56,460 --> 00:07:00,640 So now it's scaled the image to a width of 500, 132 00:07:00,640 --> 00:07:04,180 and it automatically also maintained the aspect ratio 133 00:07:04,180 --> 00:07:06,343 of the image. 134 00:07:07,510 --> 00:07:11,000 All right, but we can also specify that. 135 00:07:11,000 --> 00:07:14,060 So besides the width, we can also specify the height, 136 00:07:14,060 --> 00:07:16,020 which should be 200. 137 00:07:16,020 --> 00:07:19,543 And I know that because I know the image dimensions. 138 00:07:20,540 --> 00:07:22,220 So if we open this up again, 139 00:07:22,220 --> 00:07:27,220 you see here that the original image is a thousand by 400. 140 00:07:27,220 --> 00:07:30,390 And so if I specify the width as 500, 141 00:07:30,390 --> 00:07:32,520 which is just half of a thousand, 142 00:07:32,520 --> 00:07:36,420 then the height must also be half of 400 here, 143 00:07:36,420 --> 00:07:38,073 so that would be 200. 144 00:07:39,590 --> 00:07:42,280 Okay, so that should now look the same. 145 00:07:42,280 --> 00:07:44,880 And it does, but of course, if I want it, 146 00:07:44,880 --> 00:07:48,100 I could make it a square, for example, 147 00:07:48,100 --> 00:07:51,650 which would then completely distort the image, 148 00:07:51,650 --> 00:07:52,793 just as we see here. 149 00:07:54,160 --> 00:07:59,160 Of course we don't want that, so put it back and here we go. 150 00:08:00,810 --> 00:08:03,660 Great, so this is how we include images 151 00:08:03,660 --> 00:08:05,963 into an HTML document. 152 00:08:07,141 --> 00:08:10,940 And to this one here was only the first one that we wanted. 153 00:08:10,940 --> 00:08:13,220 The other image is this author image 154 00:08:13,220 --> 00:08:18,220 right here above this author paragraph right here. 155 00:08:19,350 --> 00:08:23,830 So the image that we want now is this one, Laura Jones, 156 00:08:23,830 --> 00:08:28,830 and we want it with a height and a width of 50 pixels. 157 00:08:29,180 --> 00:08:32,740 Okay, so I have another challenge for you. 158 00:08:32,740 --> 00:08:34,580 And what I want you to do this time 159 00:08:34,580 --> 00:08:37,480 is to include this image that I just showed you 160 00:08:37,480 --> 00:08:41,440 on your own right here in this place. 161 00:08:41,440 --> 00:08:44,700 line:15% Okay, so take a minute, and pause the video, 162 00:08:44,700 --> 00:08:49,340 line:15% and include this image with 50 by 50 pixels. 163 00:08:49,340 --> 00:08:52,753 line:15% And then I'll be back here in a minute with the solution. 164 00:08:55,130 --> 00:08:59,223 line:15% All right, so hopefully you got some more practice there. 165 00:09:00,460 --> 00:09:03,730 So image, and I will immediately start 166 00:09:03,730 --> 00:09:07,350 writing the attributes, and I will then in the end, 167 00:09:07,350 --> 00:09:09,140 close the element. 168 00:09:09,140 --> 00:09:11,690 So here we want Laura Jones, 169 00:09:11,690 --> 00:09:15,100 and now I will just hit enter or return 170 00:09:15,100 --> 00:09:18,022 to auto complete the file name here. 171 00:09:18,022 --> 00:09:19,820 And then the alt text, 172 00:09:19,820 --> 00:09:24,820 let's say that this is a Headshot of Laura Jones, 173 00:09:26,700 --> 00:09:31,130 and not Jonas, and a height, and here again, 174 00:09:31,130 --> 00:09:35,890 we could now hit enter or return to auto complete this. 175 00:09:35,890 --> 00:09:38,400 But I actually want you to write these attributes 176 00:09:38,400 --> 00:09:42,530 by yourself by hand, so that they get into your head. 177 00:09:42,530 --> 00:09:44,493 So that's really important. 178 00:09:45,410 --> 00:09:50,410 So a height and a width of 50, and that's it. 179 00:09:51,760 --> 00:09:54,780 So let's close the element, give it a save, 180 00:09:54,780 --> 00:09:57,890 and then Prettier does this nice job 181 00:09:57,890 --> 00:10:00,760 of putting each of these attributes here in one line, 182 00:10:00,760 --> 00:10:02,533 which makes it really easy to see. 183 00:10:03,960 --> 00:10:08,960 Actually let's close down our sidebar here, and let's see. 184 00:10:09,660 --> 00:10:11,190 And here we go. 185 00:10:11,190 --> 00:10:14,680 So here is that picture of Laura Jones now. 186 00:10:14,680 --> 00:10:18,320 Okay, well done, nice progress. 187 00:10:18,320 --> 00:10:20,860 So now we know how images work, 188 00:10:20,860 --> 00:10:23,310 and how attributes work as well. 189 00:10:23,310 --> 00:10:25,530 And actually we can specify attributes 190 00:10:25,530 --> 00:10:28,900 also on some other elements in HTML. 191 00:10:28,900 --> 00:10:31,470 And one where this is very important 192 00:10:31,470 --> 00:10:35,180 is actually the HTML element itself. 193 00:10:35,180 --> 00:10:37,460 So here in this HTML element, 194 00:10:37,460 --> 00:10:41,370 we should specify the language that we use for this webpage. 195 00:10:41,370 --> 00:10:45,783 So for this document, and we can do that by saying blank, 196 00:10:46,990 --> 00:10:49,610 so specifying the lang attribute, 197 00:10:49,610 --> 00:10:52,050 and then in this case, since it is English, 198 00:10:52,050 --> 00:10:54,230 we can set it to EN, 199 00:10:54,230 --> 00:10:57,230 but for other languages, there are other codes. 200 00:10:57,230 --> 00:11:00,690 For example, for German, just probably DE, 201 00:11:00,690 --> 00:11:03,920 or for Portuguese, it would be PT. 202 00:11:03,920 --> 00:11:06,150 And if you have any other language, 203 00:11:06,150 --> 00:11:10,010 you can just easily find out the code by Googling. 204 00:11:10,010 --> 00:11:12,980 Another thing that we can, and actually should do, 205 00:11:12,980 --> 00:11:16,520 which needs attributes is to specify the character set 206 00:11:16,520 --> 00:11:18,743 that is used in the document. 207 00:11:19,790 --> 00:11:22,470 So that is something that goes into the head, 208 00:11:22,470 --> 00:11:24,550 because it is a piece of information 209 00:11:24,550 --> 00:11:26,313 that describes the document. 210 00:11:27,220 --> 00:11:29,810 So here we need another new element. 211 00:11:29,810 --> 00:11:34,810 And this is simply called meta, which stands for metadata. 212 00:11:34,880 --> 00:11:38,350 So metadata means data about the data. 213 00:11:38,350 --> 00:11:41,483 And so here we are describing that the character set, 214 00:11:43,020 --> 00:11:46,930 which we describe by this attribute. 215 00:11:46,930 --> 00:11:51,930 So we say that the character said should be UTF-8, 216 00:11:52,140 --> 00:11:55,280 which basically is all the simple characters that we use 217 00:11:55,280 --> 00:11:56,773 in the English language. 218 00:11:57,670 --> 00:11:59,730 Now this one here is another of these elements 219 00:11:59,730 --> 00:12:01,690 that doesn't have a closing tag, 220 00:12:01,690 --> 00:12:04,540 and so we just close it like this. 221 00:12:04,540 --> 00:12:05,550 Okay? 222 00:12:05,550 --> 00:12:07,900 Now I'm not spending a whole lot of time 223 00:12:07,900 --> 00:12:11,100 on these elements, and on this kind of stuff, 224 00:12:11,100 --> 00:12:14,190 because later when you actually built your own pages, 225 00:12:14,190 --> 00:12:17,210 then this will all happen automatically. 226 00:12:17,210 --> 00:12:18,100 Okay? 227 00:12:18,100 --> 00:12:19,710 So this was just to show you that 228 00:12:19,710 --> 00:12:22,780 this is just another way or another place 229 00:12:22,780 --> 00:12:24,840 in which we need some attributes, 230 00:12:24,840 --> 00:12:27,363 where we then need to specify a value for it. 231 00:12:28,420 --> 00:12:29,253 All right? 232 00:12:29,253 --> 00:12:32,780 So UTF-8 here is the value that we specified 233 00:12:32,780 --> 00:12:34,833 for this character set attribute. 234 00:12:36,531 --> 00:12:41,470 Okay, and yeah, I think that's it for this lecture. 235 00:12:41,470 --> 00:12:43,003 So, see you in the next one. 17794

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