Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:00,290 --> 00:00:00,680
All right.
2
00:00:00,680 --> 00:00:04,220
So now it's time for our final project of the section.
3
00:00:04,220 --> 00:00:09,320
And in this project, we're going to be building a website to help you learn Spanish.
4
00:00:09,440 --> 00:00:14,900
Now, you might already know Spanish, but I'm currently learning Spanish, and there's so much vocab
5
00:00:14,900 --> 00:00:15,760
to get through.
6
00:00:15,770 --> 00:00:21,050
I thought, why don't we build a vocabulary flashcard website?
7
00:00:21,050 --> 00:00:22,820
But a really, really simple one
8
00:00:22,820 --> 00:00:30,650
using everything we know so far, in this project, we're going to be creating a website where we list
9
00:00:30,680 --> 00:00:34,400
the words in, well, in this case in Spanish.
10
00:00:34,400 --> 00:00:40,370
It could be any other language you choose, and we're going to match it with an image of a particular
11
00:00:40,370 --> 00:00:44,300
color so that we learn all the colors in our foreign language.
12
00:00:44,480 --> 00:00:47,450
This is what the final website should look like.
13
00:00:47,450 --> 00:00:55,370
We've got our word which is foreign in the color that matches the image
14
00:00:55,370 --> 00:01:02,640
and we've got our images all lined up as nice little squares so that we can scroll through this website
15
00:01:02,640 --> 00:01:05,160
and learn the words for the colors in Spanish.
16
00:01:05,340 --> 00:01:11,700
Once you're ready, go ahead and download the Color Vocab Project starting files, extract it, and open
17
00:01:11,700 --> 00:01:16,800
it up inside VS Code. In the index.html.
18
00:01:16,830 --> 00:01:20,330
You'll see that I've already set you up with some starting code.
19
00:01:20,340 --> 00:01:29,460
If you go ahead and show it as a preview, you'll see some words for the colors in Spanish and the different
20
00:01:29,460 --> 00:01:31,520
images for the different colors.
21
00:01:31,530 --> 00:01:34,650
Now don't worry about the fact the images are all different sizes.
22
00:01:34,650 --> 00:01:38,490
We're going to fix that with CSS very soon in the project.
23
00:01:38,700 --> 00:01:46,320
First thing to note is we've already set you up with a link to an external stylesheet which is inside
24
00:01:46,320 --> 00:01:48,210
style.css.
25
00:01:48,210 --> 00:01:55,680
But notice that we haven't created that file for you, so I want you to create a new file inside the
26
00:01:55,680 --> 00:02:03,450
correct location by using this button in VS Code and then name it once you've created it so that it
27
00:02:03,450 --> 00:02:04,560
actually works.
28
00:02:04,560 --> 00:02:11,670
And one of the things that I often check to make sure that my external CSS is linked up is to target
29
00:02:11,670 --> 00:02:17,790
everything on the page and to set the background-color to red.
30
00:02:17,820 --> 00:02:24,330
That way you know that if actually it does work, then it's linked up correctly and it's really obvious
31
00:02:24,330 --> 00:02:26,460
when it doesn't like right now.
32
00:02:26,460 --> 00:02:32,070
And the reason here is because my style.css is actually outside this folder.
33
00:02:32,070 --> 00:02:39,000
It's just floating about somewhere and I have to get it so that it's at the location that I specified
34
00:02:39,000 --> 00:02:41,580
in the external stylesheet link.
35
00:02:41,580 --> 00:02:47,250
So I don't want you to change anything inside the index.html.
36
00:02:47,250 --> 00:02:55,080
Instead, all of your work is going to happen inside the CSS file, which you will create and you will
37
00:02:55,080 --> 00:03:03,270
incorporate into your project using this file path to make sure that you understand how file paths work
38
00:03:03,270 --> 00:03:06,330
and how you can create this for yourself in the future.
39
00:03:07,500 --> 00:03:14,280
Now, if we scroll down, you can see there's five different colors, five different images, and there
40
00:03:14,280 --> 00:03:16,950
are some h2's and h1' s.
41
00:03:17,460 --> 00:03:24,540
In order to complete this project, I've created some steps for you in the TODOs which you can follow.
42
00:03:24,540 --> 00:03:29,610
Alternatively, you can simply look at the goal image and try to figure that out yourself.
43
00:03:29,640 --> 00:03:36,000
You can either use a stepwise approach in the TODOs or you can use the goal and do everything yourself.
44
00:03:36,000 --> 00:03:37,890
It totally is up to you.
45
00:03:38,640 --> 00:03:45,870
But what you're aiming for in the final version of the website, which you can view by right-clicking
46
00:03:45,870 --> 00:03:49,290
on solution.html, opening it up in the preview.
47
00:03:49,290 --> 00:03:55,590
And the most important things I want to point out is that the images are squares.
48
00:03:55,620 --> 00:04:02,120
They are 200 pixels by 200 pixels, so 200 pixels high, 200 pixels wide.
49
00:04:02,120 --> 00:04:09,590
Secondly, the font-weight of these h2's are different from normal h2's.
50
00:04:09,620 --> 00:04:11,510
They're actually a lot lighter.
51
00:04:11,510 --> 00:04:18,140
So we've set the font-weight to be normal rather than the default, which is h2's get bolded.
52
00:04:18,320 --> 00:04:23,450
The next thing is that the color of the text should match the meaning.
53
00:04:23,450 --> 00:04:27,320
So rojo means red, azul means blue,
54
00:04:27,320 --> 00:04:32,300
and because in our index.html I've matched each of them up together,
55
00:04:32,300 --> 00:04:39,020
but also you can look at the IDs if you don't know Spanish words because we're learning them after all,
56
00:04:39,020 --> 00:04:45,040
right? So yellow is amarillo, green is verde, and so on and so forth.
57
00:04:45,050 --> 00:04:53,510
So I want you to make sure that these h2's have a text color that matches whatever it is supposed
58
00:04:53,510 --> 00:04:53,900
to be.
59
00:04:53,900 --> 00:04:56,780
So blue or orange or green or whichever.
60
00:04:56,780 --> 00:04:59,420
So if you get confused, look at the goal.png.
61
00:04:59,960 --> 00:05:03,380
If you want to go step by step, then look at the TODOs at the bottom.
62
00:05:03,380 --> 00:05:09,050
But importantly, don't write anything or change anything in the index.html.
63
00:05:09,080 --> 00:05:11,600
All your work goes into the CSS file.
64
00:05:11,900 --> 00:05:14,600
Pause the video and give this a go now.
65
00:05:19,890 --> 00:05:20,250
All right.
66
00:05:20,250 --> 00:05:22,230
So let's run through the solution together.
67
00:05:22,230 --> 00:05:27,450
So the first thing we're going to do is we're going to make sure that the solution folder is collapsed,
68
00:05:27,450 --> 00:05:29,160
so it's not confusing,
69
00:05:29,160 --> 00:05:37,200
and then we're going to select this folder and then add a new file, which I'll call style.css.
70
00:05:37,230 --> 00:05:41,310
Remember, the file name has to match what it's referred to here
71
00:05:41,310 --> 00:05:42,330
exactly.
72
00:05:42,330 --> 00:05:48,630
Sometimes you'll see people have styles.css, sometimes you'll see main.css, but as long as the
73
00:05:48,630 --> 00:05:50,520
file name matches, it doesn't really matter.
74
00:05:50,520 --> 00:05:52,770
It's up to you how you want to name it.
75
00:05:53,130 --> 00:06:00,360
Once I've created that, let's just make sure that my CSS file is properly linked up by doing that background-color
76
00:06:00,360 --> 00:06:01,950
change.
77
00:06:01,950 --> 00:06:06,090
So let's change it to red and then let's go ahead and preview this
78
00:06:06,090 --> 00:06:10,290
and if the background is red, then it means that it works.
79
00:06:10,290 --> 00:06:14,550
So I can now delete this and get rid of that horrible background.
80
00:06:15,120 --> 00:06:23,230
The next step is to go ahead and use CSS to style each of the color titles so that the color matches
81
00:06:23,230 --> 00:06:24,070
the meaning.
82
00:06:24,460 --> 00:06:34,360
The first one that we want to select is this h2, which displays Rojo and it has the ID of red.
83
00:06:34,360 --> 00:06:37,930
So remember, IDs are unique, so we can simply select that.
84
00:06:37,930 --> 00:06:45,190
So let's select the element with an ID of red and set its color to red.
85
00:06:45,580 --> 00:06:49,390
And so we can do the same thing for the rest of the colors.
86
00:06:49,390 --> 00:06:52,390
So now they're all matching with their meaning.
87
00:06:52,660 --> 00:06:59,620
The next step is to use CSS to change all the color titles, to have a different font-weight.
88
00:06:59,620 --> 00:07:02,710
And this is what we want the font-weight of normal.
89
00:07:02,710 --> 00:07:10,180
If we want to select all the h2s, then we're going to have a problem because this one is also an h2
90
00:07:10,180 --> 00:07:13,690
and we don't want that one to have a normal font-weight.
91
00:07:13,690 --> 00:07:15,640
We still want that to be bold.
92
00:07:15,640 --> 00:07:18,970
We want these to have the lower font-weight.
93
00:07:19,000 --> 00:07:22,060
So what is unique to all of these?
94
00:07:22,060 --> 00:07:29,200
Well, we've applied a class of "color-title" to each of them, which this h2 does not have.
95
00:07:29,230 --> 00:07:36,880
Then that means that we can simply select "color-title" and then apply the font weight to all of
96
00:07:36,880 --> 00:07:38,680
those with that same class.
97
00:07:38,680 --> 00:07:43,540
And you can see that differentiates between this h2 and this h2.
98
00:07:43,540 --> 00:07:49,780
And instead all of these which are grouped together have that style applied.
99
00:07:50,020 --> 00:07:53,410
Now the final thing we need to do is to use CSS,
100
00:07:53,440 --> 00:08:00,070
note, not HTML to make all the images 200 pixels high and 200 pixels wide.
101
00:08:00,790 --> 00:08:02,200
How can we do that?
102
00:08:02,200 --> 00:08:06,670
Well, we can simply select the image element.
103
00:08:06,670 --> 00:08:17,230
So this is using an element selector and we can set the height to 200 pixels and the width to 200 pixels.
104
00:08:17,410 --> 00:08:19,180
And there you have it.
105
00:08:19,180 --> 00:08:26,140
All of our images are now squares matching the height and width that we've specified.
106
00:08:26,380 --> 00:08:30,820
You can of course change this and personalize it as much as you like.
107
00:08:30,820 --> 00:08:36,820
Change up the colors or change up the words, learn the colors in a different language, make things
108
00:08:36,820 --> 00:08:39,789
even more beautiful using the styling that you've learned.
109
00:08:39,820 --> 00:08:46,180
But in the next section, we're going to be covering more about different CSS rules and you'll have
110
00:08:46,180 --> 00:08:50,320
more tools at your disposal in order to style your websites.
111
00:08:50,470 --> 00:08:56,680
So I hope you have fun in this section where we introduce you to CSS. Once you're ready,
112
00:08:56,710 --> 00:09:03,760
maybe tomorrow, maybe the next day, head over to the next section and continue learning about intermediate
113
00:09:03,760 --> 00:09:05,740
aspects of CSS.
114
00:09:05,770 --> 00:09:08,440
For all of that and more, I'll see you there.
11745
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.