All language subtitles for 020 HTML Tables.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,690 --> 00:00:01,050 All right. 2 00:00:01,050 --> 00:00:06,050 So previously we managed to get our website to include images as well as 3 00:00:06,120 --> 00:00:10,080 links. So we added these image tags as was anchor tags 4 00:00:10,170 --> 00:00:14,220 which can take us to external sites, but also to internal sites, 5 00:00:14,310 --> 00:00:17,280 like the brand new my hobbies page that we created, 6 00:00:17,370 --> 00:00:20,640 or the contact me. Now in this lesson, 7 00:00:20,640 --> 00:00:25,640 we're going to take things a little bit further. In our personal site/CV 8 00:00:25,890 --> 00:00:30,060 I want to have a section where we can list our work experience, 9 00:00:30,090 --> 00:00:33,690 so what we've done and when we've done it. Currently, 10 00:00:33,690 --> 00:00:38,490 if we went into our code and say below that unordered list, 11 00:00:38,730 --> 00:00:41,430 and, um, we add a h3, 12 00:00:42,000 --> 00:00:45,180 let's call it work experience. Now, 13 00:00:45,340 --> 00:00:50,340 if we added a standard paragraph tag and we said maybe 2010 14 00:00:50,520 --> 00:00:54,150 to 2013, um, 15 00:00:54,180 --> 00:00:59,180 let's say Lead Developer at Tempo App. 16 00:01:00,630 --> 00:01:02,880 So let's save that and take a look. 17 00:01:03,030 --> 00:01:05,970 And if we refresh then it looks like this, 18 00:01:06,360 --> 00:01:08,640 which is all well and good if we have that range, 19 00:01:08,670 --> 00:01:11,640 but what if I wanted to add something where I didn't have a year range? 20 00:01:11,670 --> 00:01:15,810 Say if it was 2010 when I worked as a researcher, 21 00:01:16,440 --> 00:01:16,860 uh, 22 00:01:16,860 --> 00:01:21,860 at Institute of Cognitive Neurosciences. 23 00:01:22,770 --> 00:01:27,600 So let's save that and let's refresh and you can see that it looks really 24 00:01:28,850 --> 00:01:30,170 right? Like this part 25 00:01:31,190 --> 00:01:32,023 and this part, 26 00:01:32,030 --> 00:01:37,030 they're not really indented at the same level horizontally and everything just looks 27 00:01:39,470 --> 00:01:40,490 really messy. 28 00:01:40,820 --> 00:01:44,570 So how can we implement something that looks nice like this where there's 29 00:01:44,600 --> 00:01:49,280 even a bit of padding in between and everything looks really regular? 30 00:01:49,820 --> 00:01:50,240 Well, 31 00:01:50,240 --> 00:01:55,240 one of the ways that we can achieve this using just HTML is to create a table. 32 00:01:56,780 --> 00:02:01,780 So if we have a look at the docs on MDN and we look at table, 33 00:02:02,150 --> 00:02:06,170 you can see that a very simple table just looks like this. 34 00:02:06,200 --> 00:02:08,870 This is a bog-standard, simple table. 35 00:02:09,320 --> 00:02:11,990 But tables can get really complicated as well 36 00:02:11,990 --> 00:02:15,740 and you can use it to structure and represent data in your website. 37 00:02:16,040 --> 00:02:20,600 So we could have table headings, we could have different cells, 38 00:02:20,930 --> 00:02:23,570 we could have column groups and columns, 39 00:02:23,570 --> 00:02:28,100 we can have captions and a whole bunch of things. So let's try and add 40 00:02:28,100 --> 00:02:33,100 a table to our website so that we can make our CV look a little bit more like 41 00:02:34,070 --> 00:02:34,790 this. 42 00:02:34,790 --> 00:02:39,790 So let's first add a horizontal rule here between our table and these two links. 43 00:02:41,630 --> 00:02:43,850 And let's use auto-complete to 44 00:02:43,850 --> 00:02:47,870 add a table tag for us. Inside the table 45 00:02:47,870 --> 00:02:51,380 we can create table rows and also table data, 46 00:02:51,560 --> 00:02:53,420 which are essentially like cells. 47 00:02:53,840 --> 00:02:58,840 So say if we create a brand new table row and it's really helpful that 48 00:02:59,320 --> 00:03:03,070 auto-suggest actually tells you what each of these tags are. 49 00:03:03,160 --> 00:03:05,470 So let's go ahead and hit enter. 50 00:03:06,340 --> 00:03:08,500 So this is a single row 51 00:03:08,890 --> 00:03:12,310 and if I want to create another row underneath then I would just have to create 52 00:03:13,090 --> 00:03:17,260 another tr. Now inside the top row, 53 00:03:17,620 --> 00:03:22,620 I'm going to have two table data elements or rather two cells in this single 54 00:03:23,290 --> 00:03:24,123 row. 55 00:03:24,340 --> 00:03:29,340 And to represent the cells, I'm going to use the td or table data element. 56 00:03:31,870 --> 00:03:35,650 So the first cell is going to contain my date 57 00:03:37,240 --> 00:03:42,240 and the second cell is going to contain what I did. 58 00:03:44,680 --> 00:03:47,350 So that's our first row complete. 59 00:03:47,590 --> 00:03:52,590 Now let's go ahead and create another two cells or another two tds inside our 60 00:03:54,940 --> 00:03:59,470 second row. So let's again, copy and paste, um, 61 00:03:59,500 --> 00:04:00,333 the date 62 00:04:02,020 --> 00:04:06,250 and the work into the table 63 00:04:06,280 --> 00:04:07,390 data elements. 64 00:04:07,810 --> 00:04:12,810 And I'm going to delete these two paragraphs. Let's hit save, 65 00:04:13,120 --> 00:04:17,230 go back to our website and hit refresh and see what it looks like. Okay. 66 00:04:17,230 --> 00:04:20,590 That's already looking a lot better than before, right? 67 00:04:21,220 --> 00:04:26,220 It's being a table means that all columns our structured together. 68 00:04:27,070 --> 00:04:32,070 So these two lines are structured so that they are indented to the same place 69 00:04:33,250 --> 00:04:37,810 and it makes it look so much neater than before. Now, 70 00:04:37,810 --> 00:04:42,130 aside from having just rows and cells, tables also have headers, 71 00:04:42,160 --> 00:04:47,160 body and footer mirroring what we have for our HTML websites. 72 00:04:48,520 --> 00:04:53,520 And you can declare them quite simply by writing thead for table 73 00:04:54,880 --> 00:04:59,560 head, and tbody for table body, 74 00:05:00,220 --> 00:05:04,930 and tfoot for table footer. Now inside the table head, 75 00:05:05,320 --> 00:05:08,320 we can add some titles to each of our columns 76 00:05:08,500 --> 00:05:11,530 and they get formatted by default in bold. 77 00:05:11,710 --> 00:05:16,000 So if we create a new table row and inside this row 78 00:05:16,030 --> 00:05:19,090 instead of creating table data or td elements, 79 00:05:19,330 --> 00:05:24,330 we're going to create th elements or a table header cell element. 80 00:05:25,030 --> 00:05:28,720 And inside here, we're going to give the name of our first column 81 00:05:29,050 --> 00:05:31,120 which is going to be Dates. 82 00:05:32,500 --> 00:05:35,320 And then we're going to create another table header cell 83 00:05:35,620 --> 00:05:38,440 and this one is going to be the work that we did. 84 00:05:39,040 --> 00:05:43,240 So let's hit save and hit refresh. 85 00:05:43,540 --> 00:05:48,460 And you'll see that we now have table headings for each of our columns. 86 00:05:49,240 --> 00:05:52,600 Now, for those of you guys who might've been playing around with this code, 87 00:05:52,720 --> 00:05:57,070 you would have realized that if I cut this table row 88 00:05:57,410 --> 00:06:00,350 and instead of putting it inside the header, 89 00:06:01,130 --> 00:06:05,060 I actually put it just inside the main table 90 00:06:05,540 --> 00:06:09,890 and I delete all of this and we hit save and we hit refresh, 91 00:06:10,220 --> 00:06:15,220 you'll notice that it looks exactly the same and that's because we're using 92 00:06:15,260 --> 00:06:16,610 these special elements 93 00:06:16,760 --> 00:06:21,410 the table header cell elements and most browsers know how these should be 94 00:06:21,410 --> 00:06:24,020 formatted. So it looks exactly the same. 95 00:06:24,380 --> 00:06:28,760 But the reason why we might have different sections of our table, for example, 96 00:06:29,000 --> 00:06:30,890 putting these cells inside the table 97 00:06:30,890 --> 00:06:35,890 head and putting these inside the body is because sometimes we might want to 98 00:06:36,080 --> 00:06:38,180 select and isolate the table 99 00:06:38,180 --> 00:06:43,100 header and the table body in order to style it differently or make it function in 100 00:06:43,100 --> 00:06:45,590 a different way. For example, 101 00:06:45,590 --> 00:06:48,830 if we separated the table header from the table body, 102 00:06:49,160 --> 00:06:53,750 we can use some code to isolate the header and fix it in place so that when 103 00:06:53,750 --> 00:06:58,160 users scroll through our table, we can keep these headings on the screen. 104 00:06:58,790 --> 00:07:03,440 Now that requires a little bit more fancy stuff like CSS or JavaScript, 105 00:07:03,530 --> 00:07:05,810 which we'll wait until later modules to talk about, 106 00:07:05,870 --> 00:07:10,870 but it's a good reason to be aware of why you might want to place the header 107 00:07:11,180 --> 00:07:14,660 cells inside the head, the main body of the table inside the body, 108 00:07:14,960 --> 00:07:19,070 and maybe some footer cells into the table footer. And generally, 109 00:07:19,070 --> 00:07:23,930 this is the structure that you'll see for most tables with a head and with a 110 00:07:23,930 --> 00:07:27,980 body. Now, if we have a look at these tables on the MDN 111 00:07:27,980 --> 00:07:31,190 developer docs, you can see that they've got outlines 112 00:07:31,370 --> 00:07:35,720 whereas what we've created doesn't have any borders or boundaries or outlines at 113 00:07:35,720 --> 00:07:40,370 all. If we take a look at the MDN developer docs for the table element, 114 00:07:40,760 --> 00:07:44,960 you can see that there's a whole bunch of attributes, such as background 115 00:07:44,960 --> 00:07:48,950 color, or border or cell padding, 116 00:07:48,950 --> 00:07:50,000 cell spacing, 117 00:07:50,300 --> 00:07:54,410 and a whole bunch of things that you can apply to the table element to change 118 00:07:54,440 --> 00:07:55,460 its appearance. 119 00:07:55,940 --> 00:08:00,230 But if you take a closer look at each of these styling attributes, 120 00:08:00,290 --> 00:08:05,290 then you can see they all have a little thumbs-down sign next to them. 121 00:08:05,720 --> 00:08:10,400 And this is because all of these attributes for the table element are 122 00:08:10,430 --> 00:08:11,390 deprecated. 123 00:08:11,810 --> 00:08:15,950 And you'll hear that word quite often in Programming across many different 124 00:08:15,950 --> 00:08:17,300 languages and disciplines. 125 00:08:17,690 --> 00:08:21,800 And what that word means is that it's almost like it's downgraded. 126 00:08:21,920 --> 00:08:24,590 It's something that they no longer recommend you using. 127 00:08:25,070 --> 00:08:29,990 And the reason is because we have to always keep in mind that HTML is for 128 00:08:29,990 --> 00:08:30,823 structure, 129 00:08:31,130 --> 00:08:35,660 CSS is for styling and the JavaScript is for behavior. 130 00:08:36,050 --> 00:08:40,760 And even though it's possible to affect the style of your website through using 131 00:08:40,790 --> 00:08:44,960 HTML attributes or through using different HTML elements, 132 00:08:45,290 --> 00:08:48,110 you have to try and resist when you can. 133 00:08:48,530 --> 00:08:50,960 But since we haven't yet learned about CSS, 134 00:08:51,170 --> 00:08:56,130 I wanna take you into the primitive days before web designers had access to CSS what 135 00:08:56,130 --> 00:08:59,040 they might've done using just HTML. 136 00:08:59,220 --> 00:09:01,860 And if we scroll through these attributes, 137 00:09:02,040 --> 00:09:04,680 you'll come across something called border. 138 00:09:05,370 --> 00:09:07,650 And this defines, in pixels, 139 00:09:07,770 --> 00:09:10,440 the size of the frame that's surrounding the table. 140 00:09:11,310 --> 00:09:14,610 We can add this attribute to our table element, 141 00:09:14,880 --> 00:09:19,710 not to thead or table row or a table heading cell, well any of the other ones 142 00:09:19,710 --> 00:09:22,560 because we're currently reading the table docs, remember, 143 00:09:23,310 --> 00:09:28,290 and we can add it and say, border equals one pixel 144 00:09:28,320 --> 00:09:30,960 let's say. And if we refresh our site, 145 00:09:31,050 --> 00:09:36,050 then we'll see this incredibly ugly HTML table that you'll see a lot in 146 00:09:36,570 --> 00:09:39,750 websites from the nineties. So let's get rid of it. 147 00:09:41,910 --> 00:09:46,910 Let's just quickly recap the HTML structure for creating a table. To start off, 148 00:09:48,570 --> 00:09:51,900 we create this table tag and we also close it 149 00:09:52,290 --> 00:09:56,520 and everything in between is the actual content of our table. 150 00:09:57,030 --> 00:10:01,050 This just creates a simple table. Now, by default, 151 00:10:01,080 --> 00:10:06,080 your browser will style the table to not have any borders or padding or anything 152 00:10:06,900 --> 00:10:08,490 style related. Now, 153 00:10:08,490 --> 00:10:11,910 in order for our table to actually start holding some pieces of data, 154 00:10:12,180 --> 00:10:16,020 we're going to have to create something called a table row. 155 00:10:16,380 --> 00:10:21,380 And between the open and closing tr tags is where the data for that row is going 156 00:10:22,680 --> 00:10:23,430 to go. 157 00:10:23,430 --> 00:10:28,430 And this section of code will just create a single row inside our table, 158 00:10:29,040 --> 00:10:31,530 again, with no associated styling. 159 00:10:31,710 --> 00:10:34,710 So if there's nothing between these two tags, 160 00:10:34,950 --> 00:10:39,300 then you won't actually see anything appear on screen. Now, 161 00:10:39,300 --> 00:10:42,810 the next part is our table data 162 00:10:42,840 --> 00:10:47,840 or rather, our table cells that we create using the td tag. And in between the 163 00:10:49,230 --> 00:10:53,220 open and closing td tags, we place the actual data 164 00:10:53,220 --> 00:10:55,590 that's going to go into that cell. 165 00:10:56,160 --> 00:11:00,660 And this is a single table cell that's going to contain the word Angela 166 00:11:01,020 --> 00:11:05,940 and it's going to go inside the first table row. And so over here. 167 00:11:06,630 --> 00:11:11,630 And as you populate your table with more rows and more data, then you will see 168 00:11:12,900 --> 00:11:15,900 this structure reflected on your website. 169 00:11:16,080 --> 00:11:20,640 So the biggest hurdle that you have to get over is that there are no table 170 00:11:20,640 --> 00:11:24,990 columns. All that you're doing is going from top to bottom 171 00:11:25,260 --> 00:11:29,130 defining new table rows and inside each row, 172 00:11:29,340 --> 00:11:34,340 you're putting in individual cells and each cell gets placed horizontally, one 173 00:11:36,060 --> 00:11:36,893 after the other, 174 00:11:37,140 --> 00:11:42,140 creating effectively the columns. While the main job of tables is to display 175 00:11:43,290 --> 00:11:44,400 structured data, 176 00:11:45,060 --> 00:11:50,060 you can also see how you could use it to affect the layout of the various HTML 177 00:11:51,120 --> 00:11:52,830 elements on your website. 178 00:11:53,340 --> 00:11:55,920 And that's what we're going to look at in the next lesson. 15520

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