All language subtitles for CSS Tutorial - Zero to Hero (Complete Course)-en
Afrikaans
Albanian
Amharic
Arabic
Armenian
Azerbaijani
Basque
Belarusian
Bengali
Bosnian
Bulgarian
Catalan
Cebuano
Chichewa
Chinese (Simplified)
Chinese (Traditional)
Corsican
Croatian
Czech
Danish
Dutch
English
Esperanto
Estonian
Filipino
Finnish
French
Frisian
Galician
Georgian
German
Greek
Gujarati
Haitian Creole
Hausa
Hawaiian
Hebrew
Hindi
Hmong
Hungarian
Icelandic
Igbo
Indonesian
Irish
Italian
Japanese
Javanese
Kannada
Kazakh
Khmer
Korean
Kurdish (Kurmanji)
Kyrgyz
Lao
Latin
Latvian
Lithuanian
Luxembourgish
Macedonian
Malagasy
Malay
Malayalam
Maltese
Maori
Marathi
Mongolian
Myanmar (Burmese)
Nepali
Norwegian
Pashto
Persian
Polish
Portuguese
Punjabi
Romanian
Russian
Samoan
Scots Gaelic
Serbian
Sesotho
Shona
Sindhi
Sinhala
Slovak
Slovenian
Somali
Spanish
Sundanese
Swahili
Swedish
Tajik
Tamil
Telugu
Thai
Turkish
Ukrainian
Urdu
Uzbek
Vietnamese
Welsh
Xhosa
Yiddish
Yoruba
Zulu
Odia (Oriya)
Kinyarwanda
Turkmen
Tatar
Uyghur
Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:00,210 --> 00:00:06,990
Hi, welcome to the CSS zero to hero course,
in this course, you're going to completely
2
00:00:06,990 --> 00:00:12,670
learn how to use CSS from the ground up, we're
going to cover every single concept or every
3
00:00:12,670 --> 00:00:18,109
major concept in CSS, and really build up
our knowledge of it. So before we move on,
4
00:00:18,109 --> 00:00:23,140
I just wanted to give you some motivation
on what you're going to be doing in this course.
5
00:00:23,140 --> 00:00:28,419
So you can, you know, really get excited about
the course and start jump, you just jump straight
6
00:00:28,419 --> 00:00:33,120
into learning. So first of all, let's look
at some of the stuff that we've done over
7
00:00:33,120 --> 00:00:38,870
the course. Now we start with a base website.
And over time, we style this and change up
8
00:00:38,870 --> 00:00:43,489
the website using every technique that we've
learned. So you can see that we've created
9
00:00:43,489 --> 00:00:47,870
multiple grids, colors, we've changed this
completely and transformed the website in
10
00:00:47,870 --> 00:00:53,239
every single way. We've also created things
like gradients. And we've also styled change
11
00:00:53,239 --> 00:00:58,059
our custom fonts, colors, and backgrounds.
We cover all of this in depth throughout the
12
00:00:58,059 --> 00:01:03,809
course. And we do it step by step so that
you don't rush through and forget anything.
13
00:01:03,809 --> 00:01:08,340
At the end of the course, there's also a little
challenge here, where you try to bring all
14
00:01:08,340 --> 00:01:13,590
your skills together and style a website from
scratch. Now there is a solution video, if
15
00:01:13,590 --> 00:01:17,909
you need it, maybe you just want to see another
opinion on it. But pretty much you're going
16
00:01:17,909 --> 00:01:22,450
to bring all the skills you learned in this
course together and create this nice website.
17
00:01:22,450 --> 00:01:28,460
It's responsive, it's got all sorts of layout
features. And it also has animations, you
18
00:01:28,460 --> 00:01:34,210
can see just like that. So that's some of
the actual website stuff we're going to be
19
00:01:34,210 --> 00:01:39,570
doing in the course. But why don't we look
at some of the code that we've written. So
20
00:01:39,570 --> 00:01:44,729
I created this file from the start, I didn't
have it at the start of this course. But at
21
00:01:44,729 --> 00:01:51,219
the end, you can see that we've written now,
well over 100 lines of code here. And I although
22
00:01:51,219 --> 00:01:56,030
it may look intimidating. Now, I do explain
every single part of it, so that at the end,
23
00:01:56,030 --> 00:02:02,409
you can just read this straightaway and understand
what's going on in an instant. There's also
24
00:02:02,409 --> 00:02:07,700
the styling for our solution video or for
the solution to the challenge here. So you
25
00:02:07,700 --> 00:02:12,410
can see we've got a bunch of stuff here. And
like I said, it may look confusing, but once
26
00:02:12,410 --> 00:02:19,580
we move on, this will make a lot more sense.
So that's pretty much it for the little achievements
27
00:02:19,580 --> 00:02:23,950
video for this course, I hope you're a little
bit motivated and excited to go forward and
28
00:02:23,950 --> 00:02:29,190
start learning about CSS is a pretty exciting
topic. And it can really advance your web
29
00:02:29,190 --> 00:02:32,171
development if you don't already know it.
Alright, let's get straight into it.
30
00:02:32,171 --> 00:02:33,171
Hi, welcome to the CSS zero to hero course,
in this course, you're going to completely
31
00:02:33,171 --> 00:02:34,171
learn how to use CSS from the ground up, we're
going to cover every single concept or every
32
00:02:34,171 --> 00:02:35,171
major concept in CSS, and really build up
our knowledge of it. So before we move on,
33
00:02:35,171 --> 00:02:36,171
I just wanted to give you some motivation
on what you're going to be doing in this course.
34
00:02:36,171 --> 00:02:37,171
So you can, you know, really get excited about
the course and start jump, you just jump straight
35
00:02:37,171 --> 00:02:38,171
into learning. So first of all, let's look
at some of the stuff that we've done over
36
00:02:38,171 --> 00:02:39,171
the course. Now we start with a base website.
And over time, we style this and change up
37
00:02:39,171 --> 00:02:40,171
the website using every technique that we've
learned. So you can see that we've created
38
00:02:40,171 --> 00:02:41,171
multiple grids, colors, we've changed this
completely and transformed the website in
39
00:02:41,171 --> 00:02:42,171
every single way. We've also created things
like gradients. And we've also styled change
40
00:02:42,171 --> 00:02:43,171
our custom fonts, colors, and backgrounds.
We cover all of this in depth throughout the
41
00:02:43,171 --> 00:02:44,171
course. And we do it step by step so that
you don't rush through and forget anything.
42
00:02:44,171 --> 00:02:45,171
At the end of the course, there's also a little
challenge here, where you try to bring all
43
00:02:45,171 --> 00:02:46,171
your skills together and style a website from
scratch. Now there is a solution video, if
44
00:02:46,171 --> 00:02:47,171
you need it, maybe you just want to see another
opinion on it. But pretty much you're going
45
00:02:47,171 --> 00:02:48,171
to bring all the skills you learned in this
course together and create this nice website.
46
00:02:48,171 --> 00:02:49,171
It's responsive, it's got all sorts of layout
features. And it also has animations, you
47
00:02:49,171 --> 00:02:50,171
can see just like that. So that's some of
the actual website stuff we're going to be
48
00:02:50,171 --> 00:02:51,171
doing in the course. But why don't we look
at some of the code that we've written. So
49
00:02:51,171 --> 00:02:52,171
I created this file from the start, I didn't
have it at the start of this course. But at
50
00:02:52,171 --> 00:02:53,171
the end, you can see that we've written now,
well over 100 lines of code here. And I although
51
00:02:53,171 --> 00:02:54,171
it may look intimidating. Now, I do explain
every single part of it, so that at the end,
52
00:02:54,171 --> 00:02:55,171
you can just read this straightaway and understand
what's going on in an instant. There's also
53
00:02:55,171 --> 00:02:56,171
the styling for our solution video or for
the solution to the challenge here. So you
54
00:02:56,171 --> 00:02:57,171
can see we've got a bunch of stuff here. And
like I said, it may look confusing, but once
55
00:02:57,171 --> 00:02:58,171
we move on, this will make a lot more sense.
So that's pretty much it for the little achievements
56
00:02:58,171 --> 00:02:59,171
video for this course, I hope you're a little
bit motivated and excited to go forward and
57
00:02:59,171 --> 00:03:00,171
start learning about CSS is a pretty exciting
topic. And it can really advance your web
58
00:03:00,171 --> 00:03:01,171
development if you don't already know it.
Alright, let's get straight into it.
59
00:03:01,171 --> 00:03:02,171
So in this video, I'm going to be giving a
quick introduction to the syllabus of the
60
00:03:02,171 --> 00:03:03,171
course. Now it is quite a long video. So if
you don't want to watch it, or if you don't
61
00:03:03,171 --> 00:03:04,171
really want to know an in depth analysis on
what the course is going to be covering, then
62
00:03:04,171 --> 00:03:05,171
you can go ahead and skip this video. All
I say is that please make sure that you read
63
00:03:05,171 --> 00:03:06,171
the prerequisites lecture that came before
this. Now, there are some very important details
64
00:03:06,171 --> 00:03:07,171
in there and some skills that you need to
know to move on with this course. And if you
65
00:03:07,171 --> 00:03:10,650
don't know them, you're going to have a very
difficult time picking up some of the language.
66
00:03:10,650 --> 00:03:17,060
Now there's only one real prerequisite, which
is HTML. But you can go ahead and read that.
67
00:03:17,060 --> 00:03:21,900
And just make sure that you have all the skills
necessary. Alright, so let's get started.
68
00:03:21,900 --> 00:03:27,810
And the first thing I want to talk about is
the section structure. So the section is just
69
00:03:27,810 --> 00:03:33,790
a it's a bunch of lectures. So these are video
lectures. And they're made in an interactive
70
00:03:33,790 --> 00:03:39,070
way. So you can see in this picture here,
I am coding along with a nice preview on the
71
00:03:39,070 --> 00:03:46,680
side showing what what our progress looks
like. So at the end of each section is a 10,
72
00:03:46,680 --> 00:03:52,050
a 10 question multiple choice quiz that covers
all of the skills learned in that section.
73
00:03:52,050 --> 00:03:57,220
So it's really encouraged to go and just try
it out and see if you know everything. And
74
00:03:57,220 --> 00:04:00,940
then that way you can diagnose yourself and
see maybe there's some skills that you're
75
00:04:00,940 --> 00:04:06,010
fuzzy on or you need to revisit. And on top
of that, I really encourage everyone who is
76
00:04:06,010 --> 00:04:10,790
following along in the course, to not just
watch and be a passive consumer, you know,
77
00:04:10,790 --> 00:04:15,000
really go out and try and use your skills
because otherwise you're not going to learn
78
00:04:15,000 --> 00:04:19,570
it. Otherwise, you're just gonna end up having
the information on your head. And especially
79
00:04:19,570 --> 00:04:24,789
when it comes to development programming,
you know, experiences everything, you can't
80
00:04:24,789 --> 00:04:31,430
just watch lectures and just magically be
able to do it. So I encourage you to go off
81
00:04:31,430 --> 00:04:35,870
and follow the lectures and try and really
use the skills that you learn in your own
82
00:04:35,870 --> 00:04:41,319
time and that will make sure that you have
the highest retention possible. So let's get
83
00:04:41,319 --> 00:04:46,479
straight into it. The first section, which
is the section we're in right now is the introductory
84
00:04:46,479 --> 00:04:51,270
section. So setting up the course and we also
install all the programs and software necessary
85
00:04:51,270 --> 00:04:56,819
to set up our working environment. So you
can follow along it's not necessary but it
86
00:04:56,819 --> 00:05:01,389
is highly recommended. Because if you're using
maybe Something else that you're not experienced
87
00:05:01,389 --> 00:05:06,289
with, you may have a hard time getting used
to the program and things like that. So I
88
00:05:06,289 --> 00:05:10,919
recommend you follow along and set up the
environment just like I do. So the second
89
00:05:10,919 --> 00:05:17,550
question of sorry, the second section is the
introduction to CSS. Now, unlike the first
90
00:05:17,550 --> 00:05:23,009
section, this is going to be looking at introducing
the actual CSS language, we're going to be
91
00:05:23,009 --> 00:05:28,090
looking at some theory behind it, where it's
used and what kind of a difference it makes,
92
00:05:28,090 --> 00:05:34,719
we're also going to be looking at creating
and linking our own CSS document to our page.
93
00:05:34,719 --> 00:05:39,539
So the third section is going to be looking
at our first real part of CSS. So these are
94
00:05:39,539 --> 00:05:44,120
the selectors and properties. Now, again,
you don't need to know any of these terms.
95
00:05:44,120 --> 00:05:49,349
I'm just going over like a kind of spit ball
kind of effect here, just trying to just skim
96
00:05:49,349 --> 00:05:54,189
over everything. So here we're going to learn
about a very important concept, which are
97
00:05:54,189 --> 00:05:59,259
selectors and properties, and how they really
play into CSS, we're also going to be learning
98
00:05:59,259 --> 00:06:03,969
about the different types of selectors and
where to use each one, depending on the situation.
99
00:06:03,969 --> 00:06:10,039
So you're going to learn that as well. next
section is where we start using the real power
100
00:06:10,039 --> 00:06:14,599
of CSS. So we're going to start using colors.
And we're going to be applying those colors
101
00:06:14,599 --> 00:06:19,419
to our page. So we're going to be learning
about different color types, how kind of a
102
00:06:19,419 --> 00:06:24,650
little bit of how colors are set up on the
computer. So things like RGB or other color
103
00:06:24,650 --> 00:06:29,719
codes, and then we're going to use them and
apply them using CSS to backgrounds and text
104
00:06:29,719 --> 00:06:34,870
and all sorts of other things. The next section
is going to be looking at mainly at text.
105
00:06:34,870 --> 00:06:40,710
So we're going to be looking at trying to
change the field style and look of text. So
106
00:06:40,710 --> 00:06:45,169
we're going to be changing the fonts the size,
we're also going to be changing the bolding,
107
00:06:45,169 --> 00:06:48,779
there are so many different things that you
can do in the section. And we're going to
108
00:06:48,779 --> 00:06:54,639
cover all of them then. So the next section
is where we will kind of take a turn from
109
00:06:54,639 --> 00:07:00,120
looking at styling and looking now at layout.
So we're going to be learning some more fundamental
110
00:07:00,120 --> 00:07:04,310
CSS concepts related to layout, we'll talk
about those when we get to it, then we're
111
00:07:04,310 --> 00:07:09,999
going to be applying them to actually change
the style or the layout of our page. So we're
112
00:07:09,999 --> 00:07:14,039
going to be moving items around, we're going
to resize them and do all sorts of things
113
00:07:14,039 --> 00:07:19,169
with them once we get to that point. The next
section we're going to look at is called Flexbox.
114
00:07:19,169 --> 00:07:23,249
Now I'm sure you've heard of this if you've
looked into any web development, but pretty
115
00:07:23,249 --> 00:07:29,490
much it's an alternate way to mess around
with the layout in CSS, and it is quite new.
116
00:07:29,490 --> 00:07:34,710
But it is a pretty commonly used concept today,
especially for Responsive layouts, making
117
00:07:34,710 --> 00:07:39,330
websites that can work on all devices. So
it's a pretty important concept there. So
118
00:07:39,330 --> 00:07:43,629
we're going to focus on the theory behind
Flexbox. First, talking about how it works,
119
00:07:43,629 --> 00:07:48,930
how it's set up. And then we're also going
to be applying it to real life talking about,
120
00:07:48,930 --> 00:07:53,509
you know, where it can be used some of the
benefits, and then actually using it in our
121
00:07:53,509 --> 00:07:58,830
own projects by creating our own Flexbox and
messing around with it. So we're going to
122
00:07:58,830 --> 00:08:03,599
do that as well. So the next section is pretty
similar to Section seven, it's going to be
123
00:08:03,599 --> 00:08:08,949
looking at a another alternative to using
normal layout features. in CSS. It's called
124
00:08:08,949 --> 00:08:13,629
grid. And there are a lot of similarities.
But we're also going to be talking about the
125
00:08:13,629 --> 00:08:20,219
differences. So along with going over a comprehensive
overview of kind of how grid works, we're
126
00:08:20,219 --> 00:08:25,319
also going to be going over some of the similarities
and differences kind of comparing it to Flexbox.
127
00:08:25,319 --> 00:08:30,120
And then we're going to talk about, you know
which one you should use in each individual
128
00:08:30,120 --> 00:08:36,440
situation. So the next section is probably
one of my favorites because it really puts
129
00:08:36,440 --> 00:08:41,620
all of the older kind of websites from the
new sites and separates them the modern sites
130
00:08:41,620 --> 00:08:46,150
from the old sites, and we're going to be
looking at animations and transitions. So
131
00:08:46,150 --> 00:08:49,970
first, we're going to look at transitions
and how to use pseudo selectors. Again, don't
132
00:08:49,970 --> 00:08:55,510
worry about our means to create these nice
smooth transitions. And then we're also going
133
00:08:55,510 --> 00:09:00,280
to be learning how to manipulate them. So
kind of change how a transition looks, we're
134
00:09:00,280 --> 00:09:05,790
also going to learn how to create a flight
and manipulate our own animation. So we create
135
00:09:05,790 --> 00:09:11,470
these animations from scratch using CSS. And
then we can kind of change them and change
136
00:09:11,470 --> 00:09:17,570
how they look based on what we want. So the
last section is a really interesting section,
137
00:09:17,570 --> 00:09:22,120
which kind of summarizes everything and test
your skills. So it starts with a 30 question
138
00:09:22,120 --> 00:09:27,350
final exam, which is a bunch of questions
from every single section or topic that we've
139
00:09:27,350 --> 00:09:33,840
covered. And it is it is a final exam. So
there is like a passing grade and everything
140
00:09:33,840 --> 00:09:39,030
like that. But again, if you fail, there's
no real consequences to it. It's just kind
141
00:09:39,030 --> 00:09:44,800
of a diagnostic tool to test where you are
in your CSS knowledge. And after that, it's
142
00:09:44,800 --> 00:09:50,040
followed by a really nice challenge, which
can help you know, really see where you're
143
00:09:50,040 --> 00:09:54,940
at, not from a theoretical standpoint, but
from an actual practical standpoint. So this
144
00:09:54,940 --> 00:09:59,420
challenge is going to be talked about later
and when to get to that point, but pretty
145
00:09:59,420 --> 00:10:04,280
much you're going to Be styling a website
from scratch, you're going to be given a blank
146
00:10:04,280 --> 00:10:08,320
HTML document or Well, it's not blank, it's
going to have content. But you're going to
147
00:10:08,320 --> 00:10:12,940
be given an HTML document with no styling.
And you have to style it yourself based on
148
00:10:12,940 --> 00:10:13,940
a list of
149
00:10:13,940 --> 00:10:19,920
So in this video, I'm going to be giving a
quick introduction to the syllabus of the
150
00:10:19,920 --> 00:10:24,790
course. Now it is quite a long video. So if
you don't want to watch it, or if you don't
151
00:10:24,790 --> 00:10:29,570
really want to know an in depth analysis on
what the course is going to be covering, then
152
00:10:29,570 --> 00:10:33,440
you can go ahead and skip this video. All
I say is that please make sure that you read
153
00:10:33,440 --> 00:10:38,460
the prerequisites lecture that came before
this. Now, there are some very important details
154
00:10:38,460 --> 00:10:43,140
in there and some skills that you need to
know to move on with this course. And if you
155
00:10:43,140 --> 00:10:46,200
don't know them, you're going to have a very
difficult time picking up some of the language.
156
00:10:46,200 --> 00:10:50,000
Now there's only one real prerequisite, which
is HTML. But you can go ahead and read that.
157
00:10:50,000 --> 00:10:55,200
And just make sure that you have all the skills
necessary. Alright, so let's get started.
158
00:10:55,200 --> 00:11:00,070
And the first thing I want to talk about is
the section structure. So the section is just
159
00:11:00,070 --> 00:11:03,130
a it's a bunch of lectures. So these are video
lectures. And they're made in an interactive
160
00:11:03,130 --> 00:11:07,280
way. So you can see in this picture here,
I am coding along with a nice preview on the
161
00:11:07,280 --> 00:11:11,840
side showing what what our progress looks
like. So at the end of each section is a 10,
162
00:11:11,840 --> 00:11:23,120
a 10 question multiple choice quiz that covers
all of the skills learned in that section.
163
00:11:23,120 --> 00:11:25,750
So it's really encouraged to go and just try
it out and see if you know everything. And
164
00:11:25,750 --> 00:11:29,050
then that way you can diagnose yourself and
see maybe there's some skills that you're
165
00:11:29,050 --> 00:11:31,450
fuzzy on or you need to revisit. And on top
of that, I really encourage everyone who is
166
00:11:31,450 --> 00:11:36,720
following along in the course, to not just
watch and be a passive consumer, you know,
167
00:11:36,720 --> 00:11:43,100
really go out and try and use your skills
because otherwise you're not going to learn
168
00:11:43,100 --> 00:11:48,360
it. Otherwise, you're just gonna end up having
the information on your head. And especially
169
00:11:48,360 --> 00:11:49,720
when it comes to development programming,
you know, experiences everything, you can't
170
00:11:49,720 --> 00:11:54,670
just watch lectures and just magically be
able to do it. So I encourage you to go off
171
00:11:54,670 --> 00:11:56,610
and follow the lectures and try and really
use the skills that you learn in your own
172
00:11:56,610 --> 00:12:00,050
time and that will make sure that you have
the highest retention possible. So let's get
173
00:12:00,050 --> 00:12:04,750
straight into it. The first section, which
is the section we're in right now is the introductory
174
00:12:04,750 --> 00:12:09,720
section. So setting up the course and we also
install all the programs and software necessary
175
00:12:09,720 --> 00:12:13,401
to set up our working environment. So you
can follow along it's not necessary but it
176
00:12:13,401 --> 00:12:17,050
is highly recommended. Because if you're using
maybe Something else that you're not experienced
177
00:12:17,050 --> 00:12:22,740
with, you may have a hard time getting used
to the program and things like that. So I
178
00:12:22,740 --> 00:12:31,280
recommend you follow along and set up the
environment just like I do. So the second
179
00:12:31,280 --> 00:12:37,580
question of sorry, the second section is the
introduction to CSS. Now, unlike the first
180
00:12:37,580 --> 00:12:42,860
section, this is going to be looking at introducing
the actual CSS language, we're going to be
181
00:12:42,860 --> 00:12:46,170
looking at some theory behind it, where it's
used and what kind of a difference it makes,
182
00:12:46,170 --> 00:12:49,720
we're also going to be looking at creating
and linking our own CSS document to our page.
183
00:12:49,720 --> 00:12:54,660
So the third section is going to be looking
at our first real part of CSS. So these are
184
00:12:54,660 --> 00:12:56,740
the selectors and properties. Now, again,
you don't need to know any of these terms.
185
00:12:56,740 --> 00:13:02,200
I'm just going over like a kind of spit ball
kind of effect here, just trying to just skim
186
00:13:02,200 --> 00:13:06,840
over everything. So here we're going to learn
about a very important concept, which are
187
00:13:06,840 --> 00:13:08,620
selectors and properties, and how they really
play into CSS, we're also going to be learning
188
00:13:08,620 --> 00:13:11,830
about the different types of selectors and
where to use each one, depending on the situation.
189
00:13:11,830 --> 00:13:14,770
So you're going to learn that as well. next
section is where we start using the real power
190
00:13:14,770 --> 00:13:20,130
of CSS. So we're going to start using colors.
And we're going to be applying those colors
191
00:13:20,130 --> 00:13:24,710
to our page. So we're going to be learning
about different color types, how kind of a
192
00:13:24,710 --> 00:13:31,720
little bit of how colors are set up on the
computer. So things like RGB or other color
193
00:13:31,720 --> 00:13:37,010
codes, and then we're going to use them and
apply them using CSS to backgrounds and text
194
00:13:37,010 --> 00:13:42,340
and all sorts of other things. The next section
is going to be looking at mainly at text.
195
00:13:42,340 --> 00:13:52,980
So we're going to be looking at trying to
change the field style and look of text. So
196
00:13:52,980 --> 00:13:59,640
we're going to be changing the fonts the size,
we're also going to be changing the bolding,
197
00:13:59,640 --> 00:14:07,350
there are so many different things that you
can do in the section. And we're going to
198
00:14:07,350 --> 00:14:11,350
cover all of them then. So the next section
is where we will kind of take a turn from
199
00:14:11,350 --> 00:14:15,510
looking at styling and looking now at layout.
So we're going to be learning some more fundamental
200
00:14:15,510 --> 00:14:18,890
CSS concepts related to layout, we'll talk
about those when we get to it, then we're
201
00:14:18,890 --> 00:14:29,330
going to be applying them to actually change
the style or the layout of our page. So we're
202
00:14:29,330 --> 00:14:37,840
going to be moving items around, we're going
to resize them and do all sorts of things
203
00:14:37,840 --> 00:14:42,960
with them once we get to that point. The next
section we're going to look at is called Flexbox.
204
00:14:42,960 --> 00:14:50,111
Now I'm sure you've heard of this if you've
looked into any web development, but pretty
205
00:14:50,111 --> 00:14:53,600
much it's an alternate way to mess around
with the layout in CSS, and it is quite new.
206
00:14:53,600 --> 00:14:56,210
But it is a pretty commonly used concept today,
especially for Responsive layouts, making
207
00:14:56,210 --> 00:15:00,420
websites that can work on all devices. So
it's a pretty important concept there. So
208
00:15:00,420 --> 00:15:03,340
we're going to focus on the theory behind
Flexbox. First, talking about how it works,
209
00:15:03,340 --> 00:15:09,200
how it's set up. And then we're also going
to be applying it to real life talking about,
210
00:15:09,200 --> 00:15:15,430
you know, where it can be used some of the
benefits, and then actually using it in our
211
00:15:15,430 --> 00:15:19,530
own projects by creating our own Flexbox and
messing around with it. So we're going to
212
00:15:19,530 --> 00:15:24,560
do that as well. So the next section is pretty
similar to Section seven, it's going to be
213
00:15:24,560 --> 00:15:28,350
looking at a another alternative to using
normal layout features. in CSS. It's called
214
00:15:28,350 --> 00:15:31,970
grid. And there are a lot of similarities.
But we're also going to be talking about the
215
00:15:31,970 --> 00:15:39,190
differences. So along with going over a comprehensive
overview of kind of how grid works, we're
216
00:15:39,190 --> 00:15:44,660
also going to be going over some of the similarities
and differences kind of comparing it to Flexbox.
217
00:15:44,660 --> 00:15:50,010
And then we're going to talk about, you know
which one you should use in each individual
218
00:15:50,010 --> 00:15:55,340
situation. So the next section is probably
one of my favorites because it really puts
219
00:15:55,340 --> 00:15:59,370
all of the older kind of websites from the
new sites and separates them the modern sites
220
00:15:59,370 --> 00:16:03,690
from the old sites, and we're going to be
looking at animations and transitions. So
221
00:16:03,690 --> 00:16:08,000
first, we're going to look at transitions
and how to use pseudo selectors. Again, don't
222
00:16:08,000 --> 00:16:12,310
worry about our means to create these nice
smooth transitions. And then we're also going
223
00:16:12,310 --> 00:16:18,470
to be learning how to manipulate them. So
kind of change how a transition looks, we're
224
00:16:18,470 --> 00:16:24,270
also going to learn how to create a flight
and manipulate our own animation. So we create
225
00:16:24,270 --> 00:16:30,370
these animations from scratch using CSS. And
then we can kind of change them and change
226
00:16:30,370 --> 00:16:36,140
how they look based on what we want. So the
last section is a really interesting section,
227
00:16:36,140 --> 00:16:41,890
which kind of summarizes everything and test
your skills. So it starts with a 30 question
228
00:16:41,890 --> 00:16:45,830
final exam, which is a bunch of questions
from every single section or topic that we've
229
00:16:45,830 --> 00:16:50,850
covered. And it is it is a final exam. So
there is like a passing grade and everything
230
00:16:50,850 --> 00:16:53,870
like that. But again, if you fail, there's
no real consequences to it. It's just kind
231
00:16:53,870 --> 00:16:58,860
of a diagnostic tool to test where you are
in your CSS knowledge. And after that, it's
232
00:16:58,860 --> 00:17:06,539
followed by a really nice challenge, which
can help you know, really see where you're
233
00:17:06,539 --> 00:17:13,749
at, not from a theoretical standpoint, but
from an actual practical standpoint. So this
234
00:17:13,749 --> 00:17:18,990
challenge is going to be talked about later
and when to get to that point, but pretty
235
00:17:18,990 --> 00:17:23,140
much you're going to Be styling a website
from scratch, you're going to be given a blank
236
00:17:23,140 --> 00:17:27,510
HTML document or Well, it's not blank, it's
going to have content. But you're going to
237
00:17:27,510 --> 00:17:31,659
be given an HTML document with no styling.
And you have to style it yourself based on
238
00:17:31,659 --> 00:17:32,659
a list of
239
00:17:32,659 --> 00:17:35,999
based on a list of tasks given in the document.
Now, don't worry too much about that. But
240
00:17:35,999 --> 00:17:39,840
pretty much there is a solution video that
I created to style it based on how I want
241
00:17:39,840 --> 00:17:44,919
the website to look. But again, it's not kind
of like an iron fist thing, you can go and
242
00:17:44,919 --> 00:17:50,909
be creative with it once you get to that point.
Because once you learn all that CSS, what's
243
00:17:50,909 --> 00:17:55,720
the point, if you just have to conform to
something, you can really unleash your creative
244
00:17:55,720 --> 00:17:58,650
freedom through CSS, once you learn all the
skills necessary. So again, it will be talked
245
00:17:58,650 --> 00:18:01,840
about in a lot more detail once we get to
that point. But for now, that's just a quick
246
00:18:01,840 --> 00:18:04,179
overview of what it's going to look like.
From here. Alright, so there's a quick overview
247
00:18:04,179 --> 00:18:09,049
of what the course is going to go over some
of the topics. Now, again, this isn't a, you
248
00:18:09,049 --> 00:18:13,990
know, kind of a strict video on, you know,
this is what we're going to learn. And if
249
00:18:13,990 --> 00:18:20,289
you don't learn it, that's it. It's just kind
of showing you what you're going to be getting
250
00:18:20,289 --> 00:18:26,890
out of the course, so that you can really
get a view into it before you start working
251
00:18:26,890 --> 00:18:28,929
on the course. Alright, let's get started.
252
00:18:28,929 --> 00:18:32,950
based on a list of tasks given in the document.
Now, don't worry too much about that. But
253
00:18:32,950 --> 00:18:35,690
pretty much there is a solution video that
I created to style it based on how I want
254
00:18:35,690 --> 00:18:41,419
the website to look. But again, it's not kind
of like an iron fist thing, you can go and
255
00:18:41,419 --> 00:18:45,340
be creative with it once you get to that point.
Because once you learn all that CSS, what's
256
00:18:45,340 --> 00:18:50,279
the point, if you just have to conform to
something, you can really unleash your creative
257
00:18:50,279 --> 00:18:54,240
freedom through CSS, once you learn all the
skills necessary. So again, it will be talked
258
00:18:54,240 --> 00:18:59,419
about in a lot more detail once we get to
that point. But for now, that's just a quick
259
00:18:59,419 --> 00:19:05,029
overview of what it's going to look like.
From here. Alright, so there's a quick overview
260
00:19:05,029 --> 00:19:11,169
of what the course is going to go over some
of the topics. Now, again, this isn't a, you
261
00:19:11,169 --> 00:19:17,429
know, kind of a strict video on, you know,
this is what we're going to learn. And if
262
00:19:17,429 --> 00:19:22,909
you don't learn it, that's it. It's just kind
of showing you what you're going to be getting
263
00:19:22,909 --> 00:19:27,600
out of the course, so that you can really
get a view into it before you start working
264
00:19:27,600 --> 00:19:29,840
on the course. Alright, let's get started.
265
00:19:29,840 --> 00:19:35,250
So in this video, I'm just going to be talking
about some of the software that we're going
266
00:19:35,250 --> 00:19:39,090
to be using in this course. Now, there's not
a lot of actual software, since most of the
267
00:19:39,090 --> 00:19:40,830
stuff we're going to be doing is built straight
into CSS and HTML. But we do need a text editor.
268
00:19:40,830 --> 00:19:45,049
And if you want to go ahead and use Notepad,
go ahead. But I wouldn't really recommend
269
00:19:45,049 --> 00:19:48,980
that because it is quite hard to use when
you're developing things. So I recommend this
270
00:19:48,980 --> 00:19:52,480
text editor right here. It's called Sublime
Text, and gives you all of the color coding
271
00:19:52,480 --> 00:19:58,690
and formatting that you need, it makes things
really easy for you. So you can go ahead to
272
00:19:58,690 --> 00:20:03,529
the website. Here, it's attached to the lecture
resources, if you go ahead and click in the
273
00:20:03,529 --> 00:20:08,910
top left corner, in the bullet list icon,
you can go ahead and find the lecture contents
274
00:20:08,910 --> 00:20:13,300
and downloadable resources. So go ahead, check
out this website. And depending whether you're
275
00:20:13,300 --> 00:20:19,549
on Windows or Mac or Linux, you go ahead and
download this. And then it should be pretty
276
00:20:19,549 --> 00:20:23,950
much it. So this is what its gonna look like
when you're inside, I was just typing a little
277
00:20:23,950 --> 00:20:28,380
bit of stuff here making things making sure
things were working. So there you go, this
278
00:20:28,380 --> 00:20:33,940
is what it's gonna look like, once you download
it, we'll go through and actually set everything
279
00:20:33,940 --> 00:20:43,029
up as we go through this course. Alright,
let's move on. So before we move on, I just
280
00:20:43,029 --> 00:20:48,510
want to talk about finding project files.
Now, I do do a lot of code throughout each
281
00:20:48,510 --> 00:20:51,570
lecture. And if you want to keep track of
those, or maybe have some sort of working
282
00:20:51,570 --> 00:20:54,529
reference of what's going on, then I highly
recommend that you go and check out the GitHub
283
00:20:54,529 --> 00:20:57,690
repository that I created for all the content
of this course. Now, if you don't know what
284
00:20:57,690 --> 00:21:01,539
Git is, or how to use it, don't worry, I'm
going to show an alternative to that in just
285
00:21:01,539 --> 00:21:02,809
a second, using this platform. But pretty
much this is going to contain all the history
286
00:21:02,809 --> 00:21:05,789
of every single lecture. Now, if you know
how to use Git, you can download this and
287
00:21:05,789 --> 00:21:09,840
check out each state. But if you don't know,
then all you have to do is head over to the
288
00:21:09,840 --> 00:21:12,470
main page. And right here under commit, it's
pretty much going to show every single lecture
289
00:21:12,470 --> 00:21:16,679
changes. So for example, I have seven to eight
item alignment, so I can click on it. And
290
00:21:16,679 --> 00:21:21,340
when I click on this, it shows all of the
changes I have made to both files or any files
291
00:21:21,340 --> 00:21:27,850
that I've changed. So for example, you can
see here, it has one changed file. And you
292
00:21:27,850 --> 00:21:32,399
can see I've added a bunch of stuff here.
So you can kind of review what I've done over
293
00:21:32,399 --> 00:21:36,289
the lecture. So you can just go ahead and
check it out. I've attached this to the lecture
294
00:21:36,289 --> 00:21:38,630
resources, if you want to go and look at it.
Now, this does contain all of the history,
295
00:21:38,630 --> 00:21:42,230
all of the things that I've done over the
course. So you can go review, maybe look at
296
00:21:42,230 --> 00:21:45,889
the code. And you can also download it, you
can download the actual file or the the repository
297
00:21:45,889 --> 00:21:51,640
from here. So you can just download that very
easily. And other than that, you can find
298
00:21:51,640 --> 00:21:57,759
all of the project files on here, if you ever
need them. So if you want to, you know, maybe
299
00:21:57,759 --> 00:22:02,749
bookmark this or keep this somewhere or Notepad,
just to make sure that you have a reference
300
00:22:02,749 --> 00:22:06,539
of it throughout the course in case you ever
want to go and review the contents or changes
301
00:22:06,539 --> 00:22:13,159
of some lecture. You will have it there. Alright,
let's move on.
302
00:22:13,159 --> 00:22:17,679
So in this video, I'm just going to be talking
about some of the software that we're going
303
00:22:17,679 --> 00:22:21,830
to be using in this course. Now, there's not
a lot of actual software, since most of the
304
00:22:21,830 --> 00:22:25,500
stuff we're going to be doing is built straight
into CSS and HTML. But we do need a text editor.
305
00:22:25,500 --> 00:22:28,749
And if you want to go ahead and use Notepad,
go ahead. But I wouldn't really recommend
306
00:22:28,749 --> 00:22:35,249
that because it is quite hard to use when
you're developing things. So I recommend this
307
00:22:35,249 --> 00:22:38,380
text editor right here. It's called Sublime
Text, and gives you all of the color coding
308
00:22:38,380 --> 00:22:42,100
and formatting that you need, it makes things
really easy for you. So you can go ahead to
309
00:22:42,100 --> 00:22:44,450
the website. Here, it's attached to the lecture
resources, if you go ahead and click in the
310
00:22:44,450 --> 00:22:49,009
top left corner, in the bullet list icon,
you can go ahead and find the lecture contents
311
00:22:49,009 --> 00:22:56,910
and downloadable resources. So go ahead, check
out this website. And depending whether you're
312
00:22:56,910 --> 00:23:01,519
on Windows or Mac or Linux, you go ahead and
download this. And then it should be pretty
313
00:23:01,519 --> 00:23:06,770
much it. So this is what its gonna look like
when you're inside, I was just typing a little
314
00:23:06,770 --> 00:23:11,140
bit of stuff here making things making sure
things were working. So there you go, this
315
00:23:11,140 --> 00:23:15,899
is what it's gonna look like, once you download
it, we'll go through and actually set everything
316
00:23:15,899 --> 00:23:21,610
up as we go through this course. Alright,
let's move on. So before we move on, I just
317
00:23:21,610 --> 00:23:27,200
want to talk about finding project files.
Now, I do do a lot of code throughout each
318
00:23:27,200 --> 00:23:32,020
lecture. And if you want to keep track of
those, or maybe have some sort of working
319
00:23:32,020 --> 00:23:39,809
reference of what's going on, then I highly
recommend that you go and check out the GitHub
320
00:23:39,809 --> 00:23:45,029
repository that I created for all the content
of this course. Now, if you don't know what
321
00:23:45,029 --> 00:23:49,289
Git is, or how to use it, don't worry, I'm
going to show an alternative to that in just
322
00:23:49,289 --> 00:23:54,220
a second, using this platform. But pretty
much this is going to contain all the history
323
00:23:54,220 --> 00:24:10,009
of every single lecture. Now, if you know
how to use Git, you can download this and
324
00:24:10,009 --> 00:24:17,620
check out each state. But if you don't know,
then all you have to do is head over to the
325
00:24:17,620 --> 00:24:20,350
main page. And right here under commit, it's
pretty much going to show every single lecture
326
00:24:20,350 --> 00:24:26,130
changes. So for example, I have seven to eight
item alignment, so I can click on it. And
327
00:24:26,130 --> 00:24:32,789
when I click on this, it shows all of the
changes I have made to both files or any files
328
00:24:32,789 --> 00:24:40,499
that I've changed. So for example, you can
see here, it has one changed file. And you
329
00:24:40,499 --> 00:24:46,909
can see I've added a bunch of stuff here.
So you can kind of review what I've done over
330
00:24:46,909 --> 00:24:52,899
the lecture. So you can just go ahead and
check it out. I've attached this to the lecture
331
00:24:52,899 --> 00:24:58,620
resources, if you want to go and look at it.
Now, this does contain all of the history,
332
00:24:58,620 --> 00:25:04,880
all of the things that I've done over the
course. So you can go review, maybe look at
333
00:25:04,880 --> 00:25:10,640
the code. And you can also download it, you
can download the actual file or the the repository
334
00:25:10,640 --> 00:25:17,080
from here. So you can just download that very
easily. And other than that, you can find
335
00:25:17,080 --> 00:25:23,169
all of the project files on here, if you ever
need them. So if you want to, you know, maybe
336
00:25:23,169 --> 00:25:29,379
bookmark this or keep this somewhere or Notepad,
just to make sure that you have a reference
337
00:25:29,379 --> 00:25:34,950
of it throughout the course in case you ever
want to go and review the contents or changes
338
00:25:34,950 --> 00:25:38,799
of some lecture. You will have it there. Alright,
let's move on.
339
00:25:38,799 --> 00:25:45,320
So today, I'm going to be giving a quick introduction
to CSS, we're going to be going through what
340
00:25:45,320 --> 00:25:53,860
it actually is, why it's used and what actually
does CSS do. So before we get started, if
341
00:25:53,860 --> 00:26:03,320
you're just starting out this course and you
don't really know the prerequisites, make
342
00:26:03,320 --> 00:26:09,239
sure that you do have a little bit of HTML
experience. It's not recommended. Sorry, it's
343
00:26:09,239 --> 00:26:13,309
not needed. But it's highly recommended because
we're going to be using a lot of HTML in this
344
00:26:13,309 --> 00:26:16,549
course. And although we're not going to be
writing any directly, it would be really helpful
345
00:26:16,549 --> 00:26:25,039
to know some so I do offer a free HTML course.
It's really quick one and a half hours, you
346
00:26:25,039 --> 00:26:34,870
should be go good to go and up and running
in just one or two days. So if you don't know
347
00:26:34,870 --> 00:26:38,850
any HTML, you can go and check that out. And
if you do know, HTML, continue watching along.
348
00:26:38,850 --> 00:26:43,181
So first of all, let's get started, what actually
is CSS. So if you don't know what it stands
349
00:26:43,181 --> 00:26:48,980
for already, it's called Cascading Style Sheets.
So from that name, you can pretty much assume
350
00:26:48,980 --> 00:26:55,770
that this is used to style websites. So unlike
HTML, which is used to create structure and
351
00:26:55,770 --> 00:27:00,570
actual website content, this is mainly used
to give it that visual flair to make the websites
352
00:27:00,570 --> 00:27:06,019
look good. So CSS is pretty much what makes
a website standout from websites from the
353
00:27:06,019 --> 00:27:10,999
early days from the early 2000s, things like
that. So that's what really makes a website
354
00:27:10,999 --> 00:27:17,499
stand out is the CSS or the styling. So this
pretty much goes hand in hand with HTML. As
355
00:27:17,499 --> 00:27:25,379
it said, Here, they work almost consistently
together. And they're always used all like
356
00:27:25,379 --> 00:27:32,820
all the time together. So let's go ahead and
check out some pages that look with CSS and
357
00:27:32,820 --> 00:27:42,600
without. So you can see here that this is
the page with CSS. So you can change all of
358
00:27:42,600 --> 00:27:46,730
the layout options. You can make fonts, font
changes, text manipulation, all sorts of things,
359
00:27:46,730 --> 00:27:52,771
which we're all going to be doing in this
course are learning to do. And this is the
360
00:27:52,771 --> 00:27:56,350
website without HTML, sorry, without CSS looks
pretty standard, right? Obviously, this looks
361
00:27:56,350 --> 00:28:00,760
just like a normal website doesn't have any
HTML, apart from some font changes. But you
362
00:28:00,760 --> 00:28:04,230
can see that the difference that something
like this mix, CSS will completely change
363
00:28:04,230 --> 00:28:09,929
the way a website looks if it's used correctly.
So the next line is just a little bit of information
364
00:28:09,929 --> 00:28:13,499
about CSS, we're going to be going way more
in depth into all of these points later. So
365
00:28:13,499 --> 00:28:18,370
a CSS file is saved in the dot CSS format,
we're going to be doing that in the next few
366
00:28:18,370 --> 00:28:23,370
videos. There's some information about selectors
and things like that, like I said, you can
367
00:28:23,370 --> 00:28:27,779
just read through this, I'm not going to go
through it, because we're going to talk about
368
00:28:27,779 --> 00:28:32,619
it way more in detail in the next few sections.
But for now, this is just a little bit of
369
00:28:32,619 --> 00:28:35,529
general information about CSS. Alright, so
now that you know what CSS is, why don't we
370
00:28:35,529 --> 00:28:37,609
go ahead and get started working with CSS.
371
00:28:37,609 --> 00:28:41,974
So today, I'm going to be giving a quick introduction
to CSS, we're going to be going through what
372
00:28:41,974 --> 00:28:45,739
it actually is, why it's used and what actually
does CSS do. So before we get started, if
373
00:28:45,739 --> 00:28:49,260
you're just starting out this course and you
don't really know the prerequisites, make
374
00:28:49,260 --> 00:28:54,409
sure that you do have a little bit of HTML
experience. It's not recommended. Sorry, it's
375
00:28:54,409 --> 00:29:00,630
not needed. But it's highly recommended because
we're going to be using a lot of HTML in this
376
00:29:00,630 --> 00:29:04,580
course. And although we're not going to be
writing any directly, it would be really helpful
377
00:29:04,580 --> 00:29:08,200
to know some so I do offer a free HTML course.
It's really quick one and a half hours, you
378
00:29:08,200 --> 00:29:11,570
should be go good to go and up and running
in just one or two days. So if you don't know
379
00:29:11,570 --> 00:29:14,860
any HTML, you can go and check that out. And
if you do know, HTML, continue watching along.
380
00:29:14,860 --> 00:29:20,820
So first of all, let's get started, what actually
is CSS. So if you don't know what it stands
381
00:29:20,820 --> 00:29:25,590
for already, it's called Cascading Style Sheets.
So from that name, you can pretty much assume
382
00:29:25,590 --> 00:29:29,779
that this is used to style websites. So unlike
HTML, which is used to create structure and
383
00:29:29,779 --> 00:29:34,639
actual website content, this is mainly used
to give it that visual flair to make the websites
384
00:29:34,639 --> 00:29:38,470
look good. So CSS is pretty much what makes
a website standout from websites from the
385
00:29:38,470 --> 00:29:44,249
early days from the early 2000s, things like
that. So that's what really makes a website
386
00:29:44,249 --> 00:29:50,429
stand out is the CSS or the styling. So this
pretty much goes hand in hand with HTML. As
387
00:29:50,429 --> 00:29:53,480
it said, Here, they work almost consistently
together. And they're always used all like
388
00:29:53,480 --> 00:29:56,480
all the time together. So let's go ahead and
check out some pages that look with CSS and
389
00:29:56,480 --> 00:30:00,850
without. So you can see here that this is
the page with CSS. So you can change all of
390
00:30:00,850 --> 00:30:01,940
the layout options. You can make fonts, font
changes, text manipulation, all sorts of things,
391
00:30:01,940 --> 00:30:07,200
which we're all going to be doing in this
course are learning to do. And this is the
392
00:30:07,200 --> 00:30:09,940
website without HTML, sorry, without CSS looks
pretty standard, right? Obviously, this looks
393
00:30:09,940 --> 00:30:14,580
just like a normal website doesn't have any
HTML, apart from some font changes. But you
394
00:30:14,580 --> 00:30:18,630
can see that the difference that something
like this mix, CSS will completely change
395
00:30:18,630 --> 00:30:23,809
the way a website looks if it's used correctly.
So the next line is just a little bit of information
396
00:30:23,809 --> 00:30:30,499
about CSS, we're going to be going way more
in depth into all of these points later. So
397
00:30:30,499 --> 00:30:34,480
a CSS file is saved in the dot CSS format,
we're going to be doing that in the next few
398
00:30:34,480 --> 00:30:38,789
videos. There's some information about selectors
and things like that, like I said, you can
399
00:30:38,789 --> 00:30:42,009
just read through this, I'm not going to go
through it, because we're going to talk about
400
00:30:42,009 --> 00:30:50,909
it way more in detail in the next few sections.
But for now, this is just a little bit of
401
00:30:50,909 --> 00:30:56,940
general information about CSS. Alright, so
now that you know what CSS is, why don't we
402
00:30:56,940 --> 00:30:57,940
go ahead and get started working with CSS.
403
00:30:57,940 --> 00:31:02,610
So in this video, we're going to be creating
and linking a CSS stylesheet. So we're not
404
00:31:02,610 --> 00:31:06,729
actually going to be doing with anything with
it yet, we're just going to be creating it
405
00:31:06,729 --> 00:31:10,570
and linking it so that we can get started
and actually learn some of the properties
406
00:31:10,570 --> 00:31:21,299
in CSS. Alright, let's get started. So the
first thing I want to do is go ahead and create
407
00:31:21,299 --> 00:31:26,989
my CSS file. So what I'm going to do is go
into my Sublime Text or my text editor. Now,
408
00:31:26,989 --> 00:31:35,429
if you're not using this, and you know how
to use the other text editor that maybe you're
409
00:31:35,429 --> 00:31:39,070
using some something else like Visual Studio,
go ahead and use that if you know the shortcuts.
410
00:31:39,070 --> 00:31:45,049
But for now, I am going to use Sublime Text
on Sublime Text. To create a new file, you
411
00:31:45,049 --> 00:31:52,529
go Ctrl or Command n depending on what operating
system you're on. Once you're there, you can
412
00:31:52,529 --> 00:31:58,570
use Ctrl S to go ahead and save the file.
And right now I'm here. And what I want to
413
00:31:58,570 --> 00:32:05,190
do is create a new folder, a new directory
in my course content folder. Again, you can
414
00:32:05,190 --> 00:32:11,660
set this up however you like. But the way
I like doing it is creating a folder for every
415
00:32:11,660 --> 00:32:16,499
type of file. So that for example, when the
website gets very big, when you have multiple
416
00:32:16,499 --> 00:32:21,299
pages, multiple style sheets, everything stays
organized. So I'm going to go ahead and create
417
00:32:21,299 --> 00:32:26,679
that directory. Go ahead into my CSS folder
here. And I'm going to name this style dot
418
00:32:26,679 --> 00:32:33,399
CSS. So dot CSS, D is the file format used
to save CSS documents, and style, just kind
419
00:32:33,399 --> 00:32:40,359
of the standard name you use when you're saving
CSS documents. So once I go ahead, and I'm
420
00:32:40,359 --> 00:32:46,879
going to go ahead and save that. Now I have
my stylesheet created. But we don't actually
421
00:32:46,879 --> 00:32:50,279
have anything yet, because right now our HTML
page is blank and our CSS file is blank. So
422
00:32:50,279 --> 00:32:54,149
this is where knowing a little bit of HTML
comes in handy. First of all, I'm going to
423
00:32:54,149 --> 00:32:59,580
go ahead and create my boilerplate. I just
typed in HTML and hit tab. Again, I talked
424
00:32:59,580 --> 00:33:05,009
all about this in my other courses talking
about HTML. But there we go, we're going to
425
00:33:05,009 --> 00:33:10,759
go ahead and do that. I'm just going to say
my website here. And once that's done, I'm
426
00:33:10,759 --> 00:33:16,039
going to go ahead and link it. So how do we
actually do this? Well, what you want to do
427
00:33:16,039 --> 00:33:18,590
pretty much is just go into here and into
your head into the head portion of your website,
428
00:33:18,590 --> 00:33:23,769
you're going to go ahead and create a link
tag. So if you just take the link and hit
429
00:33:23,769 --> 00:33:28,100
tab in Sublime Text, it's going to create
the tag for you. So let's go ahead and break
430
00:33:28,100 --> 00:33:30,720
this down here. REL stylesheet is pretty much
saying that we're linking to a stylesheet.
431
00:33:30,720 --> 00:33:35,399
But then type says it's a CSS stylesheet.
So this is just kind of a more specific identifier.
432
00:33:35,399 --> 00:33:43,419
And then we have the href. So in the href.
This is where we're going to put the URL to
433
00:33:43,419 --> 00:33:49,549
our stylesheet. So if you don't already know
how to write file URLs, pretty much what we're
434
00:33:49,549 --> 00:33:56,269
going to do is first up move back in directory,
because right now we're inside here and there's
435
00:33:56,269 --> 00:34:03,710
no CSS. We want to go back to the top level.
So Going to go dot dot slash. Now remember,
436
00:34:03,710 --> 00:34:10,780
we're up here, I want to go into CSS. So I
hit CSS slash, and then style dot CSS, which
437
00:34:10,780 --> 00:34:19,270
has our endpoints or final destination. So
this is pretty much your basic link tag, this
438
00:34:19,270 --> 00:34:25,960
is how it works. You have all of your stuff
here and you created it. And from there, you
439
00:34:25,960 --> 00:34:34,669
can go ahead and pretty much do whatever you
want. So right here, I have my stylesheet
440
00:34:34,669 --> 00:34:39,240
linked and everything's working. But we don't
actually know if it works yet. So in the next
441
00:34:39,240 --> 00:34:43,870
video, we're actually going to be going through
and testing our stylesheet, I'm going to show
442
00:34:43,870 --> 00:34:50,010
you a few ways that you can do that. Alright,
let's move on. So today, I'm going to be showing
443
00:34:50,010 --> 00:34:55,399
you how you can test your CSS stylesheet.
So we've already created the file and linked
444
00:34:55,399 --> 00:35:01,140
it. But now we're actually going to go ahead
and test it because we don't know if this
445
00:35:01,140 --> 00:35:07,839
is working or not. So obviously, we don't
know anything about CSS yet. We don't know
446
00:35:07,839 --> 00:35:14,240
about selectors or properties or how to do
anything with them. But I just want you to
447
00:35:14,240 --> 00:35:22,520
keep this in mind so that when you know how
to do them, it becomes very easy to test these
448
00:35:22,520 --> 00:35:34,100
style sheets. So for a style sheet to work,
we need all of the properties that are in
449
00:35:34,100 --> 00:35:41,039
this file to appear on the page. So the easiest
way we can test it is but just by writing
450
00:35:41,039 --> 00:35:47,160
a random, obvious property, that's going to
change the way the website looks. If it's
451
00:35:47,160 --> 00:35:53,329
not working, then we know that something's
wrong with our link. So I'm going to go ahead
452
00:35:53,329 --> 00:35:55,890
and just create a property here. Now, you
don't know how to do any of this. So don't
453
00:35:55,890 --> 00:36:01,520
worry about it. We're going to learn how to
do all of this later. But what you want to
454
00:36:01,520 --> 00:36:06,700
do pretty much is create a random property,
you can go ahead and copy this on for now,
455
00:36:06,700 --> 00:36:13,289
I'm going to go ahead and refresh the page.
And you can see that this is bright red. Now
456
00:36:13,289 --> 00:36:17,520
if I go ahead and make the link wrong. So
if I, for example, remove a letter, you can
457
00:36:17,520 --> 00:36:23,000
see that it's still white, which means that
this isn't working. So this is pretty much
458
00:36:23,000 --> 00:36:29,310
the easiest way that you can test your stylesheet.
If it's working, it's just writing some random,
459
00:36:29,310 --> 00:36:34,079
obvious properties don't make them completely
non visible, you want to make sure that you
460
00:36:34,079 --> 00:36:38,050
can actually see the difference on the page.
And then you want to go ahead and refresh
461
00:36:38,050 --> 00:36:40,900
it. And if it's working, you will know that
this stylesheet is linked properly. Alright,
462
00:36:40,900 --> 00:36:41,900
let's move on.
463
00:36:41,900 --> 00:36:44,520
So in this video, we're going to be creating
and linking a CSS stylesheet. So we're not
464
00:36:44,520 --> 00:36:49,819
actually going to be doing with anything with
it yet, we're just going to be creating it
465
00:36:49,819 --> 00:36:58,430
and linking it so that we can get started
and actually learn some of the properties
466
00:36:58,430 --> 00:37:03,160
in CSS. Alright, let's get started. So the
first thing I want to do is go ahead and create
467
00:37:03,160 --> 00:37:07,069
my CSS file. So what I'm going to do is go
into my Sublime Text or my text editor. Now,
468
00:37:07,069 --> 00:37:13,549
if you're not using this, and you know how
to use the other text editor that maybe you're
469
00:37:13,549 --> 00:37:17,609
using some something else like Visual Studio,
go ahead and use that if you know the shortcuts.
470
00:37:17,609 --> 00:37:24,520
But for now, I am going to use Sublime Text
on Sublime Text. To create a new file, you
471
00:37:24,520 --> 00:37:30,480
go Ctrl or Command n depending on what operating
system you're on. Once you're there, you can
472
00:37:30,480 --> 00:37:35,559
use Ctrl S to go ahead and save the file.
And right now I'm here. And what I want to
473
00:37:35,559 --> 00:37:40,099
do is create a new folder, a new directory
in my course content folder. Again, you can
474
00:37:40,099 --> 00:37:45,400
set this up however you like. But the way
I like doing it is creating a folder for every
475
00:37:45,400 --> 00:37:51,510
type of file. So that for example, when the
website gets very big, when you have multiple
476
00:37:51,510 --> 00:37:56,790
pages, multiple style sheets, everything stays
organized. So I'm going to go ahead and create
477
00:37:56,790 --> 00:38:02,400
that directory. Go ahead into my CSS folder
here. And I'm going to name this style dot
478
00:38:02,400 --> 00:38:10,700
CSS. So dot CSS, D is the file format used
to save CSS documents, and style, just kind
479
00:38:10,700 --> 00:38:16,680
of the standard name you use when you're saving
CSS documents. So once I go ahead, and I'm
480
00:38:16,680 --> 00:38:22,920
going to go ahead and save that. Now I have
my stylesheet created. But we don't actually
481
00:38:22,920 --> 00:38:28,680
have anything yet, because right now our HTML
page is blank and our CSS file is blank. So
482
00:38:28,680 --> 00:38:35,890
this is where knowing a little bit of HTML
comes in handy. First of all, I'm going to
483
00:38:35,890 --> 00:38:41,010
go ahead and create my boilerplate. I just
typed in HTML and hit tab. Again, I talked
484
00:38:41,010 --> 00:38:44,920
all about this in my other courses talking
about HTML. But there we go, we're going to
485
00:38:44,920 --> 00:38:51,849
go ahead and do that. I'm just going to say
my website here. And once that's done, I'm
486
00:38:51,849 --> 00:38:59,339
going to go ahead and link it. So how do we
actually do this? Well, what you want to do
487
00:38:59,339 --> 00:39:07,150
pretty much is just go into here and into
your head into the head portion of your website,
488
00:39:07,150 --> 00:39:14,880
you're going to go ahead and create a link
tag. So if you just take the link and hit
489
00:39:14,880 --> 00:39:23,230
tab in Sublime Text, it's going to create
the tag for you. So let's go ahead and break
490
00:39:23,230 --> 00:39:28,040
this down here. REL stylesheet is pretty much
saying that we're linking to a stylesheet.
491
00:39:28,040 --> 00:39:34,710
But then type says it's a CSS stylesheet.
So this is just kind of a more specific identifier.
492
00:39:34,710 --> 00:39:44,060
And then we have the href. So in the href.
This is where we're going to put the URL to
493
00:39:44,060 --> 00:39:48,130
our stylesheet. So if you don't already know
how to write file URLs, pretty much what we're
494
00:39:48,130 --> 00:39:51,819
going to do is first up move back in directory,
because right now we're inside here and there's
495
00:39:51,819 --> 00:39:58,630
no CSS. We want to go back to the top level.
So Going to go dot dot slash. Now remember,
496
00:39:58,630 --> 00:40:05,500
we're up here, I want to go into CSS. So I
hit CSS slash, and then style dot CSS, which
497
00:40:05,500 --> 00:40:10,490
has our endpoints or final destination. So
this is pretty much your basic link tag, this
498
00:40:10,490 --> 00:40:16,990
is how it works. You have all of your stuff
here and you created it. And from there, you
499
00:40:16,990 --> 00:40:24,070
can go ahead and pretty much do whatever you
want. So right here, I have my stylesheet
500
00:40:24,070 --> 00:40:29,119
linked and everything's working. But we don't
actually know if it works yet. So in the next
501
00:40:29,119 --> 00:40:34,619
video, we're actually going to be going through
and testing our stylesheet, I'm going to show
502
00:40:34,619 --> 00:40:41,720
you a few ways that you can do that. Alright,
let's move on. So today, I'm going to be showing
503
00:40:41,720 --> 00:40:47,070
you how you can test your CSS stylesheet.
So we've already created the file and linked
504
00:40:47,070 --> 00:40:54,000
it. But now we're actually going to go ahead
and test it because we don't know if this
505
00:40:54,000 --> 00:40:58,290
is working or not. So obviously, we don't
know anything about CSS yet. We don't know
506
00:40:58,290 --> 00:41:03,710
about selectors or properties or how to do
anything with them. But I just want you to
507
00:41:03,710 --> 00:41:11,130
keep this in mind so that when you know how
to do them, it becomes very easy to test these
508
00:41:11,130 --> 00:41:15,470
style sheets. So for a style sheet to work,
we need all of the properties that are in
509
00:41:15,470 --> 00:41:21,680
this file to appear on the page. So the easiest
way we can test it is but just by writing
510
00:41:21,680 --> 00:41:25,470
a random, obvious property, that's going to
change the way the website looks. If it's
511
00:41:25,470 --> 00:41:30,200
not working, then we know that something's
wrong with our link. So I'm going to go ahead
512
00:41:30,200 --> 00:41:34,980
and just create a property here. Now, you
don't know how to do any of this. So don't
513
00:41:34,980 --> 00:41:39,589
worry about it. We're going to learn how to
do all of this later. But what you want to
514
00:41:39,589 --> 00:41:45,690
do pretty much is create a random property,
you can go ahead and copy this on for now,
515
00:41:45,690 --> 00:41:53,970
I'm going to go ahead and refresh the page.
And you can see that this is bright red. Now
516
00:41:53,970 --> 00:41:55,720
if I go ahead and make the link wrong. So
if I, for example, remove a letter, you can
517
00:41:55,720 --> 00:41:57,960
see that it's still white, which means that
this isn't working. So this is pretty much
518
00:41:57,960 --> 00:42:01,150
the easiest way that you can test your stylesheet.
If it's working, it's just writing some random,
519
00:42:01,150 --> 00:42:04,510
obvious properties don't make them completely
non visible, you want to make sure that you
520
00:42:04,510 --> 00:42:09,590
can actually see the difference on the page.
And then you want to go ahead and refresh
521
00:42:09,590 --> 00:42:14,680
it. And if it's working, you will know that
this stylesheet is linked properly. Alright,
522
00:42:14,680 --> 00:42:15,690
let's move on.
523
00:42:15,690 --> 00:42:20,700
So in this video, I'm going to be talking
about CSS selectors. I'm also going to be
524
00:42:20,700 --> 00:42:24,682
going through what they do and what types
of selectors there are. So you're probably
525
00:42:24,682 --> 00:42:25,682
wondering what a selector actually is, because
we haven't actually talked about this at all.
526
00:42:25,682 --> 00:42:29,869
And it's pretty much one half of everything
that you do in CSS. So as you know, you have
527
00:42:29,869 --> 00:42:33,470
two different documents, you have your HTML
document, which is kind of your structure
528
00:42:33,470 --> 00:42:39,470
gives all of the different text and content
of the page. And then you have your CSS document,
529
00:42:39,470 --> 00:42:42,250
which is going to be for all the styling.
Now because the two documents are kind of
530
00:42:42,250 --> 00:42:48,380
disconnected, you can't just go and type random
things and have them appear where you want
531
00:42:48,380 --> 00:42:51,160
them, you need a way to actually assign these
styles and properties to elements on the page.
532
00:42:51,160 --> 00:42:56,559
So we do this with something called selectors.
So selectors pretty much a way of grabbing
533
00:42:56,559 --> 00:43:02,780
an element from an HTML document, and then
styling it. So it's kind of like a target
534
00:43:02,780 --> 00:43:09,640
in a way. There are many different types of
selectors. And they all work in different
535
00:43:09,640 --> 00:43:16,329
ways and are used for different purposes.
So I'm going to be going through three with
536
00:43:16,329 --> 00:43:21,210
you in this video. So the first one is the
element selector. The element selector is
537
00:43:21,210 --> 00:43:28,640
the most basic of all of them, pretty much,
what you do is you find the name of the target
538
00:43:28,640 --> 00:43:30,319
that you want to select or target. So in this
case, it would be the paragraph tag or the
539
00:43:30,319 --> 00:43:34,640
p tag. And then you have the selector here.
So pretty much how a selector works is you
540
00:43:34,640 --> 00:43:39,589
just type out the selector. And then you have
curly braces, and then you have your properties,
541
00:43:39,589 --> 00:43:47,289
we'll go that will go with this in much more
depth towards the end of this section. So
542
00:43:47,289 --> 00:43:52,990
you go through and you select, you type out
your tag name. And pretty much what that's
543
00:43:52,990 --> 00:44:03,130
going to do is select all of the elements
on the document with that tag name. So there
544
00:44:03,130 --> 00:44:07,760
we go. That is the first one. The next is
the class selector. So the class selector
545
00:44:07,760 --> 00:44:11,619
is very similar to the element selector, except
it goes by class name. So you can see here
546
00:44:11,619 --> 00:44:16,400
that we have some class attributes here, we
assign the class, don't worry, we'll go through
547
00:44:16,400 --> 00:44:23,240
with this in the next video. But you can see
we assigned the class to these values. And
548
00:44:23,240 --> 00:44:30,650
pretty much all we have to do to references
is type dot, which is the class prefix for
549
00:44:30,650 --> 00:44:34,990
CSS, and then the name of the class and then
again, the properties. So you can actually
550
00:44:34,990 --> 00:44:39,630
use this cloud. The reason that we use classes
over things like element selectors, is because
551
00:44:39,630 --> 00:44:46,880
you can apply this class to specific items,
and it's only going to style those specific
552
00:44:46,880 --> 00:44:55,680
items. So for example, maybe if you had a
subtitle, and you only wanted to style that
553
00:44:55,680 --> 00:45:02,910
subtitle, you would go through and actually
apply that class to your subtitle, your element,
554
00:45:02,910 --> 00:45:07,770
whether it's a paragraph or a header. And
from there, you're going to go through and
555
00:45:07,770 --> 00:45:16,329
add it. So there we go. The next What I want
to talk about is the id selector. So these
556
00:45:16,329 --> 00:45:19,599
two, the class and id selector are pretty
much identical, you have your attribute where
557
00:45:19,599 --> 00:45:25,339
you assign the class or ID. But the only difference
is the prefix here is a hash symbol or an
558
00:45:25,339 --> 00:45:32,809
octave Thorpe or hash tag. So then you type
up the name of the ID, and it puts it here.
559
00:45:32,809 --> 00:45:36,210
Now, I am going to go through and actually
talk more about why when we should use classes
560
00:45:36,210 --> 00:45:42,470
and IDs. And I'm going to talk about some
of the differences between them. And although
561
00:45:42,470 --> 00:45:46,990
they look very similar, we actually have different
very different purposes for them, based on
562
00:45:46,990 --> 00:45:51,609
how you use them in your HTML document. So
those are some of the basics of selectors,
563
00:45:51,609 --> 00:46:00,790
like I said, we're gonna go through and pretty
much use this all the time during our course.
564
00:46:00,790 --> 00:46:06,070
So we're gonna go through use them and add
the properties. So it's pretty good that you
565
00:46:06,070 --> 00:46:10,760
get familiar with these now, so that when
we move on, this becomes kind of like second
566
00:46:10,760 --> 00:46:11,760
nature.
567
00:46:11,760 --> 00:46:16,099
So in this video, I'm going to be talking
about CSS selectors. I'm also going to be
568
00:46:16,099 --> 00:46:20,920
going through what they do and what types
of selectors there are. So you're probably
569
00:46:20,920 --> 00:46:25,180
wondering what a selector actually is, because
we haven't actually talked about this at all.
570
00:46:25,180 --> 00:46:30,390
And it's pretty much one half of everything
that you do in CSS. So as you know, you have
571
00:46:30,390 --> 00:46:33,809
two different documents, you have your HTML
document, which is kind of your structure
572
00:46:33,809 --> 00:46:38,310
gives all of the different text and content
of the page. And then you have your CSS document,
573
00:46:38,310 --> 00:46:39,930
which is going to be for all the styling.
Now because the two documents are kind of
574
00:46:39,930 --> 00:46:46,480
disconnected, you can't just go and type random
things and have them appear where you want
575
00:46:46,480 --> 00:46:49,970
them, you need a way to actually assign these
styles and properties to elements on the page.
576
00:46:49,970 --> 00:46:53,160
So we do this with something called selectors.
So selectors pretty much a way of grabbing
577
00:46:53,160 --> 00:46:56,839
an element from an HTML document, and then
styling it. So it's kind of like a target
578
00:46:56,839 --> 00:46:59,960
in a way. There are many different types of
selectors. And they all work in different
579
00:46:59,960 --> 00:47:03,250
ways and are used for different purposes.
So I'm going to be going through three with
580
00:47:03,250 --> 00:47:08,579
you in this video. So the first one is the
element selector. The element selector is
581
00:47:08,579 --> 00:47:14,260
the most basic of all of them, pretty much,
what you do is you find the name of the target
582
00:47:14,260 --> 00:47:21,170
that you want to select or target. So in this
case, it would be the paragraph tag or the
583
00:47:21,170 --> 00:47:25,710
p tag. And then you have the selector here.
So pretty much how a selector works is you
584
00:47:25,710 --> 00:47:31,670
just type out the selector. And then you have
curly braces, and then you have your properties,
585
00:47:31,670 --> 00:47:35,940
we'll go that will go with this in much more
depth towards the end of this section. So
586
00:47:35,940 --> 00:47:45,560
you go through and you select, you type out
your tag name. And pretty much what that's
587
00:47:45,560 --> 00:47:48,359
going to do is select all of the elements
on the document with that tag name. So there
588
00:47:48,359 --> 00:47:52,170
we go. That is the first one. The next is
the class selector. So the class selector
589
00:47:52,170 --> 00:47:55,880
is very similar to the element selector, except
it goes by class name. So you can see here
590
00:47:55,880 --> 00:48:03,599
that we have some class attributes here, we
assign the class, don't worry, we'll go through
591
00:48:03,599 --> 00:48:12,349
with this in the next video. But you can see
we assigned the class to these values. And
592
00:48:12,349 --> 00:48:20,980
pretty much all we have to do to references
is type dot, which is the class prefix for
593
00:48:20,980 --> 00:48:26,240
CSS, and then the name of the class and then
again, the properties. So you can actually
594
00:48:26,240 --> 00:48:30,119
use this cloud. The reason that we use classes
over things like element selectors, is because
595
00:48:30,119 --> 00:48:35,940
you can apply this class to specific items,
and it's only going to style those specific
596
00:48:35,940 --> 00:48:41,170
items. So for example, maybe if you had a
subtitle, and you only wanted to style that
597
00:48:41,170 --> 00:48:44,260
subtitle, you would go through and actually
apply that class to your subtitle, your element,
598
00:48:44,260 --> 00:48:48,750
whether it's a paragraph or a header. And
from there, you're going to go through and
599
00:48:48,750 --> 00:48:55,339
add it. So there we go. The next What I want
to talk about is the id selector. So these
600
00:48:55,339 --> 00:49:02,180
two, the class and id selector are pretty
much identical, you have your attribute where
601
00:49:02,180 --> 00:49:08,170
you assign the class or ID. But the only difference
is the prefix here is a hash symbol or an
602
00:49:08,170 --> 00:49:15,730
octave Thorpe or hash tag. So then you type
up the name of the ID, and it puts it here.
603
00:49:15,730 --> 00:49:21,240
Now, I am going to go through and actually
talk more about why when we should use classes
604
00:49:21,240 --> 00:49:25,579
and IDs. And I'm going to talk about some
of the differences between them. And although
605
00:49:25,579 --> 00:49:28,400
they look very similar, we actually have different
very different purposes for them, based on
606
00:49:28,400 --> 00:49:31,799
how you use them in your HTML document. So
those are some of the basics of selectors,
607
00:49:31,799 --> 00:49:35,650
like I said, we're gonna go through and pretty
much use this all the time during our course.
608
00:49:35,650 --> 00:49:41,349
So we're gonna go through use them and add
the properties. So it's pretty good that you
609
00:49:41,349 --> 00:49:46,390
get familiar with these now, so that when
we move on, this becomes kind of like second
610
00:49:46,390 --> 00:49:47,390
nature.
611
00:49:47,390 --> 00:49:52,570
So in this video, I am going to be teaching
you how to how to add classes in IDs to our
612
00:49:52,570 --> 00:49:57,351
document here and actually start using some
of these selectors. Now, I'm not going to
613
00:49:57,351 --> 00:50:02,829
teach you any of the properties yet, because
we're going to cover that in a little bit
614
00:50:02,829 --> 00:50:07,490
later in this section and in the next few
sections. But I'm just going to be teaching
615
00:50:07,490 --> 00:50:11,359
you how to get familiar with classes and IDs,
because they are by far the most commonly
616
00:50:11,359 --> 00:50:15,010
used selectors in CSS, I mean, sometimes very
uncommonly, you'd see some elements, selectors,
617
00:50:15,010 --> 00:50:19,200
and other types of selectors, which we're
going to go over in the next few videos. But
618
00:50:19,200 --> 00:50:23,650
the two most common that you're going to see
are our classes and IDs. So let's go through
619
00:50:23,650 --> 00:50:28,250
and get started. Now I have a bunch of HTML
content here, we're actually going to be using
620
00:50:28,250 --> 00:50:31,680
this and adding on to it for the rest of the
course, we're going to be styling this website
621
00:50:31,680 --> 00:50:38,359
fully. But let's actually go through and start
adding these classes and IDs. So the first
622
00:50:38,359 --> 00:50:42,090
thing you need to note, before we move on,
is that classes and IDs are different, you
623
00:50:42,090 --> 00:50:47,859
can't just use them interchangeably. And I'm
going to explain why in the next video. But
624
00:50:47,859 --> 00:50:53,099
for now, let's just pretend that they are
the same. And we can use them interchangeably
625
00:50:53,099 --> 00:50:58,800
because they have almost the same methods
of application. So let's go ahead now the
626
00:50:58,800 --> 00:51:04,970
first thing you want to do is identify the
element that you want to target. So first
627
00:51:04,970 --> 00:51:10,309
of all, let's just say I wanted to maybe make
the color of this red. Okay, so the color
628
00:51:10,309 --> 00:51:15,890
of this title. Now that we know we've targeted
it, we want to actually go through and edit
629
00:51:15,890 --> 00:51:22,589
it. So first thing, how do you think we would
go through and do this now if you're thinking
630
00:51:22,589 --> 00:51:27,440
going through and adding an element selector
or maybe adding some inline styles, if you
631
00:51:27,440 --> 00:51:32,900
know what that is, then you are right, partially,
but the only problem is that if there are
632
00:51:32,900 --> 00:51:39,900
any other h ones on this page, then it will
style all of them as well. And because we
633
00:51:39,900 --> 00:51:45,339
only want to style this title, that wouldn't
be really effective. So the best way to do
634
00:51:45,339 --> 00:51:51,181
this would be to use a class or an ID, I'm
going to go ahead and use a class. So the
635
00:51:51,181 --> 00:51:55,420
way the way you would do this is go through
and type in class as your attribute. And you
636
00:51:55,420 --> 00:52:00,840
would again, put this into the opening tag
of whatever target element you want to style.
637
00:52:00,840 --> 00:52:06,530
And in here, you're putting, you're gonna
put your class name. Now, if this isn't where
638
00:52:06,530 --> 00:52:12,220
you put your CSS prefix, this isn't where
you put the dots. As I explained in the last
639
00:52:12,220 --> 00:52:16,859
video, here, you're just going to type the
name of the class. So I'm going to go through
640
00:52:16,859 --> 00:52:21,490
and type a title, just like that. And you
can name this whatever you want. But I'd recommend
641
00:52:21,490 --> 00:52:27,500
keeping it short and sweet. You don't want
it to get too long, because then it's going
642
00:52:27,500 --> 00:52:33,740
to be really hard to work with. So once you've
applied that, and we go ahead and refresh
643
00:52:33,740 --> 00:52:35,710
the page, you can see that nothing's actually
there, it hasn't started working yet. That's
644
00:52:35,710 --> 00:52:40,290
because we haven't applied any styles. So
when we go over here, we need to actually
645
00:52:40,290 --> 00:52:51,130
select our element. So I'm going to go ahead
and add the prefix for a class, which is dot,
646
00:52:51,130 --> 00:52:57,670
and then the name of the class, which is title.
Then I'm going to open up these brackets and
647
00:52:57,670 --> 00:53:04,910
get started. So what I want to do here is
now apply on my properties. I'm going to be
648
00:53:04,910 --> 00:53:13,620
explaining you to you how to do all of this
in the next in future videos. of a for now,
649
00:53:13,620 --> 00:53:20,730
all you need to know is that the first thing
you need to do is select an element using
650
00:53:20,730 --> 00:53:29,589
some method. And then you're going to add
the properties. So I'm going to go ahead and
651
00:53:29,589 --> 00:53:34,359
refresh the page. And you can see it works
just like that. Now to prove to you that this
652
00:53:34,359 --> 00:53:38,869
works, I'm actually going to go through and
style just this about me right here, blue.
653
00:53:38,869 --> 00:53:42,680
So you can see we have more than one h2 on
the page, but there's only one h1. But let's
654
00:53:42,680 --> 00:53:47,760
say we wanted to only style this the about
me and we didn't want to style every single
655
00:53:47,760 --> 00:53:53,630
h2, what I would do is go ahead and add a
class of subtitle to our target element. And
656
00:53:53,630 --> 00:53:55,539
then here I would select it
657
00:53:55,539 --> 00:54:01,269
So in this video, I am going to be teaching
you how to how to add classes in IDs to our
658
00:54:01,269 --> 00:54:07,460
document here and actually start using some
of these selectors. Now, I'm not going to
659
00:54:07,460 --> 00:54:14,809
teach you any of the properties yet, because
we're going to cover that in a little bit
660
00:54:14,809 --> 00:54:23,210
later in this section and in the next few
sections. But I'm just going to be teaching
661
00:54:23,210 --> 00:54:28,420
you how to get familiar with classes and IDs,
because they are by far the most commonly
662
00:54:28,420 --> 00:54:32,400
used selectors in CSS, I mean, sometimes very
uncommonly, you'd see some elements, selectors,
663
00:54:32,400 --> 00:54:41,470
and other types of selectors, which we're
going to go over in the next few videos. But
664
00:54:41,470 --> 00:54:48,859
the two most common that you're going to see
are our classes and IDs. So let's go through
665
00:54:48,859 --> 00:54:53,980
and get started. Now I have a bunch of HTML
content here, we're actually going to be using
666
00:54:53,980 --> 00:54:59,210
this and adding on to it for the rest of the
course, we're going to be styling this website
667
00:54:59,210 --> 00:55:04,349
fully. But let's actually go through and start
adding these classes and IDs. So the first
668
00:55:04,349 --> 00:55:08,549
thing you need to note, before we move on,
is that classes and IDs are different, you
669
00:55:08,549 --> 00:55:13,140
can't just use them interchangeably. And I'm
going to explain why in the next video. But
670
00:55:13,140 --> 00:55:20,440
for now, let's just pretend that they are
the same. And we can use them interchangeably
671
00:55:20,440 --> 00:55:28,510
because they have almost the same methods
of application. So let's go ahead now the
672
00:55:28,510 --> 00:55:31,779
first thing you want to do is identify the
element that you want to target. So first
673
00:55:31,779 --> 00:55:37,599
of all, let's just say I wanted to maybe make
the color of this red. Okay, so the color
674
00:55:37,599 --> 00:55:43,740
of this title. Now that we know we've targeted
it, we want to actually go through and edit
675
00:55:43,740 --> 00:55:48,940
it. So first thing, how do you think we would
go through and do this now if you're thinking
676
00:55:48,940 --> 00:55:52,859
going through and adding an element selector
or maybe adding some inline styles, if you
677
00:55:52,859 --> 00:55:58,100
know what that is, then you are right, partially,
but the only problem is that if there are
678
00:55:58,100 --> 00:56:04,259
any other h ones on this page, then it will
style all of them as well. And because we
679
00:56:04,259 --> 00:56:07,910
only want to style this title, that wouldn't
be really effective. So the best way to do
680
00:56:07,910 --> 00:56:15,309
this would be to use a class or an ID, I'm
going to go ahead and use a class. So the
681
00:56:15,309 --> 00:56:19,540
way the way you would do this is go through
and type in class as your attribute. And you
682
00:56:19,540 --> 00:56:23,339
would again, put this into the opening tag
of whatever target element you want to style.
683
00:56:23,339 --> 00:56:28,010
And in here, you're putting, you're gonna
put your class name. Now, if this isn't where
684
00:56:28,010 --> 00:56:32,910
you put your CSS prefix, this isn't where
you put the dots. As I explained in the last
685
00:56:32,910 --> 00:56:36,650
video, here, you're just going to type the
name of the class. So I'm going to go through
686
00:56:36,650 --> 00:56:40,109
and type a title, just like that. And you
can name this whatever you want. But I'd recommend
687
00:56:40,109 --> 00:56:44,839
keeping it short and sweet. You don't want
it to get too long, because then it's going
688
00:56:44,839 --> 00:56:47,880
to be really hard to work with. So once you've
applied that, and we go ahead and refresh
689
00:56:47,880 --> 00:56:52,180
the page, you can see that nothing's actually
there, it hasn't started working yet. That's
690
00:56:52,180 --> 00:56:57,580
because we haven't applied any styles. So
when we go over here, we need to actually
691
00:56:57,580 --> 00:57:00,740
select our element. So I'm going to go ahead
and add the prefix for a class, which is dot,
692
00:57:00,740 --> 00:57:05,470
and then the name of the class, which is title.
Then I'm going to open up these brackets and
693
00:57:05,470 --> 00:57:09,250
get started. So what I want to do here is
now apply on my properties. I'm going to be
694
00:57:09,250 --> 00:57:17,619
explaining you to you how to do all of this
in the next in future videos. of a for now,
695
00:57:17,619 --> 00:57:24,130
all you need to know is that the first thing
you need to do is select an element using
696
00:57:24,130 --> 00:57:31,710
some method. And then you're going to add
the properties. So I'm going to go ahead and
697
00:57:31,710 --> 00:57:39,039
refresh the page. And you can see it works
just like that. Now to prove to you that this
698
00:57:39,039 --> 00:57:43,920
works, I'm actually going to go through and
style just this about me right here, blue.
699
00:57:43,920 --> 00:57:51,990
So you can see we have more than one h2 on
the page, but there's only one h1. But let's
700
00:57:51,990 --> 00:57:56,359
say we wanted to only style this the about
me and we didn't want to style every single
701
00:57:56,359 --> 00:58:01,299
h2, what I would do is go ahead and add a
class of subtitle to our target element. And
702
00:58:01,299 --> 00:58:02,299
then here I would select it
703
00:58:02,299 --> 00:58:09,809
just like that and give it its color. So you
can go ahead and try this if you want. Don't
704
00:58:09,809 --> 00:58:14,890
try and do anything crazy. If you know what
Go ahead, but for now, let's just go ahead
705
00:58:14,890 --> 00:58:19,190
and stick with that. And there you go. You
can see we've styled that blue and it hasn't
706
00:58:19,190 --> 00:58:20,809
changed. Anything else? So that's working
perfectly seems to be going fine. And we're
707
00:58:20,809 --> 00:58:24,829
selecting everything. But what if we wanted
to use IDs. So let's just say that this right
708
00:58:24,829 --> 00:58:29,700
here, this contact us, we wanted to use an
ID for it. Now, for now, we don't actually
709
00:58:29,700 --> 00:58:35,270
know why we want to use an ID. But let's just
pretend that we do know why. So what I would
710
00:58:35,270 --> 00:58:42,200
do is go ahead and use the ID attribute. So
I'm going to go ahead and add that. And I'm
711
00:58:42,200 --> 00:58:46,569
going to say contact dash us. Now, usually,
in CSS classes or IDs, you would use these
712
00:58:46,569 --> 00:58:50,670
dashes right here, instead of dots or uppercase,
or any other naming convention, this is just
713
00:58:50,670 --> 00:58:55,440
kind of the standard way to do it. Now we
don't have to style it, I can't just go ahead
714
00:58:55,440 --> 00:58:59,880
and do this, this wouldn't work. The reason
being the prefix here is a.so. css would interpret
715
00:58:59,880 --> 00:59:05,080
this as a class and not an ID, instead, we're
going to have to use our author Thor or hash,
716
00:59:05,080 --> 00:59:10,730
then why don't we go ahead and color this
one, green. Okay, let's go ahead and refresh
717
00:59:10,730 --> 00:59:16,549
the page and check this out. And you can see
that it has this kind of olive green color,
718
00:59:16,549 --> 00:59:20,650
so it's working great. So there we go, you
can see that we've worked with some of these
719
00:59:20,650 --> 00:59:25,869
selectors and applied some of our IDs. Now,
you can go ahead onto the GitHub repository,
720
00:59:25,869 --> 00:59:39,200
pull it, download it, do whatever you want.
If you don't know how to use Git, I do have
721
00:59:39,200 --> 00:59:46,050
a free course on that as well. But it's very
easy. You can go back to any state and time,
722
00:59:46,050 --> 00:59:52,020
check it out and play, play around with these
trying and replicate this and add your own
723
00:59:52,020 --> 00:59:56,519
classes and IDs and try and you know, figure
out how things work here. So yeah, that's
724
00:59:56,519 --> 01:00:00,670
pretty much the basics of adding classes and
IDs. In the future, we're going to use some
725
01:00:00,670 --> 01:00:04,089
more complicated selectors, which don't actually
involve having to directly reference some
726
01:00:04,089 --> 01:00:09,000
of these. So those are going to get pretty
complicated, but we're going to build up to
727
01:00:09,000 --> 01:00:16,029
that point. So let's move on. So in this video,
I'm going to be talking about a very important
728
01:00:16,029 --> 01:00:19,450
concept in CSS. So this is a pretty important
concept, because it's pretty much going to
729
01:00:19,450 --> 01:00:22,619
change the way that you use selectors. Right
now, we're just assuming that all of these
730
01:00:22,619 --> 01:00:31,270
selectors kind of work in the same in a similar
way. We don't actually know why. They're why
731
01:00:31,270 --> 01:00:42,900
they exist. I mean, why is there a class and
an id selector when they both do the same
732
01:00:42,900 --> 01:00:52,050
thing. So that's what I'm going to be explaining
in this video. And it all comes down to one
733
01:00:52,050 --> 01:00:55,480
concept called specificity. So specificity
is pretty much talking about the overriding
734
01:00:55,480 --> 01:01:01,750
or rewriting of properties in CSS. And it's
pretty much this concept that different selectors
735
01:01:01,750 --> 01:01:10,680
are more powerful than others in a sense.
So for example, if you had two selectors,
736
01:01:10,680 --> 01:01:17,029
on one element, one of them said the color
was blue, and one of them said the color was
737
01:01:17,029 --> 01:01:21,020
green, the more powerful there the more specific
selector would end up overriding the other
738
01:01:21,020 --> 01:01:25,109
ones and applying that property to the element.
So there's this really helpful article here
739
01:01:25,109 --> 01:01:30,740
from w three schools. If you need some more
help on this, or you don't really understand
740
01:01:30,740 --> 01:01:34,970
it, you can go ahead and read this. There's
a lot of numbers involved like this. But you
741
01:01:34,970 --> 01:01:38,700
know, you can go ahead and read this, but
I'm just going to explain it in Word terms,
742
01:01:38,700 --> 01:01:44,019
because these numbers tend to get really confusing.
And they end up meaning the same thing at
743
01:01:44,019 --> 01:01:50,440
the end of the day. So let's go ahead and
get started. Now, I think it's really helpful
744
01:01:50,440 --> 01:01:57,869
if we start from the ground up. So I've removed
all of the styling that we applied in the
745
01:01:57,869 --> 01:02:01,869
last video. So first of all, I'm going to
go ahead and create an element selector. So
746
01:02:01,869 --> 01:02:06,790
on all h twos, I want the color to be blue,
or actually I'm going to make it red. So there
747
01:02:06,790 --> 01:02:13,039
we go. Now we know that every single h2 is
red. Okay? Well, let's just say for our about
748
01:02:13,039 --> 01:02:22,349
me right here, I'm going to add a class, okay.
And I'm going to call this about me, and I'm
749
01:02:22,349 --> 01:02:29,359
going to add it to my h2. Now in my in my
styles, here, we're going to use the class
750
01:02:29,359 --> 01:02:39,269
selector and say the color is blue. So this
is where we have a confliction. You can see
751
01:02:39,269 --> 01:02:47,410
that one selector says the color is red, but
one selector says the color is blue. So what
752
01:02:47,410 --> 01:02:53,200
are we supposed to do about this? Which one
do you think is going to prevail, I mean,
753
01:02:53,200 --> 01:03:02,660
you can just have both red and blue at the
same time, you can see that blue is actually
754
01:03:02,660 --> 01:03:07,769
more specific. So you can see that elements
are or actually selectors have different powers.
755
01:03:07,769 --> 01:03:14,890
And the more powerful they are, the more specific
they are. The higher they are, the higher
756
01:03:14,890 --> 01:03:27,759
they're going to be on the scale and the higher
the chance of having or applying the right
757
01:03:27,759 --> 01:03:36,640
just like that and give it its color. So you
can go ahead and try this if you want. Don't
758
01:03:36,640 --> 01:03:44,289
try and do anything crazy. If you know what
Go ahead, but for now, let's just go ahead
759
01:03:44,289 --> 01:03:50,170
and stick with that. And there you go. You
can see we've styled that blue and it hasn't
760
01:03:50,170 --> 01:03:52,569
changed. Anything else? So that's working
perfectly seems to be going fine. And we're
761
01:03:52,569 --> 01:03:55,249
selecting everything. But what if we wanted
to use IDs. So let's just say that this right
762
01:03:55,249 --> 01:03:59,619
here, this contact us, we wanted to use an
ID for it. Now, for now, we don't actually
763
01:03:59,619 --> 01:04:05,869
know why we want to use an ID. But let's just
pretend that we do know why. So what I would
764
01:04:05,869 --> 01:04:11,630
do is go ahead and use the ID attribute. So
I'm going to go ahead and add that. And I'm
765
01:04:11,630 --> 01:04:16,780
going to say contact dash us. Now, usually,
in CSS classes or IDs, you would use these
766
01:04:16,780 --> 01:04:21,619
dashes right here, instead of dots or uppercase,
or any other naming convention, this is just
767
01:04:21,619 --> 01:04:27,779
kind of the standard way to do it. Now we
don't have to style it, I can't just go ahead
768
01:04:27,779 --> 01:04:33,470
and do this, this wouldn't work. The reason
being the prefix here is a.so. css would interpret
769
01:04:33,470 --> 01:04:42,220
this as a class and not an ID, instead, we're
going to have to use our author Thor or hash,
770
01:04:42,220 --> 01:04:48,599
then why don't we go ahead and color this
one, green. Okay, let's go ahead and refresh
771
01:04:48,599 --> 01:04:53,520
the page and check this out. And you can see
that it has this kind of olive green color,
772
01:04:53,520 --> 01:05:00,900
so it's working great. So there we go, you
can see that we've worked with some of these
773
01:05:00,900 --> 01:05:10,400
selectors and applied some of our IDs. Now,
you can go ahead onto the GitHub repository,
774
01:05:10,400 --> 01:05:17,900
pull it, download it, do whatever you want.
If you don't know how to use Git, I do have
775
01:05:17,900 --> 01:05:22,990
a free course on that as well. But it's very
easy. You can go back to any state and time,
776
01:05:22,990 --> 01:05:29,040
check it out and play, play around with these
trying and replicate this and add your own
777
01:05:29,040 --> 01:05:34,319
classes and IDs and try and you know, figure
out how things work here. So yeah, that's
778
01:05:34,319 --> 01:05:40,650
pretty much the basics of adding classes and
IDs. In the future, we're going to use some
779
01:05:40,650 --> 01:05:44,809
more complicated selectors, which don't actually
involve having to directly reference some
780
01:05:44,809 --> 01:05:49,749
of these. So those are going to get pretty
complicated, but we're going to build up to
781
01:05:49,749 --> 01:05:51,890
that point. So let's move on. So in this video,
I'm going to be talking about a very important
782
01:05:51,890 --> 01:05:55,510
concept in CSS. So this is a pretty important
concept, because it's pretty much going to
783
01:05:55,510 --> 01:06:02,559
change the way that you use selectors. Right
now, we're just assuming that all of these
784
01:06:02,559 --> 01:06:10,720
selectors kind of work in the same in a similar
way. We don't actually know why. They're why
785
01:06:10,720 --> 01:06:14,109
they exist. I mean, why is there a class and
an id selector when they both do the same
786
01:06:14,109 --> 01:06:20,720
thing. So that's what I'm going to be explaining
in this video. And it all comes down to one
787
01:06:20,720 --> 01:06:24,490
concept called specificity. So specificity
is pretty much talking about the overriding
788
01:06:24,490 --> 01:06:31,960
or rewriting of properties in CSS. And it's
pretty much this concept that different selectors
789
01:06:31,960 --> 01:06:38,010
are more powerful than others in a sense.
So for example, if you had two selectors,
790
01:06:38,010 --> 01:06:44,800
on one element, one of them said the color
was blue, and one of them said the color was
791
01:06:44,800 --> 01:06:50,340
green, the more powerful there the more specific
selector would end up overriding the other
792
01:06:50,340 --> 01:06:57,039
ones and applying that property to the element.
So there's this really helpful article here
793
01:06:57,039 --> 01:07:05,369
from w three schools. If you need some more
help on this, or you don't really understand
794
01:07:05,369 --> 01:07:10,769
it, you can go ahead and read this. There's
a lot of numbers involved like this. But you
795
01:07:10,769 --> 01:07:14,099
know, you can go ahead and read this, but
I'm just going to explain it in Word terms,
796
01:07:14,099 --> 01:07:18,530
because these numbers tend to get really confusing.
And they end up meaning the same thing at
797
01:07:18,530 --> 01:07:20,490
the end of the day. So let's go ahead and
get started. Now, I think it's really helpful
798
01:07:20,490 --> 01:07:26,790
if we start from the ground up. So I've removed
all of the styling that we applied in the
799
01:07:26,790 --> 01:07:32,590
last video. So first of all, I'm going to
go ahead and create an element selector. So
800
01:07:32,590 --> 01:07:46,069
on all h twos, I want the color to be blue,
or actually I'm going to make it red. So there
801
01:07:46,069 --> 01:07:52,740
we go. Now we know that every single h2 is
red. Okay? Well, let's just say for our about
802
01:07:52,740 --> 01:07:58,700
me right here, I'm going to add a class, okay.
And I'm going to call this about me, and I'm
803
01:07:58,700 --> 01:08:05,539
going to add it to my h2. Now in my in my
styles, here, we're going to use the class
804
01:08:05,539 --> 01:08:13,769
selector and say the color is blue. So this
is where we have a confliction. You can see
805
01:08:13,769 --> 01:08:24,909
that one selector says the color is red, but
one selector says the color is blue. So what
806
01:08:24,909 --> 01:08:29,949
are we supposed to do about this? Which one
do you think is going to prevail, I mean,
807
01:08:29,949 --> 01:08:36,839
you can just have both red and blue at the
same time, you can see that blue is actually
808
01:08:36,839 --> 01:08:41,650
more specific. So you can see that elements
are or actually selectors have different powers.
809
01:08:41,650 --> 01:08:46,469
And the more powerful they are, the more specific
they are. The higher they are, the higher
810
01:08:46,469 --> 01:08:50,960
they're going to be on the scale and the higher
the chance of having or applying the right
811
01:08:50,960 --> 01:08:54,140
selector property. So what we're going to
do is actually go through and talk about the
812
01:08:54,140 --> 01:08:57,489
different powers or specificities, or specifics
of each selector and we're going to see which
813
01:08:57,489 --> 01:09:04,409
one is most powerful. So right now We know
that the element selectors are less powerful
814
01:09:04,409 --> 01:09:10,299
than the class. But there is actually two
more that are more powerful than the class
815
01:09:10,299 --> 01:09:15,190
selectors. So I'm going to go ahead and apply
this about me class to another h2. Now I know
816
01:09:15,190 --> 01:09:21,020
it's not really going to make much sense.
So I'm actually just going to rename it to
817
01:09:21,020 --> 01:09:25,759
subtitle. Okay, so I'm going to go ahead and
add this to services as well. subtitle, there
818
01:09:25,759 --> 01:09:28,409
we go. Let's go ahead and refresh the page.
Oh, whoops, forgot to actually change the
819
01:09:28,409 --> 01:09:36,900
class name. with CSS fun. There we go. So
now we have two blue sub titles and one red.
820
01:09:36,900 --> 01:09:45,739
So you can see that the class will overwrite
the header, or sorry, the element tag. But
821
01:09:45,739 --> 01:09:52,929
there are like I said, there are still two
that are more powerful. The next after the
822
01:09:52,929 --> 01:09:58,960
class is the ID. So I'm going to go over here
to services and add an ID of services, oops,
823
01:09:58,960 --> 01:10:04,909
services. All right. Now, what I'm going to
do is go into my CSS file, and use the id
824
01:10:04,909 --> 01:10:10,010
selector. color green. So I'm going to go
ahead and refresh now. And you can see that
825
01:10:10,010 --> 01:10:16,369
it's right here, it's green. So now that we
know the ID is going to overwrite the class,
826
01:10:16,369 --> 01:10:22,550
and the class is going to overwrite the header.
So there is still one more that is more powerful.
827
01:10:22,550 --> 01:10:28,340
And that is called inline styling. So we don't
actually know what inline styling is. But
828
01:10:28,340 --> 01:10:35,170
pretty much we don't need to use a CSS file
to do inline styling. All we need is the element
829
01:10:35,170 --> 01:10:40,520
and the HTML file. So why don't I go ahead
and use services here, because we're kind
830
01:10:40,520 --> 01:10:47,440
of on a roll, and I want to use this again.
So what I'm going to do is a style, which
831
01:10:47,440 --> 01:10:53,290
is the attribute. And then here, we add all
of our CSS properties, no selector nothing.
832
01:10:53,290 --> 01:10:59,179
So I'm going to say here, that color is still
blue. And we don't actually, still blue is
833
01:10:59,179 --> 01:11:04,940
part of the CSS color collection, we'll explain
all of those in future sections. So if I go
834
01:11:04,940 --> 01:11:12,969
ahead and refresh, now, you can see that it
is blue, and it overrides the ID, the class
835
01:11:12,969 --> 01:11:19,170
and the header here. So pretty much there
are, there's an order here that you need to
836
01:11:19,170 --> 01:11:24,929
take away from this video. headers are the
least specific, they kind of applied to everything,
837
01:11:24,929 --> 01:11:32,090
and they're not that powerful. The class selector
is above that, and then the ID and then the
838
01:11:32,090 --> 01:11:43,300
inline styling, or the style attribute. So
if you follow this order, you will pretty
839
01:11:43,300 --> 01:11:46,940
much you can predict what is going to be the
outcome and which styles are going to be followed.
840
01:11:46,940 --> 01:11:51,130
So this is a pretty useful tool and in CSS,
and it pretty much allows you to structure
841
01:11:51,130 --> 01:11:55,929
your file in a way that makes sense to other
people when they're reading it. But there's
842
01:11:55,929 --> 01:12:00,160
still one more question we need to answer.
What's the difference between a class and
843
01:12:00,160 --> 01:12:05,760
an ID. Apart from the obvious specificity
difference, we actually use classes and IDs
844
01:12:05,760 --> 01:12:10,210
in different situations. And they're pretty
simple. Classes are meant to be used multiple
845
01:12:10,210 --> 01:12:14,550
times. So if you have done any programming
before, you'll know that a class is kind of
846
01:12:14,550 --> 01:12:19,150
like a blueprint, it's made so that you can
create multiple objects from it. But the thing
847
01:12:19,150 --> 01:12:25,119
is, an ID is supposed to be only for one thing,
it'll work for more than one. But the convention
848
01:12:25,119 --> 01:12:28,780
is, you're only supposed to use an ID for
one single element. So for example, let's
849
01:12:28,780 --> 01:12:32,410
take this file we have here we have three
sub titles, and one for the about me section.
850
01:12:32,410 --> 01:12:36,170
In this structure, what we would do is create
a sub title class for every sub title on the
851
01:12:36,170 --> 01:12:40,030
page, then we'd apply it to it. Now the reason
we're doing this is because we can have multiple
852
01:12:40,030 --> 01:12:48,110
h2 is on this page. So we only want to apply
it to the subtitles. But then for our bio
853
01:12:48,110 --> 01:12:53,659
about me here, there's only going to be one
of them on this whole document, which means
854
01:12:53,659 --> 01:13:02,830
we're going to use the ID of about me. And
then from there, we can go and apply our styles
855
01:13:02,830 --> 01:13:09,530
and do all of that. So that's just the main
difference between classes and IDs. And now
856
01:13:09,530 --> 01:13:13,920
that you know how to use them, you can actually
go through and apply them properly in real
857
01:13:13,920 --> 01:13:19,380
world scenarios. So that's just a very important
thing to keep in mind. You're only supposed
858
01:13:19,380 --> 01:13:22,840
to use IDs once and classes can be used multiple
times. Alright, let's move on.
859
01:13:22,840 --> 01:13:25,360
selector property. So what we're going to
do is actually go through and talk about the
860
01:13:25,360 --> 01:13:31,070
different powers or specificities, or specifics
of each selector and we're going to see which
861
01:13:31,070 --> 01:13:35,290
one is most powerful. So right now We know
that the element selectors are less powerful
862
01:13:35,290 --> 01:13:36,290
than the class. But there is actually two
more that are more powerful than the class
863
01:13:36,290 --> 01:13:39,960
selectors. So I'm going to go ahead and apply
this about me class to another h2. Now I know
864
01:13:39,960 --> 01:13:43,310
it's not really going to make much sense.
So I'm actually just going to rename it to
865
01:13:43,310 --> 01:13:46,739
subtitle. Okay, so I'm going to go ahead and
add this to services as well. subtitle, there
866
01:13:46,739 --> 01:13:51,350
we go. Let's go ahead and refresh the page.
Oh, whoops, forgot to actually change the
867
01:13:51,350 --> 01:13:57,219
class name. with CSS fun. There we go. So
now we have two blue sub titles and one red.
868
01:13:57,219 --> 01:14:03,600
So you can see that the class will overwrite
the header, or sorry, the element tag. But
869
01:14:03,600 --> 01:14:08,590
there are like I said, there are still two
that are more powerful. The next after the
870
01:14:08,590 --> 01:14:14,670
class is the ID. So I'm going to go over here
to services and add an ID of services, oops,
871
01:14:14,670 --> 01:14:21,130
services. All right. Now, what I'm going to
do is go into my CSS file, and use the id
872
01:14:21,130 --> 01:14:25,940
selector. color green. So I'm going to go
ahead and refresh now. And you can see that
873
01:14:25,940 --> 01:14:31,350
it's right here, it's green. So now that we
know the ID is going to overwrite the class,
874
01:14:31,350 --> 01:14:38,120
and the class is going to overwrite the header.
So there is still one more that is more powerful.
875
01:14:38,120 --> 01:14:49,560
And that is called inline styling. So we don't
actually know what inline styling is. But
876
01:14:49,560 --> 01:14:58,409
pretty much we don't need to use a CSS file
to do inline styling. All we need is the element
877
01:14:58,409 --> 01:15:04,300
and the HTML file. So why don't I go ahead
and use services here, because we're kind
878
01:15:04,300 --> 01:15:11,270
of on a roll, and I want to use this again.
So what I'm going to do is a style, which
879
01:15:11,270 --> 01:15:16,449
is the attribute. And then here, we add all
of our CSS properties, no selector nothing.
880
01:15:16,449 --> 01:15:22,480
So I'm going to say here, that color is still
blue. And we don't actually, still blue is
881
01:15:22,480 --> 01:15:28,210
part of the CSS color collection, we'll explain
all of those in future sections. So if I go
882
01:15:28,210 --> 01:15:32,040
ahead and refresh, now, you can see that it
is blue, and it overrides the ID, the class
883
01:15:32,040 --> 01:15:35,400
and the header here. So pretty much there
are, there's an order here that you need to
884
01:15:35,400 --> 01:15:40,580
take away from this video. headers are the
least specific, they kind of applied to everything,
885
01:15:40,580 --> 01:15:45,260
and they're not that powerful. The class selector
is above that, and then the ID and then the
886
01:15:45,260 --> 01:15:48,250
inline styling, or the style attribute. So
if you follow this order, you will pretty
887
01:15:48,250 --> 01:15:53,320
much you can predict what is going to be the
outcome and which styles are going to be followed.
888
01:15:53,320 --> 01:15:58,080
So this is a pretty useful tool and in CSS,
and it pretty much allows you to structure
889
01:15:58,080 --> 01:16:03,420
your file in a way that makes sense to other
people when they're reading it. But there's
890
01:16:03,420 --> 01:16:11,239
still one more question we need to answer.
What's the difference between a class and
891
01:16:11,239 --> 01:16:12,850
an ID. Apart from the obvious specificity
difference, we actually use classes and IDs
892
01:16:12,850 --> 01:16:15,790
in different situations. And they're pretty
simple. Classes are meant to be used multiple
893
01:16:15,790 --> 01:16:19,610
times. So if you have done any programming
before, you'll know that a class is kind of
894
01:16:19,610 --> 01:16:23,030
like a blueprint, it's made so that you can
create multiple objects from it. But the thing
895
01:16:23,030 --> 01:16:30,910
is, an ID is supposed to be only for one thing,
it'll work for more than one. But the convention
896
01:16:30,910 --> 01:16:35,820
is, you're only supposed to use an ID for
one single element. So for example, let's
897
01:16:35,820 --> 01:16:40,949
take this file we have here we have three
sub titles, and one for the about me section.
898
01:16:40,949 --> 01:16:47,750
In this structure, what we would do is create
a sub title class for every sub title on the
899
01:16:47,750 --> 01:16:54,719
page, then we'd apply it to it. Now the reason
we're doing this is because we can have multiple
900
01:16:54,719 --> 01:16:59,400
h2 is on this page. So we only want to apply
it to the subtitles. But then for our bio
901
01:16:59,400 --> 01:17:04,199
about me here, there's only going to be one
of them on this whole document, which means
902
01:17:04,199 --> 01:17:08,580
we're going to use the ID of about me. And
then from there, we can go and apply our styles
903
01:17:08,580 --> 01:17:12,000
and do all of that. So that's just the main
difference between classes and IDs. And now
904
01:17:12,000 --> 01:17:17,360
that you know how to use them, you can actually
go through and apply them properly in real
905
01:17:17,360 --> 01:17:23,420
world scenarios. So that's just a very important
thing to keep in mind. You're only supposed
906
01:17:23,420 --> 01:17:28,610
to use IDs once and classes can be used multiple
times. Alright, let's move on.
907
01:17:28,610 --> 01:17:35,340
So in this video I am we are going to be looking
at pseudo selectors. So this is a special
908
01:17:35,340 --> 01:17:45,670
type of selector that is used commonly in
interactivity with your website. So this is
909
01:17:45,670 --> 01:17:49,760
usually visible only when something is done
on the website. So it's a pretty it's pretty
910
01:17:49,760 --> 01:17:56,239
cool feature. And it's used very commonly
throughout CSS. And once we get to the animations
911
01:17:56,239 --> 01:18:01,230
and transitions part, we're actually going
to be used soon as we be we're going to be
912
01:18:01,230 --> 01:18:06,170
using pseudo selectors a lot. So let's get
into it. Now, there's a few pseudo selectors
913
01:18:06,170 --> 01:18:11,469
I want to cover here. There's a lot of number
of only going to be covering the main ones
914
01:18:11,469 --> 01:18:14,829
that are we're going to be using. So before
we go on, I'm just going to show you what
915
01:18:14,829 --> 01:18:18,170
a pseudo selector actually is. So usually
what you would do is, after a selector, you
916
01:18:18,170 --> 01:18:23,340
would add a colon, and then the name of the
pseudo selector. So this is just an example
917
01:18:23,340 --> 01:18:25,180
of one of them. And then the properties will
apply normally. Now watch what happens when
918
01:18:25,180 --> 01:18:27,100
I hover over our h2 here, you can see that
it's working perfectly. And when we hover
919
01:18:27,100 --> 01:18:30,010
over it, it is turning red. Now, obviously,
it doesn't apply to this subtitle, or the
920
01:18:30,010 --> 01:18:33,780
services part here. Because again, these are
all separate classes. And obviously, with
921
01:18:33,780 --> 01:18:38,130
specificity and everything like that, they
won't apply. So there we go. We have everything
922
01:18:38,130 --> 01:18:42,610
working here. And that's one of the pseudo
selectors, which is hover. So let's move on
923
01:18:42,610 --> 01:18:48,199
to some of the next ones. Now, there's also
two that I'd like to talk about, which is
924
01:18:48,199 --> 01:18:53,720
first child and last child. So the concept
behind child and parent elements is that right
925
01:18:53,720 --> 01:18:58,230
here, if we look Actually, this is a little
bit complicated example, let's look at this
926
01:18:58,230 --> 01:19:03,469
unordered list here, we have an A ul unordered
list, and then we have three allies. Okay,
927
01:19:03,469 --> 01:19:09,350
so pretty much this is going to be the first
child because it's placed inside of the UL,
928
01:19:09,350 --> 01:19:14,739
the second is going to be the second child,
and then this is going to be the third child.
929
01:19:14,739 --> 01:19:18,450
So you can see here that this is kind of the
relationship between child and parent. And
930
01:19:18,450 --> 01:19:24,230
what we can actually do is specify which one
we want to select. So if I go over here and
931
01:19:24,230 --> 01:19:27,810
select all URLs, and then of course, the colon
for the pseudo selector, and select first
932
01:19:27,810 --> 01:19:31,840
child, now, I'm just going to say set the
color to steel blue as well. Okay, so I'm
933
01:19:31,840 --> 01:19:37,159
gonna refresh the page, and you can see that
it's not working. Now, although it might seem
934
01:19:37,159 --> 01:19:41,679
like you want to put the URL first, obviously,
because, again, you're looking for the first
935
01:19:41,679 --> 01:19:47,420
child of the URL, this isn't actually how
you're supposed to write it. Instead, you're
936
01:19:47,420 --> 01:19:52,719
supposed to write the element that you're
trying to select, which in this case is our
937
01:19:52,719 --> 01:20:00,100
list item, or our Li. So now if I go ahead
and refresh the page, you can see that the
938
01:20:00,100 --> 01:20:10,670
first one here is going to be blue, it's a
little bit of a confusing rule to get around.
939
01:20:10,670 --> 01:20:17,610
But once you get used to it, it becomes very
easy. We also change this to last or last
940
01:20:17,610 --> 01:20:23,120
child like this. And then what's going to
happen is it's going to select the last one.
941
01:20:23,120 --> 01:20:28,590
Now, there's also one more that I'd like to
talk about quickly, which is nth child. So
942
01:20:28,590 --> 01:20:32,940
I'm just going to show you how this thing
works and child. And then in brackets, you
943
01:20:32,940 --> 01:20:38,380
put the number here. So when you're going
to put here is pretty much what number of
944
01:20:38,380 --> 01:20:42,790
the child you want to style. In this case,
I want every second Li child to be colored
945
01:20:42,790 --> 01:20:47,070
steel blue. So throughout the page, every
second Li that is inside of a that is the
946
01:20:47,070 --> 01:20:51,360
child element is going to be styled blue,
go ahead and refresh the page, you can see
947
01:20:51,360 --> 01:20:55,540
that works there. So there's actually one
more selector that I want to talk about, at
948
01:20:55,540 --> 01:20:59,490
least for children, and that is the only child
selector. So I think it makes perfect sense,
949
01:20:59,490 --> 01:21:02,870
pretty much what we're trying to look for
is something that there's only one child inside
950
01:21:02,870 --> 01:21:09,610
of it. So for example, nothing on this page
here actually has one child. But why don't
951
01:21:09,610 --> 01:21:13,670
we go ahead and add that. So under this list,
I'm just going to temporarily remove these
952
01:21:13,670 --> 01:21:17,830
here, just like that. All right, let's go
ahead and save, make sure it's working. There
953
01:21:17,830 --> 01:21:23,889
we go. Now, what I'm going to do is go ahead
and select this. So I'm going to say Li by
954
01:21:23,889 --> 01:21:29,161
car. And I'm going to say only child. So pretty
much what this is saying is for every Li that
955
01:21:29,161 --> 01:21:37,159
is the only child of its parent. And you can
see this, the UL does only has one child.
956
01:21:37,159 --> 01:21:42,420
So I'm going to go ahead and give it a color
of purple, for example. And you can see that
957
01:21:42,420 --> 01:21:47,510
it works perfectly. But what would happen
if I tried this on, let's just say for example,
958
01:21:47,510 --> 01:21:53,219
the TD is here. Okay, so I'm going to go ahead
and add a new one TD, only child. And I'm
959
01:21:53,219 --> 01:21:56,159
also going to give this a color of purple.
960
01:21:56,159 --> 01:22:00,590
So in this video I am we are going to be looking
at pseudo selectors. So this is a special
961
01:22:00,590 --> 01:22:05,020
type of selector that is used commonly in
interactivity with your website. So this is
962
01:22:05,020 --> 01:22:09,420
usually visible only when something is done
on the website. So it's a pretty it's pretty
963
01:22:09,420 --> 01:22:15,320
cool feature. And it's used very commonly
throughout CSS. And once we get to the animations
964
01:22:15,320 --> 01:22:18,760
and transitions part, we're actually going
to be used soon as we be we're going to be
965
01:22:18,760 --> 01:22:22,869
using pseudo selectors a lot. So let's get
into it. Now, there's a few pseudo selectors
966
01:22:22,869 --> 01:22:30,179
I want to cover here. There's a lot of number
of only going to be covering the main ones
967
01:22:30,179 --> 01:22:35,199
that are we're going to be using. So before
we go on, I'm just going to show you what
968
01:22:35,199 --> 01:22:40,090
a pseudo selector actually is. So usually
what you would do is, after a selector, you
969
01:22:40,090 --> 01:22:46,929
would add a colon, and then the name of the
pseudo selector. So this is just an example
970
01:22:46,929 --> 01:22:52,270
of one of them. And then the properties will
apply normally. Now watch what happens when
971
01:22:52,270 --> 01:22:56,730
I hover over our h2 here, you can see that
it's working perfectly. And when we hover
972
01:22:56,730 --> 01:23:01,199
over it, it is turning red. Now, obviously,
it doesn't apply to this subtitle, or the
973
01:23:01,199 --> 01:23:04,540
services part here. Because again, these are
all separate classes. And obviously, with
974
01:23:04,540 --> 01:23:09,790
specificity and everything like that, they
won't apply. So there we go. We have everything
975
01:23:09,790 --> 01:23:15,869
working here. And that's one of the pseudo
selectors, which is hover. So let's move on
976
01:23:15,869 --> 01:23:20,060
to some of the next ones. Now, there's also
two that I'd like to talk about, which is
977
01:23:20,060 --> 01:23:24,520
first child and last child. So the concept
behind child and parent elements is that right
978
01:23:24,520 --> 01:23:29,580
here, if we look Actually, this is a little
bit complicated example, let's look at this
979
01:23:29,580 --> 01:23:36,219
unordered list here, we have an A ul unordered
list, and then we have three allies. Okay,
980
01:23:36,219 --> 01:23:44,139
so pretty much this is going to be the first
child because it's placed inside of the UL,
981
01:23:44,139 --> 01:23:51,520
the second is going to be the second child,
and then this is going to be the third child.
982
01:23:51,520 --> 01:23:54,719
So you can see here that this is kind of the
relationship between child and parent. And
983
01:23:54,719 --> 01:23:59,639
what we can actually do is specify which one
we want to select. So if I go over here and
984
01:23:59,639 --> 01:24:04,150
select all URLs, and then of course, the colon
for the pseudo selector, and select first
985
01:24:04,150 --> 01:24:08,760
child, now, I'm just going to say set the
color to steel blue as well. Okay, so I'm
986
01:24:08,760 --> 01:24:13,590
gonna refresh the page, and you can see that
it's not working. Now, although it might seem
987
01:24:13,590 --> 01:24:18,969
like you want to put the URL first, obviously,
because, again, you're looking for the first
988
01:24:18,969 --> 01:24:22,710
child of the URL, this isn't actually how
you're supposed to write it. Instead, you're
989
01:24:22,710 --> 01:24:26,630
supposed to write the element that you're
trying to select, which in this case is our
990
01:24:26,630 --> 01:24:36,830
list item, or our Li. So now if I go ahead
and refresh the page, you can see that the
991
01:24:36,830 --> 01:24:42,310
first one here is going to be blue, it's a
little bit of a confusing rule to get around.
992
01:24:42,310 --> 01:24:47,880
But once you get used to it, it becomes very
easy. We also change this to last or last
993
01:24:47,880 --> 01:24:56,080
child like this. And then what's going to
happen is it's going to select the last one.
994
01:24:56,080 --> 01:25:06,290
Now, there's also one more that I'd like to
talk about quickly, which is nth child. So
995
01:25:06,290 --> 01:25:09,201
I'm just going to show you how this thing
works and child. And then in brackets, you
996
01:25:09,201 --> 01:25:13,640
put the number here. So when you're going
to put here is pretty much what number of
997
01:25:13,640 --> 01:25:19,540
the child you want to style. In this case,
I want every second Li child to be colored
998
01:25:19,540 --> 01:25:28,880
steel blue. So throughout the page, every
second Li that is inside of a that is the
999
01:25:28,880 --> 01:25:38,179
child element is going to be styled blue,
go ahead and refresh the page, you can see
1000
01:25:38,179 --> 01:25:43,830
that works there. So there's actually one
more selector that I want to talk about, at
1001
01:25:43,830 --> 01:25:49,080
least for children, and that is the only child
selector. So I think it makes perfect sense,
1002
01:25:49,080 --> 01:25:53,929
pretty much what we're trying to look for
is something that there's only one child inside
1003
01:25:53,929 --> 01:25:58,280
of it. So for example, nothing on this page
here actually has one child. But why don't
1004
01:25:58,280 --> 01:26:03,940
we go ahead and add that. So under this list,
I'm just going to temporarily remove these
1005
01:26:03,940 --> 01:26:11,030
here, just like that. All right, let's go
ahead and save, make sure it's working. There
1006
01:26:11,030 --> 01:26:18,340
we go. Now, what I'm going to do is go ahead
and select this. So I'm going to say Li by
1007
01:26:18,340 --> 01:26:26,300
car. And I'm going to say only child. So pretty
much what this is saying is for every Li that
1008
01:26:26,300 --> 01:26:32,540
is the only child of its parent. And you can
see this, the UL does only has one child.
1009
01:26:32,540 --> 01:26:34,469
So I'm going to go ahead and give it a color
of purple, for example. And you can see that
1010
01:26:34,469 --> 01:26:36,800
it works perfectly. But what would happen
if I tried this on, let's just say for example,
1011
01:26:36,800 --> 01:26:41,820
the TD is here. Okay, so I'm going to go ahead
and add a new one TD, only child. And I'm
1012
01:26:41,820 --> 01:26:43,420
also going to give this a color of purple.
1013
01:26:43,420 --> 01:26:47,830
Now let's go ahead and refresh and see what's
going on. All right. So you can see that that
1014
01:26:47,830 --> 01:26:50,849
TD right here, it's somewhere in this table,
nothing's actually happening. That's because
1015
01:26:50,849 --> 01:26:55,110
as we can see here, there is nothing on this
page where there's only one TD as a child.
1016
01:26:55,110 --> 01:26:59,580
So that's just one thing to keep in mind.
Sometimes pseudo selectors won't actually
1017
01:26:59,580 --> 01:27:06,410
style anything if they don't exist. So there
we go. That's pretty much for the basic children
1018
01:27:06,410 --> 01:27:12,171
kind of pseudo selectors. Let's move on to
some other students, selectors. Now, there
1019
01:27:12,171 --> 01:27:14,560
are selectors of this type that are actually
specific to certain elements, and one of them
1020
01:27:14,560 --> 01:27:22,150
is the anchor tag or the a tag. So I'm just
going to go ahead and create an anchor tag
1021
01:27:22,150 --> 01:27:30,090
under this h2 here. Oh, whoops. Okay, and
I'm just going to give it a link or an endpoint
1022
01:27:30,090 --> 01:27:39,440
of Google. So just like that. Okay, there
we go. So in here, I'm just going to say Click
1023
01:27:39,440 --> 01:27:45,520
here to go to Google. Pretty simple. At Tag.
Hopefully everyone knows how to do this. There
1024
01:27:45,520 --> 01:27:52,600
we go, we have our link there. So I click
on it takes me there, pretty standard stuff.
1025
01:27:52,600 --> 01:27:58,750
Now, we can actually create pseudo selectors
for this. So I'm going to be giving you two
1026
01:27:58,750 --> 01:28:05,050
for now. Now, there are many, many more. But
these are the two main ones you need to focus
1027
01:28:05,050 --> 01:28:09,630
on. The rest of them are kind of generalized.
And these are the main two that you're going
1028
01:28:09,630 --> 01:28:14,040
to be using. So I'm going to create them here.
And remember, you're using the element name,
1029
01:28:14,040 --> 01:28:17,660
you can use the class if you want, it's not
limited to single element names, actually,
1030
01:28:17,660 --> 01:28:22,969
why don't I go ahead and do that, I'm going
to give it an ID, because again, we only have
1031
01:28:22,969 --> 01:28:27,260
one of these on the page, I'm going to give
it an ID of Google link, just like that. So
1032
01:28:27,260 --> 01:28:34,290
now I'm gonna go ahead and reference that
in here. So remember, it's just the name of
1033
01:28:34,290 --> 01:28:38,409
this electric Google dash link, in this case,
and then the colon. So here, I'm going to
1034
01:28:38,409 --> 01:28:40,440
go ahead and say, link. Okay, so this is the
first pseudo selector. And then there's also
1035
01:28:40,440 --> 01:28:43,369
a second one. Don't worry about what I'm typing
for. now. I'll explain both of these in just
1036
01:28:43,369 --> 01:28:47,820
a second. Alright, so let's look at the first
one here, Google link, like, pretty much what
1037
01:28:47,820 --> 01:28:52,130
this is saying is, if you've ever been on
a web page, you know that there is a difference
1038
01:28:52,130 --> 01:28:56,350
between before you click on the link and after,
there's kind of some stylistic changes. So
1039
01:28:56,350 --> 01:29:02,480
that's where pseudo selectors actually come
into play. The website has of those has those
1040
01:29:02,480 --> 01:29:07,230
defined properties. And they actually change
the way that the link looks before and after
1041
01:29:07,230 --> 01:29:10,590
it is clicked. So I'm going to go ahead and
do it here. Link is the unvisited link, remember,
1042
01:29:10,590 --> 01:29:14,429
so I'm going to go ahead and give it a color
of blue. And then when it's clicked, I'm going
1043
01:29:14,429 --> 01:29:15,810
to go ahead and give it a color of red tie
blue there. Remember, usually, the default
1044
01:29:15,810 --> 01:29:17,330
is that it is going to be purple like this
color here. Let's go ahead and refresh the
1045
01:29:17,330 --> 01:29:18,810
page, you can see that it's actually read
now. Now, obviously, I can't really go back
1046
01:29:18,810 --> 01:29:20,580
in time, and change the link so that it doesn't
look clicked. But you can see how powerful
1047
01:29:20,580 --> 01:29:25,050
this the pseudo selectors are, because you
can do so many different things. And once
1048
01:29:25,050 --> 01:29:27,490
we learn more properties, you can actually
change different parts of the page. And it
1049
01:29:27,490 --> 01:29:30,770
becomes very powerful to use these pseudo
selectors. So that's just one thing to keep
1050
01:29:30,770 --> 01:29:37,340
in mind. All right. So there we go. We've
covered most of the pseudo selectors, I'm
1051
01:29:37,340 --> 01:29:39,190
actually going to go ahead and add that hover
property there back in case anyone wants to
1052
01:29:39,190 --> 01:29:42,850
use the project files. So there we go. We've
covered everything here. And we've added all
1053
01:29:42,850 --> 01:29:44,680
of our pseudo selectors. So like I said, there's
many more, I've linked a couple articles that
1054
01:29:44,680 --> 01:29:50,270
help you to look at all of the different pseudo
selectors. And most of them, you're not really
1055
01:29:50,270 --> 01:29:53,119
going to use very often, they are useful in
any way, because they're usually you just
1056
01:29:53,119 --> 01:29:57,250
use some basic pseudo selectors like hover
and active, which I haven't actually covered.
1057
01:29:57,250 --> 01:30:01,440
But things like that. So you're not really
going to use all of them. But I just wanted
1058
01:30:01,440 --> 01:30:05,840
to give you an introduction to the main ones,
so that when it comes time to use them, you
1059
01:30:05,840 --> 01:30:10,730
have the tools to finish the job or create
that effect that you've always wanted. Alright,
1060
01:30:10,730 --> 01:30:11,730
let's move on.
1061
01:30:11,730 --> 01:30:17,591
Now let's go ahead and refresh and see what's
going on. All right. So you can see that that
1062
01:30:17,591 --> 01:30:21,130
TD right here, it's somewhere in this table,
nothing's actually happening. That's because
1063
01:30:21,130 --> 01:30:26,460
as we can see here, there is nothing on this
page where there's only one TD as a child.
1064
01:30:26,460 --> 01:30:30,540
So that's just one thing to keep in mind.
Sometimes pseudo selectors won't actually
1065
01:30:30,540 --> 01:30:35,489
style anything if they don't exist. So there
we go. That's pretty much for the basic children
1066
01:30:35,489 --> 01:30:39,640
kind of pseudo selectors. Let's move on to
some other students, selectors. Now, there
1067
01:30:39,640 --> 01:30:43,679
are selectors of this type that are actually
specific to certain elements, and one of them
1068
01:30:43,679 --> 01:30:48,880
is the anchor tag or the a tag. So I'm just
going to go ahead and create an anchor tag
1069
01:30:48,880 --> 01:30:57,010
under this h2 here. Oh, whoops. Okay, and
I'm just going to give it a link or an endpoint
1070
01:30:57,010 --> 01:31:03,390
of Google. So just like that. Okay, there
we go. So in here, I'm just going to say Click
1071
01:31:03,390 --> 01:31:07,460
here to go to Google. Pretty simple. At Tag.
Hopefully everyone knows how to do this. There
1072
01:31:07,460 --> 01:31:11,710
we go, we have our link there. So I click
on it takes me there, pretty standard stuff.
1073
01:31:11,710 --> 01:31:15,770
Now, we can actually create pseudo selectors
for this. So I'm going to be giving you two
1074
01:31:15,770 --> 01:31:20,300
for now. Now, there are many, many more. But
these are the two main ones you need to focus
1075
01:31:20,300 --> 01:31:30,119
on. The rest of them are kind of generalized.
And these are the main two that you're going
1076
01:31:30,119 --> 01:31:34,800
to be using. So I'm going to create them here.
And remember, you're using the element name,
1077
01:31:34,800 --> 01:31:36,550
you can use the class if you want, it's not
limited to single element names, actually,
1078
01:31:36,550 --> 01:31:41,719
why don't I go ahead and do that, I'm going
to give it an ID, because again, we only have
1079
01:31:41,719 --> 01:31:47,360
one of these on the page, I'm going to give
it an ID of Google link, just like that. So
1080
01:31:47,360 --> 01:31:58,250
now I'm gonna go ahead and reference that
in here. So remember, it's just the name of
1081
01:31:58,250 --> 01:32:00,139
this electric Google dash link, in this case,
and then the colon. So here, I'm going to
1082
01:32:00,139 --> 01:32:03,980
go ahead and say, link. Okay, so this is the
first pseudo selector. And then there's also
1083
01:32:03,980 --> 01:32:08,010
a second one. Don't worry about what I'm typing
for. now. I'll explain both of these in just
1084
01:32:08,010 --> 01:32:12,159
a second. Alright, so let's look at the first
one here, Google link, like, pretty much what
1085
01:32:12,159 --> 01:32:18,300
this is saying is, if you've ever been on
a web page, you know that there is a difference
1086
01:32:18,300 --> 01:32:21,680
between before you click on the link and after,
there's kind of some stylistic changes. So
1087
01:32:21,680 --> 01:32:25,099
that's where pseudo selectors actually come
into play. The website has of those has those
1088
01:32:25,099 --> 01:32:28,679
defined properties. And they actually change
the way that the link looks before and after
1089
01:32:28,679 --> 01:32:38,600
it is clicked. So I'm going to go ahead and
do it here. Link is the unvisited link, remember,
1090
01:32:38,600 --> 01:32:45,810
so I'm going to go ahead and give it a color
of blue. And then when it's clicked, I'm going
1091
01:32:45,810 --> 01:32:51,889
to go ahead and give it a color of red tie
blue there. Remember, usually, the default
1092
01:32:51,889 --> 01:33:03,310
is that it is going to be purple like this
color here. Let's go ahead and refresh the
1093
01:33:03,310 --> 01:33:10,540
page, you can see that it's actually read
now. Now, obviously, I can't really go back
1094
01:33:10,540 --> 01:33:17,200
in time, and change the link so that it doesn't
look clicked. But you can see how powerful
1095
01:33:17,200 --> 01:33:21,400
this the pseudo selectors are, because you
can do so many different things. And once
1096
01:33:21,400 --> 01:33:29,929
we learn more properties, you can actually
change different parts of the page. And it
1097
01:33:29,929 --> 01:33:33,270
becomes very powerful to use these pseudo
selectors. So that's just one thing to keep
1098
01:33:33,270 --> 01:33:38,590
in mind. All right. So there we go. We've
covered most of the pseudo selectors, I'm
1099
01:33:38,590 --> 01:33:44,449
actually going to go ahead and add that hover
property there back in case anyone wants to
1100
01:33:44,449 --> 01:33:49,100
use the project files. So there we go. We've
covered everything here. And we've added all
1101
01:33:49,100 --> 01:33:54,450
of our pseudo selectors. So like I said, there's
many more, I've linked a couple articles that
1102
01:33:54,450 --> 01:34:02,330
help you to look at all of the different pseudo
selectors. And most of them, you're not really
1103
01:34:02,330 --> 01:34:07,230
going to use very often, they are useful in
any way, because they're usually you just
1104
01:34:07,230 --> 01:34:10,860
use some basic pseudo selectors like hover
and active, which I haven't actually covered.
1105
01:34:10,860 --> 01:34:15,380
But things like that. So you're not really
going to use all of them. But I just wanted
1106
01:34:15,380 --> 01:34:20,619
to give you an introduction to the main ones,
so that when it comes time to use them, you
1107
01:34:20,619 --> 01:34:28,540
have the tools to finish the job or create
that effect that you've always wanted. Alright,
1108
01:34:28,540 --> 01:34:29,730
let's move on.
1109
01:34:29,730 --> 01:34:35,350
Today, we're going to be looking at Advanced
selectors. So right now, we've looked at our
1110
01:34:35,350 --> 01:34:39,869
basic selectors, or class selectors, element
selectors, and Id selectors. And we've also
1111
01:34:39,869 --> 01:34:45,300
looked at some pseudo selectors, which is
very useful. But now we're going to look at
1112
01:34:45,300 --> 01:34:50,130
some of the more advanced selectors. Now,
you're not going to use these every day. They're
1113
01:34:50,130 --> 01:34:54,940
not used very commonly, but it just shows
what you can actually do with these selectors,
1114
01:34:54,940 --> 01:34:59,409
because there is a lot. So there's a bunch
of advanced selectors. And I'm actually going
1115
01:34:59,409 --> 01:35:04,800
to be breaking these down into two parts,
we're going to be looking first at our basic
1116
01:35:04,800 --> 01:35:09,880
advanced selectors. And I know that sounds
a little bit contradictive. But we'll get
1117
01:35:09,880 --> 01:35:15,610
into that in just a second. And then after
that, we're going to be talking about attribute
1118
01:35:15,610 --> 01:35:18,740
selectors, which are probably the hardest
type of selector to get used to. Alright,
1119
01:35:18,740 --> 01:35:23,310
let's get started. So the first thing I want
to talk about is how you actually set up these
1120
01:35:23,310 --> 01:35:28,550
selectors. Now, these sometimes contain one,
two, or sometimes even three elements in one
1121
01:35:28,550 --> 01:35:32,300
selector. So I'm going to be going through
these and talking about how they all work.
1122
01:35:32,300 --> 01:35:36,900
So the first selector I'm going to be talking
about is something called the adjacent sibling
1123
01:35:36,900 --> 01:35:39,550
selector. So pretty much what this does is
selects every single element that directly
1124
01:35:39,550 --> 01:35:43,330
follows a different element. So I'll show
you how to set this up. Let's first take a
1125
01:35:43,330 --> 01:35:46,950
look at our HTML page every over here, sorry.
Now you can see we have our services, which
1126
01:35:46,950 --> 01:35:53,310
is an h2, and then we have an a tag. Now first
thing I'm going to do is actually go ahead
1127
01:35:53,310 --> 01:35:57,190
and get rid of these two, I'm going to actually
comment them out. You can do this with Ctrl,
1128
01:35:57,190 --> 01:36:02,760
slash, like that. So if you type control slash
comments here with which pretty much just
1129
01:36:02,760 --> 01:36:05,949
renders it useless, it doesn't run or anything
like that. Let's get started. So the first
1130
01:36:05,949 --> 01:36:12,909
thing I want to do is go ahead and set this
up. So I want to be able to apply styles to
1131
01:36:12,909 --> 01:36:17,690
every a tag or anchor tag that comes directly
after an h2. So the way to set this up is
1132
01:36:17,690 --> 01:36:23,580
all you have to do is go the element that
you Want to be the first element. So in this
1133
01:36:23,580 --> 01:36:28,770
case, it's going to be our h2. And then afterwards,
it's going to be the element that you want
1134
01:36:28,770 --> 01:36:35,190
after, which is our a tag. So you want h2
plus a. So this is pretty much saying every
1135
01:36:35,190 --> 01:36:40,270
anchor tag that follows an h2. So then we
can pretty much just set the style however
1136
01:36:40,270 --> 01:36:44,929
we want. So I'm going to say color is red,
just like that. Now remember, this isn't any
1137
01:36:44,929 --> 01:36:49,130
there is no pseudo selector on this, if you
could add it if you wanted to. Because this
1138
01:36:49,130 --> 01:36:52,630
is still a selector. Remember, I'm not going
to add any. So I'm going to go ahead and refresh
1139
01:36:52,630 --> 01:36:54,840
the page. And you can see it turns red again.
So that's the first type of selector. Next
1140
01:36:54,840 --> 01:36:58,680
thing I want to look at is the general sibling
combinator, or selector. So this is a little
1141
01:36:58,680 --> 01:37:08,250
bit more difficult to understand. But All
in good time, it's once you get used to it,
1142
01:37:08,250 --> 01:37:12,510
it becomes much easier to understand. So pretty
much what the general sibling selector does,
1143
01:37:12,510 --> 01:37:18,409
is goes for the same kind of idea as this
selector here, it looks for elements that
1144
01:37:18,409 --> 01:37:22,770
go directly after one another, except they
have to be sharing the same parents, okay.
1145
01:37:22,770 --> 01:37:27,599
So for example, let's see our input here our
form, we have an input and a text area, or
1146
01:37:27,599 --> 01:37:33,139
a button followed by a text area, for example.
So what we're going to do here is I want to
1147
01:37:33,139 --> 01:37:38,350
style every button that's followed by a text
area, except in this case, they have to share
1148
01:37:38,350 --> 01:37:43,349
the same parent. So what we're going to do
is go and say, every button, which is going
1149
01:37:43,349 --> 01:37:48,699
to be the next one, or the final one, which
is eight here. So sorry, it's actually going
1150
01:37:48,699 --> 01:37:51,770
to be text area. Right, because that's the
first element here, which is our text area.
1151
01:37:51,770 --> 01:37:56,260
And then this symbol followed, and then it's
going to be a button, like that. So this is
1152
01:37:56,260 --> 01:38:02,580
seeing every button that is followed, or that
is after a text area, but they're in the same
1153
01:38:02,580 --> 01:38:08,949
parent. So from here, we can go and style
it however we want. So in this case, I'm going
1154
01:38:08,949 --> 01:38:17,280
to go ahead and just say the color is purple.
Oops. Now if we go ahead and refresh, you
1155
01:38:17,280 --> 01:38:22,389
can see that the button color is purple. So
like I said, the main difference between these
1156
01:38:22,389 --> 01:38:24,950
two is that the first one is going to be styling
elements that follow each other no matter
1157
01:38:24,950 --> 01:38:28,969
where they are on the scale. So if you actually
look up here, they don't share any parents,
1158
01:38:28,969 --> 01:38:31,510
they're completely separate elements. Whereas
here, they have to follow each other. And
1159
01:38:31,510 --> 01:38:34,900
I'll actually demonstrate that quickly. If
we change this to a plus here. and refresh,
1160
01:38:34,900 --> 01:38:39,290
the style is still going to work because they
are directly preceded. But the only thing
1161
01:38:39,290 --> 01:38:42,429
is if they aren't. So for example, I'm just
going to actually move this button out of
1162
01:38:42,429 --> 01:38:43,429
the form.
1163
01:38:43,429 --> 01:38:46,250
Today, we're going to be looking at Advanced
selectors. So right now, we've looked at our
1164
01:38:46,250 --> 01:38:49,130
basic selectors, or class selectors, element
selectors, and Id selectors. And we've also
1165
01:38:49,130 --> 01:38:54,679
looked at some pseudo selectors, which is
very useful. But now we're going to look at
1166
01:38:54,679 --> 01:38:59,490
some of the more advanced selectors. Now,
you're not going to use these every day. They're
1167
01:38:59,490 --> 01:39:02,770
not used very commonly, but it just shows
what you can actually do with these selectors,
1168
01:39:02,770 --> 01:39:06,690
because there is a lot. So there's a bunch
of advanced selectors. And I'm actually going
1169
01:39:06,690 --> 01:39:11,699
to be breaking these down into two parts,
we're going to be looking first at our basic
1170
01:39:11,699 --> 01:39:15,370
advanced selectors. And I know that sounds
a little bit contradictive. But we'll get
1171
01:39:15,370 --> 01:39:19,520
into that in just a second. And then after
that, we're going to be talking about attribute
1172
01:39:19,520 --> 01:39:21,880
selectors, which are probably the hardest
type of selector to get used to. Alright,
1173
01:39:21,880 --> 01:39:24,380
let's get started. So the first thing I want
to talk about is how you actually set up these
1174
01:39:24,380 --> 01:39:26,420
selectors. Now, these sometimes contain one,
two, or sometimes even three elements in one
1175
01:39:26,420 --> 01:39:29,790
selector. So I'm going to be going through
these and talking about how they all work.
1176
01:39:29,790 --> 01:39:35,770
So the first selector I'm going to be talking
about is something called the adjacent sibling
1177
01:39:35,770 --> 01:39:40,960
selector. So pretty much what this does is
selects every single element that directly
1178
01:39:40,960 --> 01:39:44,110
follows a different element. So I'll show
you how to set this up. Let's first take a
1179
01:39:44,110 --> 01:39:51,590
look at our HTML page every over here, sorry.
Now you can see we have our services, which
1180
01:39:51,590 --> 01:40:00,030
is an h2, and then we have an a tag. Now first
thing I'm going to do is actually go ahead
1181
01:40:00,030 --> 01:40:07,489
and get rid of these two, I'm going to actually
comment them out. You can do this with Ctrl,
1182
01:40:07,489 --> 01:40:12,409
slash, like that. So if you type control slash
comments here with which pretty much just
1183
01:40:12,409 --> 01:40:18,370
renders it useless, it doesn't run or anything
like that. Let's get started. So the first
1184
01:40:18,370 --> 01:40:27,280
thing I want to do is go ahead and set this
up. So I want to be able to apply styles to
1185
01:40:27,280 --> 01:40:34,639
every a tag or anchor tag that comes directly
after an h2. So the way to set this up is
1186
01:40:34,639 --> 01:40:41,510
all you have to do is go the element that
you Want to be the first element. So in this
1187
01:40:41,510 --> 01:40:50,920
case, it's going to be our h2. And then afterwards,
it's going to be the element that you want
1188
01:40:50,920 --> 01:40:56,070
after, which is our a tag. So you want h2
plus a. So this is pretty much saying every
1189
01:40:56,070 --> 01:41:02,010
anchor tag that follows an h2. So then we
can pretty much just set the style however
1190
01:41:02,010 --> 01:41:10,130
we want. So I'm going to say color is red,
just like that. Now remember, this isn't any
1191
01:41:10,130 --> 01:41:22,320
there is no pseudo selector on this, if you
could add it if you wanted to. Because this
1192
01:41:22,320 --> 01:41:31,630
is still a selector. Remember, I'm not going
to add any. So I'm going to go ahead and refresh
1193
01:41:31,630 --> 01:41:36,170
the page. And you can see it turns red again.
So that's the first type of selector. Next
1194
01:41:36,170 --> 01:41:39,170
thing I want to look at is the general sibling
combinator, or selector. So this is a little
1195
01:41:39,170 --> 01:41:42,349
bit more difficult to understand. But All
in good time, it's once you get used to it,
1196
01:41:42,349 --> 01:41:45,889
it becomes much easier to understand. So pretty
much what the general sibling selector does,
1197
01:41:45,889 --> 01:41:50,290
is goes for the same kind of idea as this
selector here, it looks for elements that
1198
01:41:50,290 --> 01:41:55,050
go directly after one another, except they
have to be sharing the same parents, okay.
1199
01:41:55,050 --> 01:42:04,409
So for example, let's see our input here our
form, we have an input and a text area, or
1200
01:42:04,409 --> 01:42:11,790
a button followed by a text area, for example.
So what we're going to do here is I want to
1201
01:42:11,790 --> 01:42:16,760
style every button that's followed by a text
area, except in this case, they have to share
1202
01:42:16,760 --> 01:42:20,000
the same parent. So what we're going to do
is go and say, every button, which is going
1203
01:42:20,000 --> 01:42:24,000
to be the next one, or the final one, which
is eight here. So sorry, it's actually going
1204
01:42:24,000 --> 01:42:27,770
to be text area. Right, because that's the
first element here, which is our text area.
1205
01:42:27,770 --> 01:42:40,060
And then this symbol followed, and then it's
going to be a button, like that. So this is
1206
01:42:40,060 --> 01:42:46,080
seeing every button that is followed, or that
is after a text area, but they're in the same
1207
01:42:46,080 --> 01:42:51,140
parent. So from here, we can go and style
it however we want. So in this case, I'm going
1208
01:42:51,140 --> 01:42:54,370
to go ahead and just say the color is purple.
Oops. Now if we go ahead and refresh, you
1209
01:42:54,370 --> 01:43:00,989
can see that the button color is purple. So
like I said, the main difference between these
1210
01:43:00,989 --> 01:43:09,620
two is that the first one is going to be styling
elements that follow each other no matter
1211
01:43:09,620 --> 01:43:14,139
where they are on the scale. So if you actually
look up here, they don't share any parents,
1212
01:43:14,139 --> 01:43:17,840
they're completely separate elements. Whereas
here, they have to follow each other. And
1213
01:43:17,840 --> 01:43:24,110
I'll actually demonstrate that quickly. If
we change this to a plus here. and refresh,
1214
01:43:24,110 --> 01:43:29,280
the style is still going to work because they
are directly preceded. But the only thing
1215
01:43:29,280 --> 01:43:32,610
is if they aren't. So for example, I'm just
going to actually move this button out of
1216
01:43:32,610 --> 01:43:33,610
the form.
1217
01:43:33,610 --> 01:43:37,020
Just like that seems like the button disappeared
there. Let's go ahead and redo that. Okay,
1218
01:43:37,020 --> 01:43:43,150
so we have the button back. Now I'm going
to go ahead and change this back to our symbol
1219
01:43:43,150 --> 01:43:48,800
there. And if we go ahead and refresh, you
can see that the button right there, it doesn't
1220
01:43:48,800 --> 01:43:54,350
actually have that styling anymore, because
although they directly follow each other,
1221
01:43:54,350 --> 01:43:58,400
they're not under the same parent. So that's
just one minor difference. Alright, let's
1222
01:43:58,400 --> 01:44:06,570
move on to the next one. It's called the child
selector. So this is probably the most basic
1223
01:44:06,570 --> 01:44:10,860
out of all of these advanced selectors. And
pretty much what is saying is every single
1224
01:44:10,860 --> 01:44:17,270
child have a certain element. So I'll give
you an example. Here, we have an Li and a
1225
01:44:17,270 --> 01:44:29,199
ul, this is pretty basic, all you have to
do is type ul, which is going to be a parent.
1226
01:44:29,199 --> 01:44:34,400
And then this symbol or the greater than symbol,
and Li so this is gonna say every single Li
1227
01:44:34,400 --> 01:44:42,130
inside of a ul, open up the brackets. And
let's start to color this time to blue. I'm
1228
01:44:42,130 --> 01:44:47,619
just gonna say that. And remember, specificity
is at play here. Now, like I said, the specificity
1229
01:44:47,619 --> 01:44:50,699
rules, once you use these advanced selectors
get quite complicated. But for example, if
1230
01:44:50,699 --> 01:44:54,219
we actually look at the Li here, the style
for this, we can see that the Li with the
1231
01:44:54,219 --> 01:45:06,179
pseudo selector is actually more specific
than the this general selector. So I'm going
1232
01:45:06,179 --> 01:45:11,930
to go ahead and comment that out. Now if we
refresh the page, you can see that it's blue.
1233
01:45:11,930 --> 01:45:16,349
So that's just one thing to keep in mind with
these advanced selectors. They can get pretty
1234
01:45:16,349 --> 01:45:20,080
complicated. And that's why we use the numbers,
the zeros, ones, twos, things like that, is
1235
01:45:20,080 --> 01:45:25,920
to be able to classify these once we get and
start using these advanced selectors. Like
1236
01:45:25,920 --> 01:45:36,040
I said, usually you won't use these in your
general use. So I'm not going to go over specificity
1237
01:45:36,040 --> 01:45:40,860
especially because usually, you'll group up
all of these styles into one selector. Okay,
1238
01:45:40,860 --> 01:45:46,400
so that's the child selector. The next one
is very similar to the child selector, but
1239
01:45:46,400 --> 01:45:50,520
instead of having direct children, there's
actually something called a descendant. So
1240
01:45:50,520 --> 01:45:56,480
I'm just going to go ahead and edit this a
little bit. I'm going to have an Li okay,
1241
01:45:56,480 --> 01:46:02,810
but then I'm going to create an ordered list
inside of the Output training to create an
1242
01:46:02,810 --> 01:46:08,380
Li and put the ordered list inside of that.
So pretty much what's going on here is I'm
1243
01:46:08,380 --> 01:46:13,929
creating an ordered list or a numbered list
inside of a list item that is inside of a
1244
01:46:13,929 --> 01:46:19,610
ul. So a little bit complicated. But we'll
get to that in just a second. So I'm going
1245
01:46:19,610 --> 01:46:23,840
to create an Li inside of this. And I'm going
to say, my numbered list item, just like that.
1246
01:46:23,840 --> 01:46:28,560
Alright, now I'm going to go ahead and refresh
the page. And you can see we have a list item
1247
01:46:28,560 --> 01:46:31,610
here with our item. All right, so let's get
started on using this descendant selector.
1248
01:46:31,610 --> 01:46:36,760
So I'm going to get started, first thing I
want to do is actually set this up. So first
1249
01:46:36,760 --> 01:46:42,310
thing we're going to have is the parent. Okay,
so in this case, it's going to be our ul,
1250
01:46:42,310 --> 01:46:48,840
remember, because that's the top level. But
then I'm going to select the Li here, but
1251
01:46:48,840 --> 01:46:53,960
I'm not going to put our greater than symbol.
So that's the big difference. This is the
1252
01:46:53,960 --> 01:47:00,349
descendant selector, and then this is going
to be our child selector. So that's just the
1253
01:47:00,349 --> 01:47:07,370
main difference, it's very easy to miss, just
make sure that you don't mess that up. So
1254
01:47:07,370 --> 01:47:15,020
now I'm going to select the color and set
it to four. Now let's just say green. All
1255
01:47:15,020 --> 01:47:21,300
right, now let's go ahead and refresh the
page. And you can see that all of the lies
1256
01:47:21,300 --> 01:47:25,659
inside of there are going to be green, right?
Only problem is our ordered list right here
1257
01:47:25,659 --> 01:47:31,170
is actually purple, right? And of course,
you know, our list here is getting a little
1258
01:47:31,170 --> 01:47:34,740
bit complicated. So I'm going to go ahead
and comment this out. Remember, this is a
1259
01:47:34,740 --> 01:47:39,210
very specific selector. Now, if I go ahead
and refresh, both of them are green. All right.
1260
01:47:39,210 --> 01:47:44,380
So what do you need to take away from this,
it's pretty much what this is saying is any
1261
01:47:44,380 --> 01:47:48,829
Li that eventually boils back or propagates
up if you have done any programming before,
1262
01:47:48,829 --> 01:47:54,050
that goes up to N A ul, okay, so I'll just
show you what that means. In this case, the
1263
01:47:54,050 --> 01:47:55,810
Li is a direct child of the UL, right. But
then we have another Li in here, which is
1264
01:47:55,810 --> 01:48:00,810
a child of n o l, which is just child of an
Li, which is a child of the UL, right. So
1265
01:48:00,810 --> 01:48:07,250
as you move up and up, it eventually comes
back to the UL as the parent element. So the
1266
01:48:07,250 --> 01:48:11,469
main difference you need to take away from
this is that the child selector is selecting
1267
01:48:11,469 --> 01:48:15,910
any direct children. So anything here would
not apply, because we're actually
1268
01:48:15,910 --> 01:48:19,969
Just like that seems like the button disappeared
there. Let's go ahead and redo that. Okay,
1269
01:48:19,969 --> 01:48:24,630
so we have the button back. Now I'm going
to go ahead and change this back to our symbol
1270
01:48:24,630 --> 01:48:29,440
there. And if we go ahead and refresh, you
can see that the button right there, it doesn't
1271
01:48:29,440 --> 01:48:32,070
actually have that styling anymore, because
although they directly follow each other,
1272
01:48:32,070 --> 01:48:36,420
they're not under the same parent. So that's
just one minor difference. Alright, let's
1273
01:48:36,420 --> 01:48:42,889
move on to the next one. It's called the child
selector. So this is probably the most basic
1274
01:48:42,889 --> 01:48:46,020
out of all of these advanced selectors. And
pretty much what is saying is every single
1275
01:48:46,020 --> 01:48:50,199
child have a certain element. So I'll give
you an example. Here, we have an Li and a
1276
01:48:50,199 --> 01:48:56,320
ul, this is pretty basic, all you have to
do is type ul, which is going to be a parent.
1277
01:48:56,320 --> 01:49:00,830
And then this symbol or the greater than symbol,
and Li so this is gonna say every single Li
1278
01:49:00,830 --> 01:49:09,650
inside of a ul, open up the brackets. And
let's start to color this time to blue. I'm
1279
01:49:09,650 --> 01:49:12,869
just gonna say that. And remember, specificity
is at play here. Now, like I said, the specificity
1280
01:49:12,869 --> 01:49:17,389
rules, once you use these advanced selectors
get quite complicated. But for example, if
1281
01:49:17,389 --> 01:49:23,139
we actually look at the Li here, the style
for this, we can see that the Li with the
1282
01:49:23,139 --> 01:49:28,070
pseudo selector is actually more specific
than the this general selector. So I'm going
1283
01:49:28,070 --> 01:49:33,850
to go ahead and comment that out. Now if we
refresh the page, you can see that it's blue.
1284
01:49:33,850 --> 01:49:38,929
So that's just one thing to keep in mind with
these advanced selectors. They can get pretty
1285
01:49:38,929 --> 01:49:44,210
complicated. And that's why we use the numbers,
the zeros, ones, twos, things like that, is
1286
01:49:44,210 --> 01:49:49,869
to be able to classify these once we get and
start using these advanced selectors. Like
1287
01:49:49,869 --> 01:49:55,219
I said, usually you won't use these in your
general use. So I'm not going to go over specificity
1288
01:49:55,219 --> 01:50:00,070
especially because usually, you'll group up
all of these styles into one selector. Okay,
1289
01:50:00,070 --> 01:50:03,690
so that's the child selector. The next one
is very similar to the child selector, but
1290
01:50:03,690 --> 01:50:06,719
instead of having direct children, there's
actually something called a descendant. So
1291
01:50:06,719 --> 01:50:12,130
I'm just going to go ahead and edit this a
little bit. I'm going to have an Li okay,
1292
01:50:12,130 --> 01:50:16,559
but then I'm going to create an ordered list
inside of the Output training to create an
1293
01:50:16,559 --> 01:50:19,550
Li and put the ordered list inside of that.
So pretty much what's going on here is I'm
1294
01:50:19,550 --> 01:50:24,389
creating an ordered list or a numbered list
inside of a list item that is inside of a
1295
01:50:24,389 --> 01:50:29,510
ul. So a little bit complicated. But we'll
get to that in just a second. So I'm going
1296
01:50:29,510 --> 01:50:34,949
to create an Li inside of this. And I'm going
to say, my numbered list item, just like that.
1297
01:50:34,949 --> 01:50:37,820
Alright, now I'm going to go ahead and refresh
the page. And you can see we have a list item
1298
01:50:37,820 --> 01:50:39,620
here with our item. All right, so let's get
started on using this descendant selector.
1299
01:50:39,620 --> 01:50:42,550
So I'm going to get started, first thing I
want to do is actually set this up. So first
1300
01:50:42,550 --> 01:50:48,030
thing we're going to have is the parent. Okay,
so in this case, it's going to be our ul,
1301
01:50:48,030 --> 01:50:52,090
remember, because that's the top level. But
then I'm going to select the Li here, but
1302
01:50:52,090 --> 01:50:56,980
I'm not going to put our greater than symbol.
So that's the big difference. This is the
1303
01:50:56,980 --> 01:51:01,080
descendant selector, and then this is going
to be our child selector. So that's just the
1304
01:51:01,080 --> 01:51:05,780
main difference, it's very easy to miss, just
make sure that you don't mess that up. So
1305
01:51:05,780 --> 01:51:09,040
now I'm going to select the color and set
it to four. Now let's just say green. All
1306
01:51:09,040 --> 01:51:11,740
right, now let's go ahead and refresh the
page. And you can see that all of the lies
1307
01:51:11,740 --> 01:51:16,500
inside of there are going to be green, right?
Only problem is our ordered list right here
1308
01:51:16,500 --> 01:51:20,320
is actually purple, right? And of course,
you know, our list here is getting a little
1309
01:51:20,320 --> 01:51:24,550
bit complicated. So I'm going to go ahead
and comment this out. Remember, this is a
1310
01:51:24,550 --> 01:51:30,610
very specific selector. Now, if I go ahead
and refresh, both of them are green. All right.
1311
01:51:30,610 --> 01:51:33,980
So what do you need to take away from this,
it's pretty much what this is saying is any
1312
01:51:33,980 --> 01:51:35,720
Li that eventually boils back or propagates
up if you have done any programming before,
1313
01:51:35,720 --> 01:51:37,661
that goes up to N A ul, okay, so I'll just
show you what that means. In this case, the
1314
01:51:37,661 --> 01:51:42,090
Li is a direct child of the UL, right. But
then we have another Li in here, which is
1315
01:51:42,090 --> 01:51:47,710
a child of n o l, which is just child of an
Li, which is a child of the UL, right. So
1316
01:51:47,710 --> 01:51:50,960
as you move up and up, it eventually comes
back to the UL as the parent element. So the
1317
01:51:50,960 --> 01:51:54,770
main difference you need to take away from
this is that the child selector is selecting
1318
01:51:54,770 --> 01:51:58,030
any direct children. So anything here would
not apply, because we're actually
1319
01:51:58,030 --> 01:52:05,130
this one wouldn't apply, because the ordered
list is actually a child of the Li remember,
1320
01:52:05,130 --> 01:52:09,700
but when you're using the descendant selector,
what actually happens is, if it is contained
1321
01:52:09,700 --> 01:52:15,090
inside of a ul at all, then use or apply the
styles. So I'm going to go ahead and demonstrate
1322
01:52:15,090 --> 01:52:20,760
this. Now. Let's go ahead and actually remove
this Li remember, because once you get to
1323
01:52:20,760 --> 01:52:29,949
this point, CSS gets a little bit complicated.
This is going to end up styling everything
1324
01:52:29,949 --> 01:52:37,180
inside it. So I'm actually just going to remove
this and leave it just the ordered list. So
1325
01:52:37,180 --> 01:52:41,280
right now, we have the ordered list as a child
of the UL. Now I'm going to go ahead and refresh.
1326
01:52:41,280 --> 01:52:43,449
And you can see it still stays the same, because
we have this style applied. But why don't
1327
01:52:43,449 --> 01:52:49,079
we go ahead and remove this, what do you think's
going to happen? Well, you can see here that
1328
01:52:49,079 --> 01:52:54,210
this stays blue, remember, because of our
direct child selector, but then this doesn't
1329
01:52:54,210 --> 01:53:00,820
have any style at all. So this Li works perfectly.
It is a direct child of the UL, which means
1330
01:53:00,820 --> 01:53:07,110
it's going to be colored with the style specified.
The only problem is this Li is a direct child
1331
01:53:07,110 --> 01:53:11,650
have the ordered list, which is completely
separate from this one. So the styles aren't
1332
01:53:11,650 --> 01:53:18,300
going to be applied on this one. On the other
hand, if we did have our descendant selector
1333
01:53:18,300 --> 01:53:23,619
enabled, it's going to style both of them
because remember, the Li is a child of the
1334
01:53:23,619 --> 01:53:30,850
oil, and the oil is a child of the UL. So
just keep that in mind, there's a big difference
1335
01:53:30,850 --> 01:53:37,949
between the two, you might be able to miss
it, it could really mess up your code. So
1336
01:53:37,949 --> 01:53:43,960
just make sure to keep that in mind. Alright,
so those are pretty much the basic advanced
1337
01:53:43,960 --> 01:53:47,409
selectors, those are the four that you're
mainly going to use. Again, there's many more,
1338
01:53:47,409 --> 01:53:51,070
but they are quite difficult. And we're not
going to cover them because they're not very
1339
01:53:51,070 --> 01:53:55,570
useful. So there we go. Those are the four
selectors that you can use. Go ahead and practice
1340
01:53:55,570 --> 01:54:01,760
them as much as you want. You know, try messing
them around, open up some HTML files and just
1341
01:54:01,760 --> 01:54:06,040
see what you can do with them. All right,
let's move on.
1342
01:54:06,040 --> 01:54:11,610
this one wouldn't apply, because the ordered
list is actually a child of the Li remember,
1343
01:54:11,610 --> 01:54:15,449
but when you're using the descendant selector,
what actually happens is, if it is contained
1344
01:54:15,449 --> 01:54:20,809
inside of a ul at all, then use or apply the
styles. So I'm going to go ahead and demonstrate
1345
01:54:20,809 --> 01:54:25,440
this. Now. Let's go ahead and actually remove
this Li remember, because once you get to
1346
01:54:25,440 --> 01:54:29,429
this point, CSS gets a little bit complicated.
This is going to end up styling everything
1347
01:54:29,429 --> 01:54:33,840
inside it. So I'm actually just going to remove
this and leave it just the ordered list. So
1348
01:54:33,840 --> 01:54:39,230
right now, we have the ordered list as a child
of the UL. Now I'm going to go ahead and refresh.
1349
01:54:39,230 --> 01:54:47,829
And you can see it still stays the same, because
we have this style applied. But why don't
1350
01:54:47,829 --> 01:54:56,130
we go ahead and remove this, what do you think's
going to happen? Well, you can see here that
1351
01:54:56,130 --> 01:55:00,230
this stays blue, remember, because of our
direct child selector, but then this doesn't
1352
01:55:00,230 --> 01:55:05,210
have any style at all. So this Li works perfectly.
It is a direct child of the UL, which means
1353
01:55:05,210 --> 01:55:09,250
it's going to be colored with the style specified.
The only problem is this Li is a direct child
1354
01:55:09,250 --> 01:55:12,290
have the ordered list, which is completely
separate from this one. So the styles aren't
1355
01:55:12,290 --> 01:55:16,840
going to be applied on this one. On the other
hand, if we did have our descendant selector
1356
01:55:16,840 --> 01:55:20,290
enabled, it's going to style both of them
because remember, the Li is a child of the
1357
01:55:20,290 --> 01:55:26,139
oil, and the oil is a child of the UL. So
just keep that in mind, there's a big difference
1358
01:55:26,139 --> 01:55:30,640
between the two, you might be able to miss
it, it could really mess up your code. So
1359
01:55:30,640 --> 01:55:34,869
just make sure to keep that in mind. Alright,
so those are pretty much the basic advanced
1360
01:55:34,869 --> 01:55:41,610
selectors, those are the four that you're
mainly going to use. Again, there's many more,
1361
01:55:41,610 --> 01:55:47,050
but they are quite difficult. And we're not
going to cover them because they're not very
1362
01:55:47,050 --> 01:55:55,340
useful. So there we go. Those are the four
selectors that you can use. Go ahead and practice
1363
01:55:55,340 --> 01:55:59,880
them as much as you want. You know, try messing
them around, open up some HTML files and just
1364
01:55:59,880 --> 01:56:01,639
see what you can do with them. All right,
let's move on.
1365
01:56:01,639 --> 01:56:05,639
Welcome back. So in this video, I am going
to be talking about the last type of selector.
1366
01:56:05,639 --> 01:56:10,070
These are called attribute selectors. They're
a little bit complicated once you get started,
1367
01:56:10,070 --> 01:56:15,440
but once we actually start using them, they
become very easy to use. So first of all,
1368
01:56:15,440 --> 01:56:20,270
what is an attribute selector? Well, as we
know, in HTML, we can actually add attributes
1369
01:56:20,270 --> 01:56:26,369
to all of our elements. So for example, this
image here has an attribute of source which
1370
01:56:26,369 --> 01:56:32,610
tells the image tag where the source of the
images. But what we can actually do in CSS
1371
01:56:32,610 --> 01:56:37,050
is use these to our advantage, we can select
certain elements that for certain attributes
1372
01:56:37,050 --> 01:56:41,199
and their values. So for example, let's go
ahead and try and rewrite this subtitle class
1373
01:56:41,199 --> 01:56:45,170
here. So we know if we go over here that all
of our, all of our subtitle classes are used
1374
01:56:45,170 --> 01:56:49,809
in h2. So what I want to do is actually rewrite
this in terms of our attribute selector. So
1375
01:56:49,809 --> 01:56:55,550
what we do is first start off with our tag
name, which is h2. But then inside of some
1376
01:56:55,550 --> 01:56:58,440
square brackets, what we do is type attribute
is equal to value. Okay, so obviously, we're
1377
01:56:58,440 --> 01:57:00,270
not going to do it like this, we're going
to have to select some sort of attribute.
1378
01:57:00,270 --> 01:57:03,550
What this allows us to do is actually select
certain things or certain elements based on
1379
01:57:03,550 --> 01:57:07,010
their attributes. So in this clip, in this
case, we want to select everything that has
1380
01:57:07,010 --> 01:57:10,770
the attribute of class, and we want to make
sure that the class itself is subtitled. Okay.
1381
01:57:10,770 --> 01:57:16,440
Now, you do not need quotation marks for these,
unlike how they were in HTML, you can see
1382
01:57:16,440 --> 01:57:21,560
we do need quotation marks, but in CSS, we
don't actually need them. Alright, so there
1383
01:57:21,560 --> 01:57:24,780
we go. We have rewritten our class here. But
we've read we've but we've written it in a
1384
01:57:24,780 --> 01:57:28,010
way that allows us to select it based on its
act on the attribute of it itself. So let's
1385
01:57:28,010 --> 01:57:31,739
go ahead and refresh the page and see what
happens, you can see that this state exactly
1386
01:57:31,739 --> 01:57:35,330
the same. Now nothing has changed. If I go
ahead and change this back to dot subtitle,
1387
01:57:35,330 --> 01:57:39,570
just like that, refresh the page, you can
see nothing's changed. So that's pretty basic.
1388
01:57:39,570 --> 01:57:46,010
Now, it doesn't just have to be class, we
can select it based on many different things.
1389
01:57:46,010 --> 01:57:51,829
So for example, if I wanted to select this
image over here, I'm going to go over to the
1390
01:57:51,829 --> 01:57:56,739
bottom, I could say image, image, and then
every and then the source has to be equal
1391
01:57:56,739 --> 01:58:00,760
to something. All right. So there we go. Now
we've done that. But there's actually more
1392
01:58:00,760 --> 01:58:05,409
than one type of selector. Now, usually, this
is the basic one where you just equate one
1393
01:58:05,409 --> 01:58:11,199
side to the other. But there's actually many
more types of selectors, which allow you to
1394
01:58:11,199 --> 01:58:15,230
kind of modify the attribute selectors and
make them much more powerful than they are
1395
01:58:15,230 --> 01:58:24,280
right now. So how do we do this? Well, I'm
going to be covering just a few of them with
1396
01:58:24,280 --> 01:58:29,659
you today, and showing you how you can use
them. So we have two images on this page.
1397
01:58:29,659 --> 01:58:34,219
Now both of them are located in this image
folder. Is there do you think that there's
1398
01:58:34,219 --> 01:58:38,360
any way that we can select both of them in
one go using an attribute selector? Well,
1399
01:58:38,360 --> 01:58:43,520
there actually is. So here's what we have
to do. First of all, let's find the common
1400
01:58:43,520 --> 01:58:50,059
factor between these two images. They both
are contained inside this folder. So they
1401
01:58:50,059 --> 01:58:52,880
both start definitely start with this path,
dot dot slash IMG slash, both of them are
1402
01:58:52,880 --> 01:58:57,020
going to contain this. And if we actually
go back and look, you can see that both images
1403
01:58:57,020 --> 01:59:02,010
actually do contain this link here, wherever
the other images, there it is. So there we
1404
01:59:02,010 --> 01:59:05,370
go. Now we've done that. But remember that
this is direct equating this has to be equal
1405
01:59:05,370 --> 01:59:09,190
to this. And unfortunately, neither of them
are equal to that. So how do you think we
1406
01:59:09,190 --> 01:59:13,090
fix this? Well, all we have to do is put a
carrot behind the attribute, just like this.
1407
01:59:13,090 --> 01:59:16,079
So what this says is every single image where
the source contains or starts with, sorry,
1408
01:59:16,079 --> 01:59:19,510
yeah, starts with this piece of information,
what comes after, it doesn't matter. But what
1409
01:59:19,510 --> 01:59:23,770
we're doing is selecting all of the images
where the source attribute starts with this
1410
01:59:23,770 --> 01:59:32,890
value right here. So this is you can already
see how powerful this is. Now, if we go ahead
1411
01:59:32,890 --> 01:59:40,160
and refresh the page, obviously, we can't
see anything because we didn't add any styles.
1412
01:59:40,160 --> 01:59:47,170
But I'm going to go ahead and add a quick
style for you. Or you don't need to know how
1413
01:59:47,170 --> 01:59:48,170
to do this,
1414
01:59:48,170 --> 01:59:54,300
Welcome back. So in this video, I am going
to be talking about the last type of selector.
1415
01:59:54,300 --> 01:59:59,480
These are called attribute selectors. They're
a little bit complicated once you get started,
1416
01:59:59,480 --> 02:00:02,849
but once we actually start using them, they
become very easy to use. So first of all,
1417
02:00:02,849 --> 02:00:07,969
what is an attribute selector? Well, as we
know, in HTML, we can actually add attributes
1418
02:00:07,969 --> 02:00:13,130
to all of our elements. So for example, this
image here has an attribute of source which
1419
02:00:13,130 --> 02:00:19,030
tells the image tag where the source of the
images. But what we can actually do in CSS
1420
02:00:19,030 --> 02:00:22,260
is use these to our advantage, we can select
certain elements that for certain attributes
1421
02:00:22,260 --> 02:00:32,340
and their values. So for example, let's go
ahead and try and rewrite this subtitle class
1422
02:00:32,340 --> 02:00:37,890
here. So we know if we go over here that all
of our, all of our subtitle classes are used
1423
02:00:37,890 --> 02:00:41,730
in h2. So what I want to do is actually rewrite
this in terms of our attribute selector. So
1424
02:00:41,730 --> 02:00:45,320
what we do is first start off with our tag
name, which is h2. But then inside of some
1425
02:00:45,320 --> 02:00:47,619
square brackets, what we do is type attribute
is equal to value. Okay, so obviously, we're
1426
02:00:47,619 --> 02:00:51,179
not going to do it like this, we're going
to have to select some sort of attribute.
1427
02:00:51,179 --> 02:00:55,540
What this allows us to do is actually select
certain things or certain elements based on
1428
02:00:55,540 --> 02:00:59,920
their attributes. So in this clip, in this
case, we want to select everything that has
1429
02:00:59,920 --> 02:01:06,909
the attribute of class, and we want to make
sure that the class itself is subtitled. Okay.
1430
02:01:06,909 --> 02:01:13,610
Now, you do not need quotation marks for these,
unlike how they were in HTML, you can see
1431
02:01:13,610 --> 02:01:18,130
we do need quotation marks, but in CSS, we
don't actually need them. Alright, so there
1432
02:01:18,130 --> 02:01:23,400
we go. We have rewritten our class here. But
we've read we've but we've written it in a
1433
02:01:23,400 --> 02:01:31,290
way that allows us to select it based on its
act on the attribute of it itself. So let's
1434
02:01:31,290 --> 02:01:36,610
go ahead and refresh the page and see what
happens, you can see that this state exactly
1435
02:01:36,610 --> 02:01:40,030
the same. Now nothing has changed. If I go
ahead and change this back to dot subtitle,
1436
02:01:40,030 --> 02:01:44,210
just like that, refresh the page, you can
see nothing's changed. So that's pretty basic.
1437
02:01:44,210 --> 02:01:47,000
Now, it doesn't just have to be class, we
can select it based on many different things.
1438
02:01:47,000 --> 02:01:52,710
So for example, if I wanted to select this
image over here, I'm going to go over to the
1439
02:01:52,710 --> 02:01:58,449
bottom, I could say image, image, and then
every and then the source has to be equal
1440
02:01:58,449 --> 02:01:59,850
to something. All right. So there we go. Now
we've done that. But there's actually more
1441
02:01:59,850 --> 02:02:03,420
than one type of selector. Now, usually, this
is the basic one where you just equate one
1442
02:02:03,420 --> 02:02:08,370
side to the other. But there's actually many
more types of selectors, which allow you to
1443
02:02:08,370 --> 02:02:12,619
kind of modify the attribute selectors and
make them much more powerful than they are
1444
02:02:12,619 --> 02:02:17,849
right now. So how do we do this? Well, I'm
going to be covering just a few of them with
1445
02:02:17,849 --> 02:02:22,409
you today, and showing you how you can use
them. So we have two images on this page.
1446
02:02:22,409 --> 02:02:26,230
Now both of them are located in this image
folder. Is there do you think that there's
1447
02:02:26,230 --> 02:02:29,440
any way that we can select both of them in
one go using an attribute selector? Well,
1448
02:02:29,440 --> 02:02:34,350
there actually is. So here's what we have
to do. First of all, let's find the common
1449
02:02:34,350 --> 02:02:37,110
factor between these two images. They both
are contained inside this folder. So they
1450
02:02:37,110 --> 02:02:40,520
both start definitely start with this path,
dot dot slash IMG slash, both of them are
1451
02:02:40,520 --> 02:02:42,199
going to contain this. And if we actually
go back and look, you can see that both images
1452
02:02:42,199 --> 02:02:46,489
actually do contain this link here, wherever
the other images, there it is. So there we
1453
02:02:46,489 --> 02:02:54,050
go. Now we've done that. But remember that
this is direct equating this has to be equal
1454
02:02:54,050 --> 02:02:57,820
to this. And unfortunately, neither of them
are equal to that. So how do you think we
1455
02:02:57,820 --> 02:03:02,360
fix this? Well, all we have to do is put a
carrot behind the attribute, just like this.
1456
02:03:02,360 --> 02:03:07,599
So what this says is every single image where
the source contains or starts with, sorry,
1457
02:03:07,599 --> 02:03:13,079
yeah, starts with this piece of information,
what comes after, it doesn't matter. But what
1458
02:03:13,079 --> 02:03:18,290
we're doing is selecting all of the images
where the source attribute starts with this
1459
02:03:18,290 --> 02:03:21,730
value right here. So this is you can already
see how powerful this is. Now, if we go ahead
1460
02:03:21,730 --> 02:03:24,940
and refresh the page, obviously, we can't
see anything because we didn't add any styles.
1461
02:03:24,940 --> 02:03:31,210
But I'm going to go ahead and add a quick
style for you. Or you don't need to know how
1462
02:03:31,210 --> 02:03:32,210
to do this,
1463
02:03:32,210 --> 02:03:37,719
I'm actually going to make it a little bit
more obvious. So you don't need to know how
1464
02:03:37,719 --> 02:03:43,910
to do this. We're going to cover it later.
But you can see now both images are covered
1465
02:03:43,910 --> 02:03:46,780
in black. Okay. So there we go. That's just
one way, one of the selectors we can do, we
1466
02:03:46,780 --> 02:03:53,191
can also change this to $1 sign, and in this
case, it's going to be make sure that the
1467
02:03:53,191 --> 02:04:01,679
source attribute ends with this value. Okay.
So there we go, we can do that. Obviously,
1468
02:04:01,679 --> 02:04:05,480
the style isn't going to work anymore, because
this doesn't apply. But there's also another
1469
02:04:05,480 --> 02:04:10,289
one that we can do, which is using a star
the multiplication symbol. And pretty much
1470
02:04:10,289 --> 02:04:17,050
what this is, is if it contains it anywhere,
anywhere in the the value for beginning and
1471
02:04:17,050 --> 02:04:25,210
middle doesn't matter. As long as it contains
this. It's going to be there. So I'm going
1472
02:04:25,210 --> 02:04:30,110
to go ahead and refresh and you can see now
that works because both of them do contain
1473
02:04:30,110 --> 02:04:37,190
this. So those are the three basic ones, but
there's also some more complicated selectors
1474
02:04:37,190 --> 02:04:43,349
now I'm going to go ahead and cover them.
But you don't exactly need to know these,
1475
02:04:43,349 --> 02:04:48,699
because they're a little bit complicated.
So I'm just going to go ahead and do them.
1476
02:04:48,699 --> 02:04:56,210
The first one is called a whitespace attribute
selector. So pretty much, if you don't know
1477
02:04:56,210 --> 02:05:02,500
this already, you can actually add multiple
classes to something in HTML. So I'm actually
1478
02:05:02,500 --> 02:05:05,989
going to go ahead and add another class to
the subtitles. And I'm just going to call
1479
02:05:05,989 --> 02:05:08,969
it just something random particle subtitle.
Obviously, it's a little bit confusing, but
1480
02:05:08,969 --> 02:05:14,030
just bear with me. So you can actually add
multiple classes or multiple arguments separated
1481
02:05:14,030 --> 02:05:18,969
by white spaces or spaces, inside these inside
these attributes. Now, obviously, this is
1482
02:05:18,969 --> 02:05:25,739
specific to some very small, a very small
number of attributes, where you can do this
1483
02:05:25,739 --> 02:05:34,989
now just keep that in mind. For now, what
we're going to do is go forward and start
1484
02:05:34,989 --> 02:05:43,880
using this. So I'm going to go ahead and select
anything that contains this, this class specifically.
1485
02:05:43,880 --> 02:05:52,949
Now I couldn't do you know, maybe the attribute
selector where it ends in this or contains
1486
02:05:52,949 --> 02:05:57,349
it, but there is another selector that we
can use. So I'm going to go ahead and say
1487
02:05:57,349 --> 02:06:00,670
h2. And of course, the attribute is class.
And it's this symbol, whoops, it's this symbol,
1488
02:06:00,670 --> 02:06:05,530
okay, and then equals, and then our value
in this in this case, it's going to be our
1489
02:06:05,530 --> 02:06:10,510
class, which is article subtitle. All right.
So now we can go ahead and add whatever you
1490
02:06:10,510 --> 02:06:16,010
want. So I'm actually going to go ahead and
give it a background. Now, again, you do not
1491
02:06:16,010 --> 02:06:21,790
need to know what this is yet. I'm just trying
to vary up the properties a little bit here.
1492
02:06:21,790 --> 02:06:25,250
So let's go ahead and refresh the page and
see what happens, you can see that a green
1493
02:06:25,250 --> 02:06:32,690
background has been added to this, I'm not
going to try hovering over that it's a little
1494
02:06:32,690 --> 02:06:38,820
bit different compensate, but you can see
that a green background has been added to
1495
02:06:38,820 --> 02:06:43,820
it. Now, this could be used for a using a
contain attribute selector. But this is a
1496
02:06:43,820 --> 02:06:48,909
little bit more specific. And it only works
for things that are separated by whitespace.
1497
02:06:48,909 --> 02:06:54,719
So if you want to isolate certain elements
that contain a certain class x, for example,
1498
02:06:54,719 --> 02:06:59,719
you can do it with these class attributes.
And that would work perfectly. So the next
1499
02:06:59,719 --> 02:07:05,489
selector I'm going to talk about is a little
bit more complicated. And it's very similar
1500
02:07:05,489 --> 02:07:11,159
to the first step, the first one that we talked
about, which was the general attribute selector,
1501
02:07:11,159 --> 02:07:15,050
the one where, where it's exactly quality.
But there's a little bit of a difference here.
1502
02:07:15,050 --> 02:07:20,179
There's actually one exception to this. Now,
I'm going to go ahead and demonstrate it here.
1503
02:07:20,179 --> 02:07:24,620
Okay. So pretty much what this is saying is
fine, every h2, where the class is equal either
1504
02:07:24,620 --> 02:07:27,909
equal to directly article dash subtitle, or
article dash subtitle with a dash. So, again,
1505
02:07:27,909 --> 02:07:33,280
it does have to start with this. So it can't
just be containing followed by a dash, it
1506
02:07:33,280 --> 02:07:38,449
does have to start with this. So why would
you want to use something like this? Why can't
1507
02:07:38,449 --> 02:07:43,559
you just use the exact equality? Well, this
is a pretty basic site right here. Now, we're
1508
02:07:43,559 --> 02:07:47,360
not really doing anything complicated, or
any multiple stylesheets or anything like
1509
02:07:47,360 --> 02:07:52,800
that. But sometimes when you have want to
have multiple elements, or you want to build
1510
02:07:52,800 --> 02:07:56,760
libraries, you can create multiple elements
that are followed by an ID. So for example,
1511
02:07:56,760 --> 02:08:01,260
just list them here. I'm gonna actually put
this in a comment. So I could have subtitle,
1512
02:08:01,260 --> 02:08:03,590
dash, and then some Id like that subtitle,
dash, and then again, some ID. So you can
1513
02:08:03,590 --> 02:08:07,480
see why we would use something like this,
pretty much. What you want to do is select
1514
02:08:07,480 --> 02:08:08,480
everything that
1515
02:08:08,480 --> 02:08:13,599
I'm actually going to make it a little bit
more obvious. So you don't need to know how
1516
02:08:13,599 --> 02:08:18,570
to do this. We're going to cover it later.
But you can see now both images are covered
1517
02:08:18,570 --> 02:08:23,849
in black. Okay. So there we go. That's just
one way, one of the selectors we can do, we
1518
02:08:23,849 --> 02:08:29,530
can also change this to $1 sign, and in this
case, it's going to be make sure that the
1519
02:08:29,530 --> 02:08:34,920
source attribute ends with this value. Okay.
So there we go, we can do that. Obviously,
1520
02:08:34,920 --> 02:08:39,449
the style isn't going to work anymore, because
this doesn't apply. But there's also another
1521
02:08:39,449 --> 02:08:44,400
one that we can do, which is using a star
the multiplication symbol. And pretty much
1522
02:08:44,400 --> 02:08:50,500
what this is, is if it contains it anywhere,
anywhere in the the value for beginning and
1523
02:08:50,500 --> 02:08:55,670
middle doesn't matter. As long as it contains
this. It's going to be there. So I'm going
1524
02:08:55,670 --> 02:09:03,159
to go ahead and refresh and you can see now
that works because both of them do contain
1525
02:09:03,159 --> 02:09:07,980
this. So those are the three basic ones, but
there's also some more complicated selectors
1526
02:09:07,980 --> 02:09:13,449
now I'm going to go ahead and cover them.
But you don't exactly need to know these,
1527
02:09:13,449 --> 02:09:15,389
because they're a little bit complicated.
So I'm just going to go ahead and do them.
1528
02:09:15,389 --> 02:09:19,360
The first one is called a whitespace attribute
selector. So pretty much, if you don't know
1529
02:09:19,360 --> 02:09:24,010
this already, you can actually add multiple
classes to something in HTML. So I'm actually
1530
02:09:24,010 --> 02:09:28,599
going to go ahead and add another class to
the subtitles. And I'm just going to call
1531
02:09:28,599 --> 02:09:31,719
it just something random particle subtitle.
Obviously, it's a little bit confusing, but
1532
02:09:31,719 --> 02:09:33,250
just bear with me. So you can actually add
multiple classes or multiple arguments separated
1533
02:09:33,250 --> 02:09:34,250
by white spaces or spaces, inside these inside
these attributes. Now, obviously, this is
1534
02:09:34,250 --> 02:09:38,489
specific to some very small, a very small
number of attributes, where you can do this
1535
02:09:38,489 --> 02:09:44,380
now just keep that in mind. For now, what
we're going to do is go forward and start
1536
02:09:44,380 --> 02:09:50,159
using this. So I'm going to go ahead and select
anything that contains this, this class specifically.
1537
02:09:50,159 --> 02:09:54,230
Now I couldn't do you know, maybe the attribute
selector where it ends in this or contains
1538
02:09:54,230 --> 02:09:58,210
it, but there is another selector that we
can use. So I'm going to go ahead and say
1539
02:09:58,210 --> 02:10:01,849
h2. And of course, the attribute is class.
And it's this symbol, whoops, it's this symbol,
1540
02:10:01,849 --> 02:10:05,060
okay, and then equals, and then our value
in this in this case, it's going to be our
1541
02:10:05,060 --> 02:10:07,650
class, which is article subtitle. All right.
So now we can go ahead and add whatever you
1542
02:10:07,650 --> 02:10:11,139
want. So I'm actually going to go ahead and
give it a background. Now, again, you do not
1543
02:10:11,139 --> 02:10:15,929
need to know what this is yet. I'm just trying
to vary up the properties a little bit here.
1544
02:10:15,929 --> 02:10:19,730
So let's go ahead and refresh the page and
see what happens, you can see that a green
1545
02:10:19,730 --> 02:10:20,750
background has been added to this, I'm not
going to try hovering over that it's a little
1546
02:10:20,750 --> 02:10:25,409
bit different compensate, but you can see
that a green background has been added to
1547
02:10:25,409 --> 02:10:28,719
it. Now, this could be used for a using a
contain attribute selector. But this is a
1548
02:10:28,719 --> 02:10:30,909
little bit more specific. And it only works
for things that are separated by whitespace.
1549
02:10:30,909 --> 02:10:35,489
So if you want to isolate certain elements
that contain a certain class x, for example,
1550
02:10:35,489 --> 02:10:40,230
you can do it with these class attributes.
And that would work perfectly. So the next
1551
02:10:40,230 --> 02:10:46,159
selector I'm going to talk about is a little
bit more complicated. And it's very similar
1552
02:10:46,159 --> 02:10:52,510
to the first step, the first one that we talked
about, which was the general attribute selector,
1553
02:10:52,510 --> 02:11:02,039
the one where, where it's exactly quality.
But there's a little bit of a difference here.
1554
02:11:02,039 --> 02:11:06,570
There's actually one exception to this. Now,
I'm going to go ahead and demonstrate it here.
1555
02:11:06,570 --> 02:11:12,440
Okay. So pretty much what this is saying is
fine, every h2, where the class is equal either
1556
02:11:12,440 --> 02:11:18,290
equal to directly article dash subtitle, or
article dash subtitle with a dash. So, again,
1557
02:11:18,290 --> 02:11:25,510
it does have to start with this. So it can't
just be containing followed by a dash, it
1558
02:11:25,510 --> 02:11:33,349
does have to start with this. So why would
you want to use something like this? Why can't
1559
02:11:33,349 --> 02:11:41,579
you just use the exact equality? Well, this
is a pretty basic site right here. Now, we're
1560
02:11:41,579 --> 02:11:45,409
not really doing anything complicated, or
any multiple stylesheets or anything like
1561
02:11:45,409 --> 02:11:50,159
that. But sometimes when you have want to
have multiple elements, or you want to build
1562
02:11:50,159 --> 02:11:55,630
libraries, you can create multiple elements
that are followed by an ID. So for example,
1563
02:11:55,630 --> 02:12:02,750
just list them here. I'm gonna actually put
this in a comment. So I could have subtitle,
1564
02:12:02,750 --> 02:12:10,010
dash, and then some Id like that subtitle,
dash, and then again, some ID. So you can
1565
02:12:10,010 --> 02:12:15,639
see why we would use something like this,
pretty much. What you want to do is select
1566
02:12:15,639 --> 02:12:16,639
everything that
1567
02:12:16,639 --> 02:12:20,489
has subtitle and then the dash in it. And
you're probably also wondering, okay, why
1568
02:12:20,489 --> 02:12:26,960
can't you just use one or the other selectors
like something that starts with it? Well,
1569
02:12:26,960 --> 02:12:34,310
sometimes this is contained in a chain, or
sometimes there's multiple dashes. And on
1570
02:12:34,310 --> 02:12:40,030
top of that, some sometimes it may change,
you know, maybe this could be in the middle
1571
02:12:40,030 --> 02:12:45,340
of 15 other classes. So you can see why you'd
want to use something like this. And although
1572
02:12:45,340 --> 02:12:49,039
it's not used very commonly, it's still very
important to know. Alright, so those are pretty
1573
02:12:49,039 --> 02:12:51,960
much all of the advanced Arctic attribute
selectors. Like I said, You aren't going to
1574
02:12:51,960 --> 02:12:56,050
use these very commonly. But again, it is
good to know they are very powerful selectors.
1575
02:12:56,050 --> 02:12:58,730
So yeah, that's pretty much it. Go ahead.
Like I said, with every single video practice,
1576
02:12:58,730 --> 02:13:02,690
and just try using the selectors on your own.
All of the project files are available on
1577
02:13:02,690 --> 02:13:07,450
GitHub, the they the link to the repository
was posted at the beginning of the course.
1578
02:13:07,450 --> 02:13:10,660
So you can go ahead and check that out if
you want to download the files and work with
1579
02:13:10,660 --> 02:13:14,809
them. But other than that, there we go. That's
pretty much it for selectors now we can actually
1580
02:13:14,809 --> 02:13:16,780
move on and start using CSS. Alright, let's
move on.
1581
02:13:16,780 --> 02:13:20,800
has subtitle and then the dash in it. And
you're probably also wondering, okay, why
1582
02:13:20,800 --> 02:13:25,500
can't you just use one or the other selectors
like something that starts with it? Well,
1583
02:13:25,500 --> 02:13:29,780
sometimes this is contained in a chain, or
sometimes there's multiple dashes. And on
1584
02:13:29,780 --> 02:13:33,800
top of that, some sometimes it may change,
you know, maybe this could be in the middle
1585
02:13:33,800 --> 02:13:38,349
of 15 other classes. So you can see why you'd
want to use something like this. And although
1586
02:13:38,349 --> 02:13:42,969
it's not used very commonly, it's still very
important to know. Alright, so those are pretty
1587
02:13:42,969 --> 02:13:48,650
much all of the advanced Arctic attribute
selectors. Like I said, You aren't going to
1588
02:13:48,650 --> 02:13:54,130
use these very commonly. But again, it is
good to know they are very powerful selectors.
1589
02:13:54,130 --> 02:13:59,610
So yeah, that's pretty much it. Go ahead.
Like I said, with every single video practice,
1590
02:13:59,610 --> 02:14:05,400
and just try using the selectors on your own.
All of the project files are available on
1591
02:14:05,400 --> 02:14:15,719
GitHub, the they the link to the repository
was posted at the beginning of the course.
1592
02:14:15,719 --> 02:14:19,960
So you can go ahead and check that out if
you want to download the files and work with
1593
02:14:19,960 --> 02:14:25,210
them. But other than that, there we go. That's
pretty much it for selectors now we can actually
1594
02:14:25,210 --> 02:14:28,130
move on and start using CSS. Alright, let's
move on.
1595
02:14:28,130 --> 02:14:33,320
I'm not really going to talk a lot in this
video because there's not really much to talk
1596
02:14:33,320 --> 02:14:38,770
about, but this video and the next are very
important because right now you're probably
1597
02:14:38,770 --> 02:14:45,159
just piecing things together about the whole
way that we use CSS. And we've had to use
1598
02:14:45,159 --> 02:14:47,989
a couple properties here and there, but you
Probably don't actually know what these brackets
1599
02:14:47,989 --> 02:14:50,849
do, or how selectors work or how any of this
is actually put together. So that's what I'm
1600
02:14:50,849 --> 02:14:56,719
going to be doing in the next few videos is
explaining how all of this comes together.
1601
02:14:56,719 --> 02:15:01,840
And once we learn that, we can actually move
on to the fun part, which is using CSS and
1602
02:15:01,840 --> 02:15:06,000
styling this website. So first thing I want
to explain is properties. Now, we've talked
1603
02:15:06,000 --> 02:15:10,969
a little bit about properties here and there,
because we've needed them to demonstrate points
1604
02:15:10,969 --> 02:15:14,849
on how selectors work. Now, obviously, it
might have been better if we use properties
1605
02:15:14,849 --> 02:15:19,119
first. But in my opinion, it's better that
you learn selectors before you learn properties.
1606
02:15:19,119 --> 02:15:23,940
Because if you learn selectors First, you'll
be able to understand the premise or the theory
1607
02:15:23,940 --> 02:15:28,659
behind CSS, and how things work. Whereas if
you just learn properties first, then most
1608
02:15:28,659 --> 02:15:35,080
of your focus will be on how the properties
work and not the selectors. And I feel that
1609
02:15:35,080 --> 02:15:38,340
it's much more important that you learn the
selectors before the properties so that you
1610
02:15:38,340 --> 02:15:45,790
can actually understand CSS and how it works
as a whole. So that aside, let's move on to
1611
02:15:45,790 --> 02:15:49,849
properties. Now, like I said, we've used these
a little bit in the past, we haven't actually
1612
02:15:49,849 --> 02:15:53,639
talked about them in detail. So this is a
property. Now, they're contained within selectors.
1613
02:15:53,639 --> 02:16:04,210
And they pretty much define the way that CSS
is used on what goes into the CSS. Now a selector
1614
02:16:04,210 --> 02:16:11,429
is going to target the element. But the actual
properties are what give it its change. And
1615
02:16:11,429 --> 02:16:16,210
what make it what it is, without the or without
properties than the selectors would be completely
1616
02:16:16,210 --> 02:16:20,530
useless. So let's go ahead and talk about
the parts of properties. Now first of all,
1617
02:16:20,530 --> 02:16:25,250
a colon is always needed, you cannot use a
property without a colon and a semi colon,
1618
02:16:25,250 --> 02:16:29,710
the colon comes after the property. Now the
property is pretty much defining what is going
1619
02:16:29,710 --> 02:16:34,380
to change the color, the background, the positioning,
the height, the width, there are so many properties
1620
02:16:34,380 --> 02:16:37,290
out there. And they are all used in different
ways. And then next is the value. Now, most
1621
02:16:37,290 --> 02:16:41,630
of the time, you can actually use multiple
types of values. But for something like color,
1622
02:16:41,630 --> 02:16:45,939
there are very specific rules that you need
to use for them. And we're actually going
1623
02:16:45,939 --> 02:16:50,439
to be learning those rules and how to use
colors in the next section. But for now, the
1624
02:16:50,439 --> 02:16:57,809
just think of the value as a key or Well,
not a key, the value is sort of the guideline
1625
02:16:57,809 --> 02:17:02,719
towards the property, the value is like the
value to the attribute that actually defines
1626
02:17:02,719 --> 02:17:08,229
what's changing. and the value actually gives
it that change. So just keep that in mind.
1627
02:17:08,229 --> 02:17:12,189
So that's pretty much it for properties, it's
very simple. And we're going to get lots of
1628
02:17:12,189 --> 02:17:14,849
exposure to them as we move through the course.
But for now, all you need to keep in mind
1629
02:17:14,849 --> 02:17:18,700
is that properties have two components, the
actual property itself, which is kind of the
1630
02:17:18,700 --> 02:17:21,510
guideline on what's changing, followed by
a colon, and then the value itself, which
1631
02:17:21,510 --> 02:17:28,219
is going to be the change or the type of change
that happens in our our element. So what happens
1632
02:17:28,219 --> 02:17:35,340
through our selector, and at the end of it
all, you always put a semi colon, if we remove
1633
02:17:35,340 --> 02:17:42,090
the semi colon, it's not going to work. So
yeah, that's pretty much it for properties.
1634
02:17:42,090 --> 02:17:49,729
Let's move on. So this is going to be the
final video on or in this section, we're not
1635
02:17:49,729 --> 02:17:56,229
really going to be doing anything or styling
the website. But for now, I just want to talk
1636
02:17:56,229 --> 02:18:01,219
a little bit about a very important part of
CSS. Now, this is pretty much going to define
1637
02:18:01,219 --> 02:18:05,700
the way that you look at CSS. And we've written
a lot of CSS code here. Well, we're not really
1638
02:18:05,700 --> 02:18:09,630
looking at properties yet. But we've covered
a lot of different selectors and how they
1639
02:18:09,630 --> 02:18:18,370
work. But now we need to put the two together,
we know what properties are. And we definitely
1640
02:18:18,370 --> 02:18:25,309
know what selectors are. So we need to know
how these two work together. Now, I've talked
1641
02:18:25,309 --> 02:18:33,219
a little bit about this in the past, but we
haven't actually gone through it in detail.
1642
02:18:33,219 --> 02:18:37,429
So that's what I'm going to be doing in this
video. So first of all, if you look at all
1643
02:18:37,429 --> 02:18:44,460
of the CSS code, we can see a pattern involved
here. First of all, in every single one of
1644
02:18:44,460 --> 02:18:52,029
these there are these curly braces. And on
top of that in every single one, there is
1645
02:18:52,029 --> 02:18:57,830
some italicized text, which is due to the
development tool that we're using, but there's
1646
02:18:57,830 --> 02:19:04,140
some italicized text, and then some other
text here, and there's always a colon and
1647
02:19:04,140 --> 02:19:13,790
a semi colon. And on top of that before every
first curly brace, there's always going to
1648
02:19:13,790 --> 02:19:21,019
be some form of text here, which is our selectors.
But how do these actually work together? So
1649
02:19:21,019 --> 02:19:26,290
this is very important for something called
the CSS a general rule. And it's pretty much
1650
02:19:26,290 --> 02:19:31,519
going to teach you how all CSS is supposed
to look. So first of all, there's always three
1651
02:19:31,519 --> 02:19:32,550
parts to your
1652
02:19:32,550 --> 02:19:37,380
I'm not really going to talk a lot in this
video because there's not really much to talk
1653
02:19:37,380 --> 02:19:40,290
about, but this video and the next are very
important because right now you're probably
1654
02:19:40,290 --> 02:19:43,640
just piecing things together about the whole
way that we use CSS. And we've had to use
1655
02:19:43,640 --> 02:19:48,210
a couple properties here and there, but you
Probably don't actually know what these brackets
1656
02:19:48,210 --> 02:19:53,811
do, or how selectors work or how any of this
is actually put together. So that's what I'm
1657
02:19:53,811 --> 02:19:58,740
going to be doing in the next few videos is
explaining how all of this comes together.
1658
02:19:58,740 --> 02:20:02,450
And once we learn that, we can actually move
on to the fun part, which is using CSS and
1659
02:20:02,450 --> 02:20:06,800
styling this website. So first thing I want
to explain is properties. Now, we've talked
1660
02:20:06,800 --> 02:20:10,150
a little bit about properties here and there,
because we've needed them to demonstrate points
1661
02:20:10,150 --> 02:20:12,930
on how selectors work. Now, obviously, it
might have been better if we use properties
1662
02:20:12,930 --> 02:20:15,260
first. But in my opinion, it's better that
you learn selectors before you learn properties.
1663
02:20:15,260 --> 02:20:19,040
Because if you learn selectors First, you'll
be able to understand the premise or the theory
1664
02:20:19,040 --> 02:20:22,460
behind CSS, and how things work. Whereas if
you just learn properties first, then most
1665
02:20:22,460 --> 02:20:28,050
of your focus will be on how the properties
work and not the selectors. And I feel that
1666
02:20:28,050 --> 02:20:32,600
it's much more important that you learn the
selectors before the properties so that you
1667
02:20:32,600 --> 02:20:38,229
can actually understand CSS and how it works
as a whole. So that aside, let's move on to
1668
02:20:38,229 --> 02:20:42,779
properties. Now, like I said, we've used these
a little bit in the past, we haven't actually
1669
02:20:42,779 --> 02:20:50,240
talked about them in detail. So this is a
property. Now, they're contained within selectors.
1670
02:20:50,240 --> 02:20:58,330
And they pretty much define the way that CSS
is used on what goes into the CSS. Now a selector
1671
02:20:58,330 --> 02:21:03,720
is going to target the element. But the actual
properties are what give it its change. And
1672
02:21:03,720 --> 02:21:10,070
what make it what it is, without the or without
properties than the selectors would be completely
1673
02:21:10,070 --> 02:21:15,521
useless. So let's go ahead and talk about
the parts of properties. Now first of all,
1674
02:21:15,521 --> 02:21:21,330
a colon is always needed, you cannot use a
property without a colon and a semi colon,
1675
02:21:21,330 --> 02:21:27,590
the colon comes after the property. Now the
property is pretty much defining what is going
1676
02:21:27,590 --> 02:21:32,521
to change the color, the background, the positioning,
the height, the width, there are so many properties
1677
02:21:32,521 --> 02:21:38,939
out there. And they are all used in different
ways. And then next is the value. Now, most
1678
02:21:38,939 --> 02:21:45,210
of the time, you can actually use multiple
types of values. But for something like color,
1679
02:21:45,210 --> 02:21:50,021
there are very specific rules that you need
to use for them. And we're actually going
1680
02:21:50,021 --> 02:21:54,540
to be learning those rules and how to use
colors in the next section. But for now, the
1681
02:21:54,540 --> 02:21:59,939
just think of the value as a key or Well,
not a key, the value is sort of the guideline
1682
02:21:59,939 --> 02:22:04,620
towards the property, the value is like the
value to the attribute that actually defines
1683
02:22:04,620 --> 02:22:08,430
what's changing. and the value actually gives
it that change. So just keep that in mind.
1684
02:22:08,430 --> 02:22:13,311
So that's pretty much it for properties, it's
very simple. And we're going to get lots of
1685
02:22:13,311 --> 02:22:17,200
exposure to them as we move through the course.
But for now, all you need to keep in mind
1686
02:22:17,200 --> 02:22:20,770
is that properties have two components, the
actual property itself, which is kind of the
1687
02:22:20,770 --> 02:22:24,840
guideline on what's changing, followed by
a colon, and then the value itself, which
1688
02:22:24,840 --> 02:22:30,649
is going to be the change or the type of change
that happens in our our element. So what happens
1689
02:22:30,649 --> 02:22:36,630
through our selector, and at the end of it
all, you always put a semi colon, if we remove
1690
02:22:36,630 --> 02:22:41,410
the semi colon, it's not going to work. So
yeah, that's pretty much it for properties.
1691
02:22:41,410 --> 02:22:47,220
Let's move on. So this is going to be the
final video on or in this section, we're not
1692
02:22:47,220 --> 02:22:53,120
really going to be doing anything or styling
the website. But for now, I just want to talk
1693
02:22:53,120 --> 02:22:58,770
a little bit about a very important part of
CSS. Now, this is pretty much going to define
1694
02:22:58,770 --> 02:23:05,740
the way that you look at CSS. And we've written
a lot of CSS code here. Well, we're not really
1695
02:23:05,740 --> 02:23:13,530
looking at properties yet. But we've covered
a lot of different selectors and how they
1696
02:23:13,530 --> 02:23:18,760
work. But now we need to put the two together,
we know what properties are. And we definitely
1697
02:23:18,760 --> 02:23:24,649
know what selectors are. So we need to know
how these two work together. Now, I've talked
1698
02:23:24,649 --> 02:23:30,029
a little bit about this in the past, but we
haven't actually gone through it in detail.
1699
02:23:30,029 --> 02:23:35,410
So that's what I'm going to be doing in this
video. So first of all, if you look at all
1700
02:23:35,410 --> 02:23:42,390
of the CSS code, we can see a pattern involved
here. First of all, in every single one of
1701
02:23:42,390 --> 02:23:50,050
these there are these curly braces. And on
top of that in every single one, there is
1702
02:23:50,050 --> 02:23:54,319
some italicized text, which is due to the
development tool that we're using, but there's
1703
02:23:54,319 --> 02:23:58,240
some italicized text, and then some other
text here, and there's always a colon and
1704
02:23:58,240 --> 02:24:07,160
a semi colon. And on top of that before every
first curly brace, there's always going to
1705
02:24:07,160 --> 02:24:14,880
be some form of text here, which is our selectors.
But how do these actually work together? So
1706
02:24:14,880 --> 02:24:19,021
this is very important for something called
the CSS a general rule. And it's pretty much
1707
02:24:19,021 --> 02:24:24,170
going to teach you how all CSS is supposed
to look. So first of all, there's always three
1708
02:24:24,170 --> 02:24:25,170
parts to your
1709
02:24:25,170 --> 02:24:29,710
to your selector here, there is the selector
itself. There's the curly braces, which actually
1710
02:24:29,710 --> 02:24:33,140
represents something called a CSS block. And
then there's the properties. So first of all,
1711
02:24:33,140 --> 02:24:36,450
let's talk about the selector. Now, we all
know that selector defines what elements you're
1712
02:24:36,450 --> 02:24:41,060
trying to collect or target on your HTML page.
A selector can look any different way it can
1713
02:24:41,060 --> 02:24:45,109
look like this with some weird symbols. It
could have colons and pseudo selectors or
1714
02:24:45,109 --> 02:24:52,729
it can just It looks something very plain
like this. But we all know that they do something
1715
02:24:52,729 --> 02:24:58,640
different. And over the last few videos, we've
been covering what selectors actually do.
1716
02:24:58,640 --> 02:25:03,370
So now what we're going to do is go through,
and I'm going to teach you how this selector
1717
02:25:03,370 --> 02:25:07,410
plays in with everything else. So we have
our selector over here, this could be anything,
1718
02:25:07,410 --> 02:25:11,300
an element selectors, pseudo selector attribute
selector like one of these. But for now, we
1719
02:25:11,300 --> 02:25:15,800
have our selector. So this is going to target
some element on a page. Now, the part we haven't
1720
02:25:15,800 --> 02:25:20,160
talked about is something called the CSS block.
So pretty much once you select something,
1721
02:25:20,160 --> 02:25:26,479
you need to define all of your styles. And
as we know, all of your styles have to go
1722
02:25:26,479 --> 02:25:33,580
in between these two curly braces. So that's
what we call a CSS block. The curly braces
1723
02:25:33,580 --> 02:25:38,630
define the beginning and end of this block.
And it can be empty, it doesn't need to have
1724
02:25:38,630 --> 02:25:43,029
anything inside it. But what's going on here
is this block is going to contain all of the
1725
02:25:43,029 --> 02:25:47,060
styles that are then going to be targeted
towards our selector. And then of course,
1726
02:25:47,060 --> 02:25:51,880
we have the properties. So all of these have
only had one property where you can actually
1727
02:25:51,880 --> 02:25:55,540
do more than one property. So a property looks
like this property, a colon, and then a value,
1728
02:25:55,540 --> 02:26:03,320
and a semicolon. So the property is going
to be the name of the actual style, this can
1729
02:26:03,320 --> 02:26:08,609
be color background, and we're going to learn
a bunch of these throughout this course. But
1730
02:26:08,609 --> 02:26:13,790
this could be anything. On the other hand,
the value has to be sort of targeted or matching
1731
02:26:13,790 --> 02:26:18,029
the style of the property. So for example,
if this was a color, we can use pixels, because
1732
02:26:18,029 --> 02:26:21,101
pixels are for size. So there are many different
ways that you can use these different values.
1733
02:26:21,101 --> 02:26:23,681
And they all depend on your property. So what
I didn't show you is you can actually have
1734
02:26:23,681 --> 02:26:28,050
more than one property. Now these can be in
any style, as long as they have the semi colon
1735
02:26:28,050 --> 02:26:32,790
and the colon. And they come inside the block.
So this can be property to add value to. And
1736
02:26:32,790 --> 02:26:36,290
you can put pretty much as many styles as
you want in here. So for example, if you wanted
1737
02:26:36,290 --> 02:26:41,100
to style a subtitle, and you wanted to change
the font size, the color, and the background
1738
02:26:41,100 --> 02:26:44,410
all at the same time, you don't need to create
three separate CSS blocks, you can do it all
1739
02:26:44,410 --> 02:26:48,830
in one. And that's the real power of CSS is
that you don't have you can keep your code
1740
02:26:48,830 --> 02:26:50,710
concise and clean, without having to create
all of these different blocks. So this is
1741
02:26:50,710 --> 02:26:57,109
pretty much the general rule, you have to
follow this pretty much for all of the CSS
1742
02:26:57,109 --> 02:27:00,100
you write using a selector and then different
properties contained inside of a block. So
1743
02:27:00,100 --> 02:27:02,180
like I said, we're going to get much more
experience with actually using CSS, as we
1744
02:27:02,180 --> 02:27:03,840
delve more into CSS and learning all of the
different features it has to offer. Alright,
1745
02:27:03,840 --> 02:27:04,840
let's move on.
1746
02:27:04,840 --> 02:27:08,420
to your selector here, there is the selector
itself. There's the curly braces, which actually
1747
02:27:08,420 --> 02:27:12,370
represents something called a CSS block. And
then there's the properties. So first of all,
1748
02:27:12,370 --> 02:27:16,439
let's talk about the selector. Now, we all
know that selector defines what elements you're
1749
02:27:16,439 --> 02:27:21,080
trying to collect or target on your HTML page.
A selector can look any different way it can
1750
02:27:21,080 --> 02:27:25,149
look like this with some weird symbols. It
could have colons and pseudo selectors or
1751
02:27:25,149 --> 02:27:35,479
it can just It looks something very plain
like this. But we all know that they do something
1752
02:27:35,479 --> 02:27:38,479
different. And over the last few videos, we've
been covering what selectors actually do.
1753
02:27:38,479 --> 02:27:43,960
So now what we're going to do is go through,
and I'm going to teach you how this selector
1754
02:27:43,960 --> 02:27:47,500
plays in with everything else. So we have
our selector over here, this could be anything,
1755
02:27:47,500 --> 02:27:52,090
an element selectors, pseudo selector attribute
selector like one of these. But for now, we
1756
02:27:52,090 --> 02:27:56,990
have our selector. So this is going to target
some element on a page. Now, the part we haven't
1757
02:27:56,990 --> 02:28:03,410
talked about is something called the CSS block.
So pretty much once you select something,
1758
02:28:03,410 --> 02:28:10,720
you need to define all of your styles. And
as we know, all of your styles have to go
1759
02:28:10,720 --> 02:28:17,109
in between these two curly braces. So that's
what we call a CSS block. The curly braces
1760
02:28:17,109 --> 02:28:24,220
define the beginning and end of this block.
And it can be empty, it doesn't need to have
1761
02:28:24,220 --> 02:28:28,899
anything inside it. But what's going on here
is this block is going to contain all of the
1762
02:28:28,899 --> 02:28:33,899
styles that are then going to be targeted
towards our selector. And then of course,
1763
02:28:33,899 --> 02:28:39,240
we have the properties. So all of these have
only had one property where you can actually
1764
02:28:39,240 --> 02:28:45,270
do more than one property. So a property looks
like this property, a colon, and then a value,
1765
02:28:45,270 --> 02:28:51,480
and a semicolon. So the property is going
to be the name of the actual style, this can
1766
02:28:51,480 --> 02:28:57,140
be color background, and we're going to learn
a bunch of these throughout this course. But
1767
02:28:57,140 --> 02:29:03,200
this could be anything. On the other hand,
the value has to be sort of targeted or matching
1768
02:29:03,200 --> 02:29:08,149
the style of the property. So for example,
if this was a color, we can use pixels, because
1769
02:29:08,149 --> 02:29:11,440
pixels are for size. So there are many different
ways that you can use these different values.
1770
02:29:11,440 --> 02:29:17,670
And they all depend on your property. So what
I didn't show you is you can actually have
1771
02:29:17,670 --> 02:29:23,700
more than one property. Now these can be in
any style, as long as they have the semi colon
1772
02:29:23,700 --> 02:29:29,720
and the colon. And they come inside the block.
So this can be property to add value to. And
1773
02:29:29,720 --> 02:29:34,939
you can put pretty much as many styles as
you want in here. So for example, if you wanted
1774
02:29:34,939 --> 02:29:42,670
to style a subtitle, and you wanted to change
the font size, the color, and the background
1775
02:29:42,670 --> 02:29:46,920
all at the same time, you don't need to create
three separate CSS blocks, you can do it all
1776
02:29:46,920 --> 02:29:52,120
in one. And that's the real power of CSS is
that you don't have you can keep your code
1777
02:29:52,120 --> 02:29:54,210
concise and clean, without having to create
all of these different blocks. So this is
1778
02:29:54,210 --> 02:29:55,490
pretty much the general rule, you have to
follow this pretty much for all of the CSS
1779
02:29:55,490 --> 02:29:59,779
you write using a selector and then different
properties contained inside of a block. So
1780
02:29:59,779 --> 02:30:03,260
like I said, we're going to get much more
experience with actually using CSS, as we
1781
02:30:03,260 --> 02:30:06,100
delve more into CSS and learning all of the
different features it has to offer. Alright,
1782
02:30:06,100 --> 02:30:07,109
let's move on.
1783
02:30:07,109 --> 02:30:13,750
So this is the start of a new section. And
now that we've learned all we need to know
1784
02:30:13,750 --> 02:30:18,010
about selectors, we're going to actually start
styling up our website and making it look
1785
02:30:18,010 --> 02:30:23,340
good. So first of all, let's just talk about
coloring. In general, I mean, what is coloring?
1786
02:30:23,340 --> 02:30:29,800
And what are we supposed to do with it. So
as we know, we already have a bunch of colors
1787
02:30:29,800 --> 02:30:34,760
here. And they all look fine. But what we're
actually trying to do here is color our website
1788
02:30:34,760 --> 02:30:48,300
in a way that makes it look modern, and appealing
to users. So we're going to be learning a
1789
02:30:48,300 --> 02:30:54,439
bunch of different techniques that you can
use to color your website. Now we've already
1790
02:30:54,439 --> 02:30:59,460
used one in the past, and it's a very common
one. And that is, of course, the color property.
1791
02:30:59,460 --> 02:31:04,000
Now we're going to be talking more about this
in the next video and using it in depth. But
1792
02:31:04,000 --> 02:31:08,210
first thing I want to talk about is the different
types of colors, because there's actually
1793
02:31:08,210 --> 02:31:12,979
more than one. So first of all, we've all
used and while you've at least seen me use
1794
02:31:12,979 --> 02:31:19,350
the colors have given by name so for example,
red, green, blue, and purple. But there's
1795
02:31:19,350 --> 02:31:24,630
actually more than that there's so much more
to colors than just those names, because as
1796
02:31:24,630 --> 02:31:29,670
you know, they're actually quite limiting,
you can't really change the color and choose
1797
02:31:29,670 --> 02:31:36,680
as you want. So what I'm here to teach you
about is the three different types of colors
1798
02:31:36,680 --> 02:31:42,470
and how they work. So the first one is obviously
the CSS color codes or names. And what they
1799
02:31:42,470 --> 02:31:48,840
do is is pretty much given a name, and they
each have a designated color. So this is a
1800
02:31:48,840 --> 02:31:55,240
really easy way for testing colors. For example,
if you want to test if a property works, as
1801
02:31:55,240 --> 02:32:00,250
we saw at the beginning of this course. And
you can also use them for you know, maybe
1802
02:32:00,250 --> 02:32:06,210
quick fixes or trying to just try out different
colors. But once you get into the really specific
1803
02:32:06,210 --> 02:32:11,090
detailed web design, and once you start producing
your website properly, you're going to want
1804
02:32:11,090 --> 02:32:18,830
more than just the color CSS gives you. So
I've actually attached to the lecture resources,
1805
02:32:18,830 --> 02:32:25,970
this website here, you have a bunch of different
CSS color codes. And you can see that there's
1806
02:32:25,970 --> 02:32:31,300
actually a huge range of them, we only use
the basic ones that are quite vibrant and
1807
02:32:31,300 --> 02:32:37,490
they really hit the eyes very hard. But you
can see there's actually a lot more than what
1808
02:32:37,490 --> 02:32:42,060
we just use. The only problem is nobody wants
to memorize all of these different names.
1809
02:32:42,060 --> 02:32:47,510
So what we're actually going to be doing is
learning how to use these two, which are the
1810
02:32:47,510 --> 02:32:50,130
ones I'm going to be talking about in this
video. So first of all, let's talk a little
1811
02:32:50,130 --> 02:32:55,390
bit about hex code. Okay. So first of all,
I have a color picker over here just to demonstrate
1812
02:32:55,390 --> 02:33:01,770
how this whole thing works. We actually don't
need this for now. So I'm going to discipline
1813
02:33:01,770 --> 02:33:06,859
full screen. So this is a color picker that
I found on Google, you can go ahead and search
1814
02:33:06,859 --> 02:33:10,320
it anywhere. But I like using Google's provided
one, because it provides you with both the
1815
02:33:10,320 --> 02:33:13,609
hex code and the RGB code. Don't worry, we'll
talk about those in just a second. So first
1816
02:33:13,609 --> 02:33:19,420
of all, you can slide up and down this thing
and choose whichever color you want. And you
1817
02:33:19,420 --> 02:33:24,460
can see that these two codes change. So what
do they actually mean? Well, first, let's
1818
02:33:24,460 --> 02:33:30,290
talk about the hex code. So we all know that
when you're normally using numbers, you range
1819
02:33:30,290 --> 02:33:36,120
from zero to nine. So any given number in
this new in that numeral system can be made
1820
02:33:36,120 --> 02:33:37,410
up of 012, and all the way up to nine. So
in that case, there's 10 possible combinations.
1821
02:33:37,410 --> 02:33:40,640
But in hex code, there's actually 16 different
possible combinations, you can go from zero
1822
02:33:40,640 --> 02:33:45,490
to nine, and then A to F. So for example,
let's just take this right here, this could
1823
02:33:45,490 --> 02:33:49,540
actually be converted into a number if we
wanted to, suppose B, actually stands for
1824
02:33:49,540 --> 02:33:56,540
12, because it goes zero to nine, and then
a B, so 12. And you can actually convert this
1825
02:33:56,540 --> 02:34:02,620
into a number, which is very interesting.
So I'm not really going to be talking about
1826
02:34:02,620 --> 02:34:10,340
the applications of hex code in this in this
video, because that goes all the way down
1827
02:34:10,340 --> 02:34:16,319
into computer science. And we're not really
looking at that now. But one thing we can
1828
02:34:16,319 --> 02:34:20,020
do is actually create colors based on this.
So first of all, you'll notice that our code
1829
02:34:20,020 --> 02:34:23,360
here starts off with a hashtag. And then you
have six digits. So each one can have 16 possible
1830
02:34:23,360 --> 02:34:28,180
combinations. But as we know, color any color
is made up of either red, green, or blue,
1831
02:34:28,180 --> 02:34:33,561
at least on the computer for the standard
color palette. So it's made up of red, green,
1832
02:34:33,561 --> 02:34:36,330
and blue. Now basically, this hex code is
split up into three two digit pairs. So the
1833
02:34:36,330 --> 02:34:40,460
first pair of numbers is meant to represent
the amount of red in the color, the second,
1834
02:34:40,460 --> 02:34:43,140
the amount of green, and the third, the amount
of blue, RGB. And these parents can range
1835
02:34:43,140 --> 02:34:46,060
from 00, which means none of that color to
F F, which is the highest value. Remember,
1836
02:34:46,060 --> 02:34:51,430
hexadecimal goes from zero to f. So I'm just
going to choose something very basic here,
1837
02:34:51,430 --> 02:34:56,510
like a standard blue. You can see here that
this is the purest blue that you can get.
1838
02:34:56,510 --> 02:35:00,230
Pretty much what this is saying is the first
two is 00, which means there's no red, the
1839
02:35:00,230 --> 02:35:07,880
second pair, or Yeah, the second pair is also
00, which means no green. But then the third
1840
02:35:07,880 --> 02:35:14,270
is F F, which means all blue. So this is pretty
easy. So if we go to something like white,
1841
02:35:14,270 --> 02:35:20,690
for example, this would have f, f, f, f, f
f, which is all red, or green, or blue, which
1842
02:35:20,690 --> 02:35:26,740
actually creates white. And if we chose black,
you can see that that's zero. So this is a
1843
02:35:26,740 --> 02:35:32,950
pretty hard thing to understand. Once you
get into some of these more complicated colors.
1844
02:35:32,950 --> 02:35:35,630
Again, we don't really use hexadecimal in
normal in normal use, when we're creating
1845
02:35:35,630 --> 02:35:39,260
colors or writing code, we don't really use
these numbers. So it's actually much easier
1846
02:35:39,260 --> 02:35:45,450
to work with RGB codes. So RGB is a little
bit different in the style that it's written.
1847
02:35:45,450 --> 02:35:50,310
But it all represents the same concept. Pretty
much there are three numbers here. And these
1848
02:35:50,310 --> 02:35:53,160
aren't hexadecimal numbers, these are just
normal numbers, you have three numbers, the
1849
02:35:53,160 --> 02:35:57,460
first for red, the second for green, and the
third for blue, just like this one, except
1850
02:35:57,460 --> 02:36:02,720
in this case, the numbers can go from zero
to 255, zero being the minimum and 255 being
1851
02:36:02,720 --> 02:36:08,940
the maximum. So this is actually much easier
to read. Let's go back to our blue here. And
1852
02:36:08,940 --> 02:36:15,800
I'm actually just going to write the code
here. So you can see that there's zero red,
1853
02:36:15,800 --> 02:36:28,729
zero blue, and 255. Sorry, is your red zero
green, and 255 blue, which is the maximum.
1854
02:36:28,729 --> 02:36:32,310
And obviously, you can see that once we go
back to those complicated colors. When you
1855
02:36:32,310 --> 02:36:35,790
look here, it's quite complicated to understand.
But when we look at the RGB code, we can see
1856
02:36:35,790 --> 02:36:41,939
that there's a moderate amount of red, a large
amount of green and large amounts of blue,
1857
02:36:41,939 --> 02:36:45,840
and therefore it should theoretically be a
cold color. Now again, you don't really need
1858
02:36:45,840 --> 02:36:50,590
to know how to construct these QR codes from
your head, they're quite hard to understand.
1859
02:36:50,590 --> 02:36:55,340
So what I would recommend is when you're designing
these colors, or designing these, these websites,
1860
02:36:55,340 --> 02:37:00,580
I would recommend you just go and use a color
picker, too much easy too much, much easier
1861
02:37:00,580 --> 02:37:04,359
to decide. And you can also get a lot more
experience hands on experience with these
1862
02:37:04,359 --> 02:37:07,399
colors rather than memorizing all the theory
behind them. So both of these will work fine
1863
02:37:07,399 --> 02:37:11,279
and in the next video I'm going to show you
how to actually use these codes in our in
1864
02:37:11,279 --> 02:37:20,670
our website and actually use them to style
and color text. Alright, let's move on.
1865
02:37:20,670 --> 02:37:27,020
So this is the start of a new section. And
now that we've learned all we need to know
1866
02:37:27,020 --> 02:37:29,010
about selectors, we're going to actually start
styling up our website and making it look
1867
02:37:29,010 --> 02:37:34,760
good. So first of all, let's just talk about
coloring. In general, I mean, what is coloring?
1868
02:37:34,760 --> 02:37:42,460
And what are we supposed to do with it. So
as we know, we already have a bunch of colors
1869
02:37:42,460 --> 02:37:47,310
here. And they all look fine. But what we're
actually trying to do here is color our website
1870
02:37:47,310 --> 02:37:51,189
in a way that makes it look modern, and appealing
to users. So we're going to be learning a
1871
02:37:51,189 --> 02:37:52,430
bunch of different techniques that you can
use to color your website. Now we've already
1872
02:37:52,430 --> 02:37:55,630
used one in the past, and it's a very common
one. And that is, of course, the color property.
1873
02:37:55,630 --> 02:38:03,970
Now we're going to be talking more about this
in the next video and using it in depth. But
1874
02:38:03,970 --> 02:38:07,740
first thing I want to talk about is the different
types of colors, because there's actually
1875
02:38:07,740 --> 02:38:11,609
more than one. So first of all, we've all
used and while you've at least seen me use
1876
02:38:11,609 --> 02:38:15,710
the colors have given by name so for example,
red, green, blue, and purple. But there's
1877
02:38:15,710 --> 02:38:20,660
actually more than that there's so much more
to colors than just those names, because as
1878
02:38:20,660 --> 02:38:25,010
you know, they're actually quite limiting,
you can't really change the color and choose
1879
02:38:25,010 --> 02:38:34,920
as you want. So what I'm here to teach you
about is the three different types of colors
1880
02:38:34,920 --> 02:38:41,560
and how they work. So the first one is obviously
the CSS color codes or names. And what they
1881
02:38:41,560 --> 02:38:45,569
do is is pretty much given a name, and they
each have a designated color. So this is a
1882
02:38:45,569 --> 02:38:49,600
really easy way for testing colors. For example,
if you want to test if a property works, as
1883
02:38:49,600 --> 02:38:54,561
we saw at the beginning of this course. And
you can also use them for you know, maybe
1884
02:38:54,561 --> 02:39:00,530
quick fixes or trying to just try out different
colors. But once you get into the really specific
1885
02:39:00,530 --> 02:39:05,030
detailed web design, and once you start producing
your website properly, you're going to want
1886
02:39:05,030 --> 02:39:09,580
more than just the color CSS gives you. So
I've actually attached to the lecture resources,
1887
02:39:09,580 --> 02:39:17,100
this website here, you have a bunch of different
CSS color codes. And you can see that there's
1888
02:39:17,100 --> 02:39:24,960
actually a huge range of them, we only use
the basic ones that are quite vibrant and
1889
02:39:24,960 --> 02:39:31,390
they really hit the eyes very hard. But you
can see there's actually a lot more than what
1890
02:39:31,390 --> 02:39:35,779
we just use. The only problem is nobody wants
to memorize all of these different names.
1891
02:39:35,779 --> 02:39:42,140
So what we're actually going to be doing is
learning how to use these two, which are the
1892
02:39:42,140 --> 02:39:47,920
ones I'm going to be talking about in this
video. So first of all, let's talk a little
1893
02:39:47,920 --> 02:39:51,510
bit about hex code. Okay. So first of all,
I have a color picker over here just to demonstrate
1894
02:39:51,510 --> 02:39:55,399
how this whole thing works. We actually don't
need this for now. So I'm going to discipline
1895
02:39:55,399 --> 02:40:01,740
full screen. So this is a color picker that
I found on Google, you can go ahead and search
1896
02:40:01,740 --> 02:40:06,330
it anywhere. But I like using Google's provided
one, because it provides you with both the
1897
02:40:06,330 --> 02:40:11,160
hex code and the RGB code. Don't worry, we'll
talk about those in just a second. So first
1898
02:40:11,160 --> 02:40:15,003
of all, you can slide up and down this thing
and choose whichever color you want. And you
1899
02:40:15,003 --> 02:40:17,720
can see that these two codes change. So what
do they actually mean? Well, first, let's
1900
02:40:17,720 --> 02:40:23,729
talk about the hex code. So we all know that
when you're normally using numbers, you range
1901
02:40:23,729 --> 02:40:28,939
from zero to nine. So any given number in
this new in that numeral system can be made
1902
02:40:28,939 --> 02:40:36,311
up of 012, and all the way up to nine. So
in that case, there's 10 possible combinations.
1903
02:40:36,311 --> 02:40:42,560
But in hex code, there's actually 16 different
possible combinations, you can go from zero
1904
02:40:42,560 --> 02:40:50,180
to nine, and then A to F. So for example,
let's just take this right here, this could
1905
02:40:50,180 --> 02:40:53,730
actually be converted into a number if we
wanted to, suppose B, actually stands for
1906
02:40:53,730 --> 02:41:00,830
12, because it goes zero to nine, and then
a B, so 12. And you can actually convert this
1907
02:41:00,830 --> 02:41:05,670
into a number, which is very interesting.
So I'm not really going to be talking about
1908
02:41:05,670 --> 02:41:11,939
the applications of hex code in this in this
video, because that goes all the way down
1909
02:41:11,939 --> 02:41:16,939
into computer science. And we're not really
looking at that now. But one thing we can
1910
02:41:16,939 --> 02:41:25,860
do is actually create colors based on this.
So first of all, you'll notice that our code
1911
02:41:25,860 --> 02:41:32,570
here starts off with a hashtag. And then you
have six digits. So each one can have 16 possible
1912
02:41:32,570 --> 02:41:37,229
combinations. But as we know, color any color
is made up of either red, green, or blue,
1913
02:41:37,229 --> 02:41:42,829
at least on the computer for the standard
color palette. So it's made up of red, green,
1914
02:41:42,829 --> 02:41:47,149
and blue. Now basically, this hex code is
split up into three two digit pairs. So the
1915
02:41:47,149 --> 02:41:51,700
first pair of numbers is meant to represent
the amount of red in the color, the second,
1916
02:41:51,700 --> 02:41:55,430
the amount of green, and the third, the amount
of blue, RGB. And these parents can range
1917
02:41:55,430 --> 02:41:59,450
from 00, which means none of that color to
F F, which is the highest value. Remember,
1918
02:41:59,450 --> 02:42:03,860
hexadecimal goes from zero to f. So I'm just
going to choose something very basic here,
1919
02:42:03,860 --> 02:42:13,560
like a standard blue. You can see here that
this is the purest blue that you can get.
1920
02:42:13,560 --> 02:42:19,200
Pretty much what this is saying is the first
two is 00, which means there's no red, the
1921
02:42:19,200 --> 02:42:24,990
second pair, or Yeah, the second pair is also
00, which means no green. But then the third
1922
02:42:24,990 --> 02:42:29,540
is F F, which means all blue. So this is pretty
easy. So if we go to something like white,
1923
02:42:29,540 --> 02:42:33,800
for example, this would have f, f, f, f, f
f, which is all red, or green, or blue, which
1924
02:42:33,800 --> 02:42:38,950
actually creates white. And if we chose black,
you can see that that's zero. So this is a
1925
02:42:38,950 --> 02:42:41,960
pretty hard thing to understand. Once you
get into some of these more complicated colors.
1926
02:42:41,960 --> 02:42:43,720
Again, we don't really use hexadecimal in
normal in normal use, when we're creating
1927
02:42:43,720 --> 02:42:46,490
colors or writing code, we don't really use
these numbers. So it's actually much easier
1928
02:42:46,490 --> 02:42:48,279
to work with RGB codes. So RGB is a little
bit different in the style that it's written.
1929
02:42:48,279 --> 02:42:53,960
But it all represents the same concept. Pretty
much there are three numbers here. And these
1930
02:42:53,960 --> 02:42:58,070
aren't hexadecimal numbers, these are just
normal numbers, you have three numbers, the
1931
02:42:58,070 --> 02:43:03,020
first for red, the second for green, and the
third for blue, just like this one, except
1932
02:43:03,020 --> 02:43:08,470
in this case, the numbers can go from zero
to 255, zero being the minimum and 255 being
1933
02:43:08,470 --> 02:43:15,859
the maximum. So this is actually much easier
to read. Let's go back to our blue here. And
1934
02:43:15,859 --> 02:43:21,340
I'm actually just going to write the code
here. So you can see that there's zero red,
1935
02:43:21,340 --> 02:43:28,730
zero blue, and 255. Sorry, is your red zero
green, and 255 blue, which is the maximum.
1936
02:43:28,730 --> 02:43:33,720
And obviously, you can see that once we go
back to those complicated colors. When you
1937
02:43:33,720 --> 02:43:37,850
look here, it's quite complicated to understand.
But when we look at the RGB code, we can see
1938
02:43:37,850 --> 02:43:42,550
that there's a moderate amount of red, a large
amount of green and large amounts of blue,
1939
02:43:42,550 --> 02:43:49,390
and therefore it should theoretically be a
cold color. Now again, you don't really need
1940
02:43:49,390 --> 02:43:54,140
to know how to construct these QR codes from
your head, they're quite hard to understand.
1941
02:43:54,140 --> 02:43:59,680
So what I would recommend is when you're designing
these colors, or designing these, these websites,
1942
02:43:59,680 --> 02:44:05,720
I would recommend you just go and use a color
picker, too much easy too much, much easier
1943
02:44:05,720 --> 02:44:13,370
to decide. And you can also get a lot more
experience hands on experience with these
1944
02:44:13,370 --> 02:44:17,210
colors rather than memorizing all the theory
behind them. So both of these will work fine
1945
02:44:17,210 --> 02:44:23,069
and in the next video I'm going to show you
how to actually use these codes in our in
1946
02:44:23,069 --> 02:44:29,140
our website and actually use them to style
and color text. Alright, let's move on.
1947
02:44:29,140 --> 02:44:32,690
So in this video, I am going to be starting
to color and style our website. So we're going
1948
02:44:32,690 --> 02:44:38,180
to go through and use the selector skills
that we've learned in the previous section
1949
02:44:38,180 --> 02:44:44,399
to actually go through and start adding some
color. On top of that, we're going to be using
1950
02:44:44,399 --> 02:44:50,970
the skills we learned about hex code and RGB
color codes to vary up our style or method
1951
02:44:50,970 --> 02:44:55,689
of coloring things. Because in the past, like
I've said, we've just used some basic techniques
1952
02:44:55,689 --> 02:45:00,310
with CSS color codes. And now we're going
to be working with our own custom colors.
1953
02:45:00,310 --> 02:45:05,069
So first of all, let's go ahead and start
adding some classes to this website to get
1954
02:45:05,069 --> 02:45:09,410
it set up for our styling. So first thing
I did is actually started from a clean slate
1955
02:45:09,410 --> 02:45:14,689
because it was getting quite messy before
and I thought that it would be better if we
1956
02:45:14,689 --> 02:45:21,780
started from scratch. So the first thing I'm
going to do is go ahead and add a class or
1957
02:45:21,780 --> 02:45:27,360
an ID actually, I think would be better to
our title, since there's only one of them.
1958
02:45:27,360 --> 02:45:31,890
So we're gonna go ahead and add an ID of title.
And hopefully, you know how to do this from
1959
02:45:31,890 --> 02:45:36,270
the skills you learned in the last section.
Let's also go ahead and add some classes for
1960
02:45:36,270 --> 02:45:40,351
our paragraph text. And because of course,
we have more than one paragraph, we're actually
1961
02:45:40,351 --> 02:45:48,819
going to go ahead and use a class. So I'm
going to use this. And I'm going to say, paragraph.
1962
02:45:48,819 --> 02:45:58,989
Or I'm just going to say para shortening text.
So I'm going to go ahead and copy this class
1963
02:45:58,989 --> 02:46:05,510
on to our other paragraphs, instead of writing
it down. There we go. So the next thing I
1964
02:46:05,510 --> 02:46:10,380
want to do is go ahead and add some classes
to this list here just for convenience. So
1965
02:46:10,380 --> 02:46:14,910
I'm going to go ahead and add a class for
a list item. Now, obviously, we're not going
1966
02:46:14,910 --> 02:46:20,710
to use all of these in one go. But I was just
considering to add them so that when we get
1967
02:46:20,710 --> 02:46:26,830
into it, we can actually go ahead and use
them without having to go ahead and add these
1968
02:46:26,830 --> 02:46:33,050
classes every single time. So there we go,
we did that. Let's also go ahead and add a
1969
02:46:33,050 --> 02:46:39,810
class to our link, link. And now we have our
table items. We're going to leave this for
1970
02:46:39,810 --> 02:46:49,090
now because it might take a long time. Oh,
we'll we'll style this when we get later into
1971
02:46:49,090 --> 02:46:55,110
our section. So there we go, we did that.
Now the last thing I want to do is just go
1972
02:46:55,110 --> 02:47:03,840
ahead and add a couple classes to our inputs
here. So I'm going to go ahead and add some
1973
02:47:03,840 --> 02:47:10,689
classes. So class is form input. And this
is actually quite commonplace to add, or write
1974
02:47:10,689 --> 02:47:16,030
class names and Id names with these. So with
dashes, instead of you know snake case, which
1975
02:47:16,030 --> 02:47:21,560
is using capital letters in like that. It's
just a convention in CSS. So let's go ahead
1976
02:47:21,560 --> 02:47:27,210
and add the same class here. Just like that.
There we go. And we'll also we're also going
1977
02:47:27,210 --> 02:47:33,180
to go ahead and add a subtitle class to our
subtitles, I'm gonna go ahead and do that.
1978
02:47:33,180 --> 02:47:38,760
There we go. Just copy that. And over to our
other subtitles. And once we're done with
1979
02:47:38,760 --> 02:47:42,070
that, we'll move on and start coloring our
text. Right, there we go. So everything's
1980
02:47:42,070 --> 02:47:45,890
looking good. That means nothing has gone
wrong. Let's go ahead and start styling our
1981
02:47:45,890 --> 02:47:47,359
text. So first thing I want to do is style
our header here. So obviously, you don't really
1982
02:47:47,359 --> 02:47:48,359
want to go crazy with text colors. It's more
for backgrounds. But I think we'll just experiment
1983
02:47:48,359 --> 02:47:54,000
a little bit for this video with some of our
colors. So first of all, I'm going to need
1984
02:47:54,000 --> 02:48:01,140
to select it. This is the first part of our
general rule. So because it's an ID, I'm going
1985
02:48:01,140 --> 02:48:03,750
to go hash, and then title, open up our block
with our curly braces. And now we're going
1986
02:48:03,750 --> 02:48:08,939
to start writing our property. So if you don't
know this already, the property is going to
1987
02:48:08,939 --> 02:48:14,569
be color. This is the text of the the color
of the text. And I know it doesn't look like
1988
02:48:14,569 --> 02:48:20,021
it since it doesn't say tech stash color,
similar to a bunch of other properties. But
1989
02:48:20,021 --> 02:48:27,510
this is the way to color your text. So here,
we can go ahead and type a property or sorry,
1990
02:48:27,510 --> 02:48:31,279
our value. Now before we've used colors, like
steel blue, which is a CSS color code. But
1991
02:48:31,279 --> 02:48:35,649
now let's go ahead and challenge ourselves
and start actually messing with these colors
1992
02:48:35,649 --> 02:48:42,310
using our own color picker. So first of all,
I want to choose a color that I really like.
1993
02:48:42,310 --> 02:48:46,279
And I'm going to go for a sort of deep orange.
So we don't want to go for something too dark.
1994
02:48:46,279 --> 02:48:50,570
But we also don't want to go for something
too light so that it's hard on the eyes. Now
1995
02:48:50,570 --> 02:48:55,580
I think a color like this is good. Now how
would we actually implement this? Well, we
1996
02:48:55,580 --> 02:49:00,100
just copy and paste it. And if you're thinking
that that's the right way, well, then you're
1997
02:49:00,100 --> 02:49:05,560
right, it's actually very easy. All you have
to do is copy your hex or RGB code and paste
1998
02:49:05,560 --> 02:49:06,560
it into
1999
02:49:06,560 --> 02:49:10,479
So in this video, I am going to be starting
to color and style our website. So we're going
2000
02:49:10,479 --> 02:49:13,450
to go through and use the selector skills
that we've learned in the previous section
2001
02:49:13,450 --> 02:49:20,310
to actually go through and start adding some
color. On top of that, we're going to be using
2002
02:49:20,310 --> 02:49:25,899
the skills we learned about hex code and RGB
color codes to vary up our style or method
2003
02:49:25,899 --> 02:49:29,430
of coloring things. Because in the past, like
I've said, we've just used some basic techniques
2004
02:49:29,430 --> 02:49:35,130
with CSS color codes. And now we're going
to be working with our own custom colors.
2005
02:49:35,130 --> 02:49:40,319
So first of all, let's go ahead and start
adding some classes to this website to get
2006
02:49:40,319 --> 02:49:45,899
it set up for our styling. So first thing
I did is actually started from a clean slate
2007
02:49:45,899 --> 02:49:51,880
because it was getting quite messy before
and I thought that it would be better if we
2008
02:49:51,880 --> 02:49:58,250
started from scratch. So the first thing I'm
going to do is go ahead and add a class or
2009
02:49:58,250 --> 02:50:05,540
an ID actually, I think would be better to
our title, since there's only one of them.
2010
02:50:05,540 --> 02:50:10,979
So we're gonna go ahead and add an ID of title.
And hopefully, you know how to do this from
2011
02:50:10,979 --> 02:50:16,989
the skills you learned in the last section.
Let's also go ahead and add some classes for
2012
02:50:16,989 --> 02:50:20,399
our paragraph text. And because of course,
we have more than one paragraph, we're actually
2013
02:50:20,399 --> 02:50:25,580
going to go ahead and use a class. So I'm
going to use this. And I'm going to say, paragraph.
2014
02:50:25,580 --> 02:50:31,819
Or I'm just going to say para shortening text.
So I'm going to go ahead and copy this class
2015
02:50:31,819 --> 02:50:35,490
on to our other paragraphs, instead of writing
it down. There we go. So the next thing I
2016
02:50:35,490 --> 02:50:38,359
want to do is go ahead and add some classes
to this list here just for convenience. So
2017
02:50:38,359 --> 02:50:42,740
I'm going to go ahead and add a class for
a list item. Now, obviously, we're not going
2018
02:50:42,740 --> 02:50:48,720
to use all of these in one go. But I was just
considering to add them so that when we get
2019
02:50:48,720 --> 02:50:53,750
into it, we can actually go ahead and use
them without having to go ahead and add these
2020
02:50:53,750 --> 02:50:58,790
classes every single time. So there we go,
we did that. Let's also go ahead and add a
2021
02:50:58,790 --> 02:51:02,029
class to our link, link. And now we have our
table items. We're going to leave this for
2022
02:51:02,029 --> 02:51:04,720
now because it might take a long time. Oh,
we'll we'll style this when we get later into
2023
02:51:04,720 --> 02:51:09,010
our section. So there we go, we did that.
Now the last thing I want to do is just go
2024
02:51:09,010 --> 02:51:13,560
ahead and add a couple classes to our inputs
here. So I'm going to go ahead and add some
2025
02:51:13,560 --> 02:51:18,069
classes. So class is form input. And this
is actually quite commonplace to add, or write
2026
02:51:18,069 --> 02:51:22,370
class names and Id names with these. So with
dashes, instead of you know snake case, which
2027
02:51:22,370 --> 02:51:26,739
is using capital letters in like that. It's
just a convention in CSS. So let's go ahead
2028
02:51:26,739 --> 02:51:32,390
and add the same class here. Just like that.
There we go. And we'll also we're also going
2029
02:51:32,390 --> 02:51:39,220
to go ahead and add a subtitle class to our
subtitles, I'm gonna go ahead and do that.
2030
02:51:39,220 --> 02:51:44,850
There we go. Just copy that. And over to our
other subtitles. And once we're done with
2031
02:51:44,850 --> 02:51:49,620
that, we'll move on and start coloring our
text. Right, there we go. So everything's
2032
02:51:49,620 --> 02:51:54,250
looking good. That means nothing has gone
wrong. Let's go ahead and start styling our
2033
02:51:54,250 --> 02:52:00,530
text. So first thing I want to do is style
our header here. So obviously, you don't really
2034
02:52:00,530 --> 02:52:05,260
want to go crazy with text colors. It's more
for backgrounds. But I think we'll just experiment
2035
02:52:05,260 --> 02:52:08,779
a little bit for this video with some of our
colors. So first of all, I'm going to need
2036
02:52:08,779 --> 02:52:13,220
to select it. This is the first part of our
general rule. So because it's an ID, I'm going
2037
02:52:13,220 --> 02:52:19,350
to go hash, and then title, open up our block
with our curly braces. And now we're going
2038
02:52:19,350 --> 02:52:24,490
to start writing our property. So if you don't
know this already, the property is going to
2039
02:52:24,490 --> 02:52:30,689
be color. This is the text of the the color
of the text. And I know it doesn't look like
2040
02:52:30,689 --> 02:52:35,960
it since it doesn't say tech stash color,
similar to a bunch of other properties. But
2041
02:52:35,960 --> 02:52:41,649
this is the way to color your text. So here,
we can go ahead and type a property or sorry,
2042
02:52:41,649 --> 02:52:47,609
our value. Now before we've used colors, like
steel blue, which is a CSS color code. But
2043
02:52:47,609 --> 02:52:50,355
now let's go ahead and challenge ourselves
and start actually messing with these colors
2044
02:52:50,355 --> 02:52:57,140
using our own color picker. So first of all,
I want to choose a color that I really like.
2045
02:52:57,140 --> 02:53:02,830
And I'm going to go for a sort of deep orange.
So we don't want to go for something too dark.
2046
02:53:02,830 --> 02:53:07,529
But we also don't want to go for something
too light so that it's hard on the eyes. Now
2047
02:53:07,529 --> 02:53:10,920
I think a color like this is good. Now how
would we actually implement this? Well, we
2048
02:53:10,920 --> 02:53:14,930
just copy and paste it. And if you're thinking
that that's the right way, well, then you're
2049
02:53:14,930 --> 02:53:19,460
right, it's actually very easy. All you have
to do is copy your hex or RGB code and paste
2050
02:53:19,460 --> 02:53:20,460
it into
2051
02:53:20,460 --> 02:53:23,910
into here just like that. Now if I go ahead
and refresh the page, you can see that that
2052
02:53:23,910 --> 02:53:33,390
color is being reflected on our title. Now
I would recommend instead of using your hex
2053
02:53:33,390 --> 02:53:39,979
code, go ahead and add an RGB code. And I'll
tell you why later in this section, but for
2054
02:53:39,979 --> 02:53:46,890
now, just think that this is better because
it's a little bit more flexible, and you can
2055
02:53:46,890 --> 02:53:49,140
change it easily. So on top of that, use an
RGB color code really allows you to mess around
2056
02:53:49,140 --> 02:53:52,910
with the colors in a way that if you didn't
know hex code you wouldn't be able to. So
2057
02:53:52,910 --> 02:53:58,649
for example, let's say I wanted to increase
the amount of blue in this, all they would
2058
02:53:58,649 --> 02:54:02,189
have to do is go ahead and just change it.
Let's say I wanted to go with 150. Blue, you
2059
02:54:02,189 --> 02:54:07,970
can see that that color has completely changed
by adding more blue. By doing it, we've kind
2060
02:54:07,970 --> 02:54:12,630
of mixed around the colors and created this
pinkish color. Imagine you're working with
2061
02:54:12,630 --> 02:54:17,029
a color palette, instead of a digital kind
of weird color mixer. Think of you have a
2062
02:54:17,029 --> 02:54:20,600
giant pile of red, green and blue. And what
you're doing here is changing all of the proportions
2063
02:54:20,600 --> 02:54:26,300
to get just the color you want. So let's go
ahead and change this color back to nine.
2064
02:54:26,300 --> 02:54:32,489
There we go. Now we have our orange color
there. So let's go ahead and also style up
2065
02:54:32,489 --> 02:54:38,300
our, our subtitles here. And one common thing
that you do with hierarchies of text. So for
2066
02:54:38,300 --> 02:54:44,580
example, titles and then sub titles and paragraph
is usually your titles or your high up on
2067
02:54:44,580 --> 02:54:49,420
the hierarchy are going to have very dark
colors. And then your sub titles are things
2068
02:54:49,420 --> 02:54:54,940
that are lower on the hierarchy are going
to have around the same color scheme, but
2069
02:54:54,940 --> 02:55:00,970
they're going to be a little lighter. So what
I'm going to do is just go ahead to my color
2070
02:55:00,970 --> 02:55:04,670
picker and drag this up a little bit. Of course,
you could do this by just increasing all of
2071
02:55:04,670 --> 02:55:09,650
the values. But I actually prefer to use the
color picker because I could really see what's
2072
02:55:09,650 --> 02:55:13,890
going on. So I'm going to choose something
a little bit lighter, maybe something around
2073
02:55:13,890 --> 02:55:18,300
here. Again, we don't want it to be too light,
because then it's going to be too hard on
2074
02:55:18,300 --> 02:55:25,260
the eyes. So I think I'm going to go something
around here. So we're going to go ahead and
2075
02:55:25,260 --> 02:55:30,989
copy the code. Now let's go ahead and add
our selector. So I'm going to go dot subtitle,
2076
02:55:30,989 --> 02:55:36,890
because remember, it's a class, then I'm going
to use my property color and paste in our
2077
02:55:36,890 --> 02:55:45,521
RGB color code. Let's go ahead and refresh
the page. And you can see that our subtitles
2078
02:55:45,521 --> 02:55:49,200
have been colored down. So there we know everything
is working really well for now. And we're
2079
02:55:49,200 --> 02:55:55,310
starting to get the hang of this. Now I recommend
you go ahead and try this on your own. Again,
2080
02:55:55,310 --> 02:56:00,990
the whole point is to be styling a website
as you go along. So I recommend you go ahead
2081
02:56:00,990 --> 02:56:05,910
and mess around with your own colors. Again,
you can just find this color picker by going
2082
02:56:05,910 --> 02:56:10,370
to Google, if you don't really like it, you
could always go to another color picker on
2083
02:56:10,370 --> 02:56:13,640
search for one. But you can go ahead choose
your own colors. If you don't like orange,
2084
02:56:13,640 --> 02:56:20,500
you can go with blue, maybe something a little
colder. It's totally up to you just get some
2085
02:56:20,500 --> 02:56:25,720
practice with using colors on different types
of texts, and get some more practice using
2086
02:56:25,720 --> 02:56:28,510
CSS on your own. Alright, let's move on.
2087
02:56:28,510 --> 02:56:33,160
into here just like that. Now if I go ahead
and refresh the page, you can see that that
2088
02:56:33,160 --> 02:56:38,910
color is being reflected on our title. Now
I would recommend instead of using your hex
2089
02:56:38,910 --> 02:56:42,080
code, go ahead and add an RGB code. And I'll
tell you why later in this section, but for
2090
02:56:42,080 --> 02:56:43,670
now, just think that this is better because
it's a little bit more flexible, and you can
2091
02:56:43,670 --> 02:56:46,080
change it easily. So on top of that, use an
RGB color code really allows you to mess around
2092
02:56:46,080 --> 02:56:49,470
with the colors in a way that if you didn't
know hex code you wouldn't be able to. So
2093
02:56:49,470 --> 02:56:52,649
for example, let's say I wanted to increase
the amount of blue in this, all they would
2094
02:56:52,649 --> 02:56:59,729
have to do is go ahead and just change it.
Let's say I wanted to go with 150. Blue, you
2095
02:56:59,729 --> 02:57:03,670
can see that that color has completely changed
by adding more blue. By doing it, we've kind
2096
02:57:03,670 --> 02:57:04,739
of mixed around the colors and created this
pinkish color. Imagine you're working with
2097
02:57:04,739 --> 02:57:10,359
a color palette, instead of a digital kind
of weird color mixer. Think of you have a
2098
02:57:10,359 --> 02:57:14,240
giant pile of red, green and blue. And what
you're doing here is changing all of the proportions
2099
02:57:14,240 --> 02:57:18,310
to get just the color you want. So let's go
ahead and change this color back to nine.
2100
02:57:18,310 --> 02:57:22,080
There we go. Now we have our orange color
there. So let's go ahead and also style up
2101
02:57:22,080 --> 02:57:27,260
our, our subtitles here. And one common thing
that you do with hierarchies of text. So for
2102
02:57:27,260 --> 02:57:32,529
example, titles and then sub titles and paragraph
is usually your titles or your high up on
2103
02:57:32,529 --> 02:57:37,690
the hierarchy are going to have very dark
colors. And then your sub titles are things
2104
02:57:37,690 --> 02:57:41,390
that are lower on the hierarchy are going
to have around the same color scheme, but
2105
02:57:41,390 --> 02:57:46,580
they're going to be a little lighter. So what
I'm going to do is just go ahead to my color
2106
02:57:46,580 --> 02:57:52,380
picker and drag this up a little bit. Of course,
you could do this by just increasing all of
2107
02:57:52,380 --> 02:57:58,660
the values. But I actually prefer to use the
color picker because I could really see what's
2108
02:57:58,660 --> 02:58:04,029
going on. So I'm going to choose something
a little bit lighter, maybe something around
2109
02:58:04,029 --> 02:58:08,239
here. Again, we don't want it to be too light,
because then it's going to be too hard on
2110
02:58:08,239 --> 02:58:13,160
the eyes. So I think I'm going to go something
around here. So we're going to go ahead and
2111
02:58:13,160 --> 02:58:17,340
copy the code. Now let's go ahead and add
our selector. So I'm going to go dot subtitle,
2112
02:58:17,340 --> 02:58:21,570
because remember, it's a class, then I'm going
to use my property color and paste in our
2113
02:58:21,570 --> 02:58:26,979
RGB color code. Let's go ahead and refresh
the page. And you can see that our subtitles
2114
02:58:26,979 --> 02:58:31,920
have been colored down. So there we know everything
is working really well for now. And we're
2115
02:58:31,920 --> 02:58:41,779
starting to get the hang of this. Now I recommend
you go ahead and try this on your own. Again,
2116
02:58:41,779 --> 02:58:49,160
the whole point is to be styling a website
as you go along. So I recommend you go ahead
2117
02:58:49,160 --> 02:58:53,979
and mess around with your own colors. Again,
you can just find this color picker by going
2118
02:58:53,979 --> 02:58:58,970
to Google, if you don't really like it, you
could always go to another color picker on
2119
02:58:58,970 --> 02:59:03,340
search for one. But you can go ahead choose
your own colors. If you don't like orange,
2120
02:59:03,340 --> 02:59:07,960
you can go with blue, maybe something a little
colder. It's totally up to you just get some
2121
02:59:07,960 --> 02:59:12,290
practice with using colors on different types
of texts, and get some more practice using
2122
02:59:12,290 --> 02:59:20,550
CSS on your own. Alright, let's move on.
2123
02:59:20,550 --> 02:59:29,100
So in this video, we are going to be covering
background colors. Now, I know it's a little
2124
02:59:29,100 --> 02:59:35,270
bit intimidating considering we've never actually
done backgrounds before. But it's very similar
2125
02:59:35,270 --> 02:59:42,670
to colors in the values that he uses. The
only difference is is what it's actually styling.
2126
02:59:42,670 --> 02:59:50,029
So I'm going to be teaching you how to create
backgrounds on your website. Now, obviously,
2127
02:59:50,029 --> 02:59:53,351
we're not going to go all crazy and start
creating backgrounds for everything. Because
2128
02:59:53,351 --> 02:59:57,319
we haven't gotten into we haven't gotten into
layout yet. And without layout backgrounds
2129
02:59:57,319 --> 03:00:02,010
aren't really usable. Because sometimes, especially
with colors, it just doesn't really look that
2130
03:00:02,010 --> 03:00:03,990
good. So what we're actually going to do is
go through and just practice with our background
2131
03:00:03,990 --> 03:00:09,490
for now. So the first thing I need to do is
actually look for something to create a background
2132
03:00:09,490 --> 03:00:14,710
on. And we all know what a background on text
looked like. Now, we don't actually know why
2133
03:00:14,710 --> 03:00:19,609
the background goes all the way to the edge
yet. We haven't gotten we haven't gotten into
2134
03:00:19,609 --> 03:00:24,660
layout yet. Once we do, you'll know how to
change that. For now though, I think it's
2135
03:00:24,660 --> 03:00:30,649
really fitting to go through and style this
whole page. So firstly, what selector Do we
2136
03:00:30,649 --> 03:00:35,070
need to use? Considering that we're trying
to select everything? How are we supposed
2137
03:00:35,070 --> 03:00:40,100
to create a background on every single item?
Do we go through and select everything and
2138
03:00:40,100 --> 03:00:48,590
add that background? Well, we actually look
at a look at our HTML page, you can see that
2139
03:00:48,590 --> 03:00:54,989
all of our text here is contained inside of
our body tag. So the easiest way to select
2140
03:00:54,989 --> 03:00:59,939
this, because again, there's only one of our
body, we can just use an element selector.
2141
03:00:59,939 --> 03:01:04,290
So I'm going to go ahead and select it with
body. So usually, you would actually put tags,
2142
03:01:04,290 --> 03:01:11,149
elements selectors at the top. So I'm going
to go ahead and do that now. Open up our block
2143
03:01:11,149 --> 03:01:14,859
using those curly braces. And now we can add
our background. So first of all, the property
2144
03:01:14,859 --> 03:01:18,960
used to Select and Color background is called
background color. But we're not actually going
2145
03:01:18,960 --> 03:01:23,790
to use that because background is much easier
considering that you can actually go and also
2146
03:01:23,790 --> 03:01:27,880
select images and URLs instead of colors.
It's much more flexible, and I prefer using
2147
03:01:27,880 --> 03:01:32,771
it over background color. So I'm going to
go ahead and select that as my property. So
2148
03:01:32,771 --> 03:01:39,149
from now, you can just go ahead and add your
value. Similarly to color. You can use an
2149
03:01:39,149 --> 03:01:44,990
RGB code, hex code or a CSS color even if
you want so I'm going to go ahead and set
2150
03:01:44,990 --> 03:01:50,391
it as red And just worn your eyes because
it's quite puffing. So you can see that now
2151
03:01:50,391 --> 03:01:53,979
our entire site has been styled red. Now,
obviously, I don't want this, this doesn't
2152
03:01:53,979 --> 03:01:57,739
really look very good. So I'm going to go
ahead and erase this property for now. And
2153
03:01:57,739 --> 03:02:01,271
we're going to go through and choose a color.
So I would recommend choosing something a
2154
03:02:01,271 --> 03:02:04,150
little bit light. So I'm going to go for about
a light turquoise or light blue, something
2155
03:02:04,150 --> 03:02:08,170
like this. So now I'm going to go ahead and
copy my RGB code. And here, I'm going to go
2156
03:02:08,170 --> 03:02:10,750
ahead and add my background property and paste
in my RGB code. Now if we go ahead and refresh
2157
03:02:10,750 --> 03:02:16,040
the page, you can see we have this really
nice light blue, which kind of fits in with
2158
03:02:16,040 --> 03:02:21,680
our oranges. Now, because it's a little bit,
it doesn't really look that good on this light
2159
03:02:21,680 --> 03:02:32,082
orange, I'm going to go ahead and dampen it
a little bit. So the easy way to do this with
2160
03:02:32,082 --> 03:02:38,330
RGB is to just go ahead and drop all of the
values this way, you stay in the same proportions,
2161
03:02:38,330 --> 03:02:43,410
but you're just darkening everything. So I'm
going to go ahead and darken our subtitles.
2162
03:02:43,410 --> 03:02:49,280
So I'm going to reduce everything by 20 or
so. So this becomes let's just say 200. And
2163
03:02:49,280 --> 03:02:54,840
this becomes 148. And obviously, these don't
have to be exact, and this can become 30.
2164
03:02:54,840 --> 03:03:02,021
So these don't have to be exact, like I said,
we're just darkening the titles, you can see,
2165
03:03:02,021 --> 03:03:07,310
you can see that they got a little bit darker,
and it looks better on this color. Alright,
2166
03:03:07,310 --> 03:03:12,689
there we go. So that's pretty much how to
style backgrounds. Now, you can go ahead and
2167
03:03:12,689 --> 03:03:17,390
apply this to pretty much anything you want.
So if I actually go ahead and style our subtitles
2168
03:03:17,390 --> 03:03:22,970
with our blue background, obviously, it won't
look that good, but it works perfectly fine.
2169
03:03:22,970 --> 03:03:26,489
So there we go. That's pretty much how to
add color to backgrounds. And in the next
2170
03:03:26,489 --> 03:03:28,730
video, I'm going to be teaching you how to
actually change the type of background that
2171
03:03:28,730 --> 03:03:32,140
you're using. Because obviously, sometimes
you want to actually change the background
2172
03:03:32,140 --> 03:03:39,069
and use maybe a custom image, or you want
to link to an image online. So I'm going to
2173
03:03:39,069 --> 03:03:46,670
be teaching you how to do that in the next
video. So let's just go and refresh the page.
2174
03:03:46,670 --> 03:03:49,470
Keep that normal. Alright, let's move on.
2175
03:03:49,470 --> 03:03:54,640
So in this video, we are going to be covering
background colors. Now, I know it's a little
2176
03:03:54,640 --> 03:04:00,080
bit intimidating considering we've never actually
done backgrounds before. But it's very similar
2177
03:04:00,080 --> 03:04:05,920
to colors in the values that he uses. The
only difference is is what it's actually styling.
2178
03:04:05,920 --> 03:04:11,680
So I'm going to be teaching you how to create
backgrounds on your website. Now, obviously,
2179
03:04:11,680 --> 03:04:16,240
we're not going to go all crazy and start
creating backgrounds for everything. Because
2180
03:04:16,240 --> 03:04:20,790
we haven't gotten into we haven't gotten into
layout yet. And without layout backgrounds
2181
03:04:20,790 --> 03:04:24,590
aren't really usable. Because sometimes, especially
with colors, it just doesn't really look that
2182
03:04:24,590 --> 03:04:27,920
good. So what we're actually going to do is
go through and just practice with our background
2183
03:04:27,920 --> 03:04:32,780
for now. So the first thing I need to do is
actually look for something to create a background
2184
03:04:32,780 --> 03:04:37,710
on. And we all know what a background on text
looked like. Now, we don't actually know why
2185
03:04:37,710 --> 03:04:43,490
the background goes all the way to the edge
yet. We haven't gotten we haven't gotten into
2186
03:04:43,490 --> 03:04:50,760
layout yet. Once we do, you'll know how to
change that. For now though, I think it's
2187
03:04:50,760 --> 03:04:55,560
really fitting to go through and style this
whole page. So firstly, what selector Do we
2188
03:04:55,560 --> 03:04:58,560
need to use? Considering that we're trying
to select everything? How are we supposed
2189
03:04:58,560 --> 03:05:03,270
to create a background on every single item?
Do we go through and select everything and
2190
03:05:03,270 --> 03:05:09,260
add that background? Well, we actually look
at a look at our HTML page, you can see that
2191
03:05:09,260 --> 03:05:15,780
all of our text here is contained inside of
our body tag. So the easiest way to select
2192
03:05:15,780 --> 03:05:20,840
this, because again, there's only one of our
body, we can just use an element selector.
2193
03:05:20,840 --> 03:05:27,180
So I'm going to go ahead and select it with
body. So usually, you would actually put tags,
2194
03:05:27,180 --> 03:05:34,430
elements selectors at the top. So I'm going
to go ahead and do that now. Open up our block
2195
03:05:34,430 --> 03:05:39,029
using those curly braces. And now we can add
our background. So first of all, the property
2196
03:05:39,029 --> 03:05:43,240
used to Select and Color background is called
background color. But we're not actually going
2197
03:05:43,240 --> 03:05:48,700
to use that because background is much easier
considering that you can actually go and also
2198
03:05:48,700 --> 03:05:52,430
select images and URLs instead of colors.
It's much more flexible, and I prefer using
2199
03:05:52,430 --> 03:05:59,021
it over background color. So I'm going to
go ahead and select that as my property. So
2200
03:05:59,021 --> 03:06:08,130
from now, you can just go ahead and add your
value. Similarly to color. You can use an
2201
03:06:08,130 --> 03:06:13,890
RGB code, hex code or a CSS color even if
you want so I'm going to go ahead and set
2202
03:06:13,890 --> 03:06:17,730
it as red And just worn your eyes because
it's quite puffing. So you can see that now
2203
03:06:17,730 --> 03:06:22,000
our entire site has been styled red. Now,
obviously, I don't want this, this doesn't
2204
03:06:22,000 --> 03:06:27,989
really look very good. So I'm going to go
ahead and erase this property for now. And
2205
03:06:27,989 --> 03:06:35,330
we're going to go through and choose a color.
So I would recommend choosing something a
2206
03:06:35,330 --> 03:06:38,700
little bit light. So I'm going to go for about
a light turquoise or light blue, something
2207
03:06:38,700 --> 03:06:42,330
like this. So now I'm going to go ahead and
copy my RGB code. And here, I'm going to go
2208
03:06:42,330 --> 03:06:48,560
ahead and add my background property and paste
in my RGB code. Now if we go ahead and refresh
2209
03:06:48,560 --> 03:06:54,000
the page, you can see we have this really
nice light blue, which kind of fits in with
2210
03:06:54,000 --> 03:07:01,310
our oranges. Now, because it's a little bit,
it doesn't really look that good on this light
2211
03:07:01,310 --> 03:07:12,460
orange, I'm going to go ahead and dampen it
a little bit. So the easy way to do this with
2212
03:07:12,460 --> 03:07:20,050
RGB is to just go ahead and drop all of the
values this way, you stay in the same proportions,
2213
03:07:20,050 --> 03:07:24,040
but you're just darkening everything. So I'm
going to go ahead and darken our subtitles.
2214
03:07:24,040 --> 03:07:28,100
So I'm going to reduce everything by 20 or
so. So this becomes let's just say 200. And
2215
03:07:28,100 --> 03:07:32,420
this becomes 148. And obviously, these don't
have to be exact, and this can become 30.
2216
03:07:32,420 --> 03:07:38,979
So these don't have to be exact, like I said,
we're just darkening the titles, you can see,
2217
03:07:38,979 --> 03:07:43,350
you can see that they got a little bit darker,
and it looks better on this color. Alright,
2218
03:07:43,350 --> 03:07:49,100
there we go. So that's pretty much how to
style backgrounds. Now, you can go ahead and
2219
03:07:49,100 --> 03:07:56,270
apply this to pretty much anything you want.
So if I actually go ahead and style our subtitles
2220
03:07:56,270 --> 03:08:00,450
with our blue background, obviously, it won't
look that good, but it works perfectly fine.
2221
03:08:00,450 --> 03:08:05,180
So there we go. That's pretty much how to
add color to backgrounds. And in the next
2222
03:08:05,180 --> 03:08:08,270
video, I'm going to be teaching you how to
actually change the type of background that
2223
03:08:08,270 --> 03:08:11,330
you're using. Because obviously, sometimes
you want to actually change the background
2224
03:08:11,330 --> 03:08:19,780
and use maybe a custom image, or you want
to link to an image online. So I'm going to
2225
03:08:19,780 --> 03:08:26,590
be teaching you how to do that in the next
video. So let's just go and refresh the page.
2226
03:08:26,590 --> 03:08:28,739
Keep that normal. Alright, let's move on.
2227
03:08:28,739 --> 03:08:33,970
So in this video, we're going to be looking
at a different type of background in CSS.
2228
03:08:33,970 --> 03:08:39,200
So now that we've covered basic color types,
and we've also covered a little bit of background,
2229
03:08:39,200 --> 03:08:43,290
and using background tracks, we're going to
move on to an alternate way of creating backgrounds.
2230
03:08:43,290 --> 03:08:47,460
And that's through background images. So right
now we know the basics of coloring, so we
2231
03:08:47,460 --> 03:08:53,090
were able to call it a text. Now with our
own custom colors using a color picker, we
2232
03:08:53,090 --> 03:08:57,230
can also go ahead and use our own, you know,
backgrounds and things like that with our
2233
03:08:57,230 --> 03:09:03,680
own colors. But now what I want to cover is
looking at different types of backgrounds
2234
03:09:03,680 --> 03:09:10,380
themselves. So in this case, we're going to
be looking at images. So first of all, when
2235
03:09:10,380 --> 03:09:17,620
we want to set the background to an image,
we can just go ahead and add an RGB color
2236
03:09:17,620 --> 03:09:25,290
code, we're going to need to go and actually
link to an image. So I'm going to show you
2237
03:09:25,290 --> 03:09:30,939
a really easy way of doing this, the first
thing we're going to need is an image. And
2238
03:09:30,939 --> 03:09:34,899
for this method, you can actually use images
with from the internet without having to download
2239
03:09:34,899 --> 03:09:42,120
them using URLs. So show you how to do that
now. So if I go ahead and search for a landscape
2240
03:09:42,120 --> 03:09:47,960
image, just like this. And now we want to
look for a sort of low resolution one, we
2241
03:09:47,960 --> 03:09:53,979
don't want to do too big, I think this will
be pretty good, it's going to look a little
2242
03:09:53,979 --> 03:09:57,060
bit weird, but just for this purpose, we're
going to use it. So now what we need to do
2243
03:09:57,060 --> 03:10:02,010
is get the URL link to this image. So you
can do this by right clicking on it. And then
2244
03:10:02,010 --> 03:10:04,630
you're going to go ahead and click on copy
image address. Okay, so what this is going
2245
03:10:04,630 --> 03:10:09,520
to do is get the actual link to the image
itself. Right now this link is going to Google
2246
03:10:09,520 --> 03:10:14,430
Images. But what we actually need is the link
to the image itself. So there we go, we have
2247
03:10:14,430 --> 03:10:20,479
that set up. Now we need to go ahead and add
the image to the page. So under here, I'm
2248
03:10:20,479 --> 03:10:26,090
going to just erase this color code for now.
And I'm going to show you how to add our image.
2249
03:10:26,090 --> 03:10:29,649
So there's this thing in CSS, they're called
functions. Now, we're not really going to
2250
03:10:29,649 --> 03:10:33,310
go very in depth about them. But pretty much
what they do is they take a few inputs, they
2251
03:10:33,310 --> 03:10:37,240
process them, and they give an output. So
the first example of a function that we've
2252
03:10:37,240 --> 03:10:42,320
already used is this right here, it takes
three inputs A red, a green, and a blue, does
2253
03:10:42,320 --> 03:10:46,699
some magic behind the scenes, and then gives
us a color back. So what we're going to do
2254
03:10:46,699 --> 03:10:49,670
here is use another function called URL. So
what this is going to do is take in the link
2255
03:10:49,670 --> 03:10:57,430
or to the URL, and then it's going to find
that image and set it. So in quotations, it
2256
03:10:57,430 --> 03:11:02,390
doesn't have to be in quotations, just remember
that you're going to paste in your image.
2257
03:11:02,390 --> 03:11:04,920
So remember, I just copied this from the image
address. And now we have it here. So we have
2258
03:11:04,920 --> 03:11:11,330
the image. Let's go ahead and check it out
on our website. So there we go. You can see
2259
03:11:11,330 --> 03:11:17,050
that whoops, you can see that our image is
set here. Now there's a few issues, obviously
2260
03:11:17,050 --> 03:11:22,370
with the repetition and everything, but we're
not going to be covering those until maybe
2261
03:11:22,370 --> 03:11:25,680
in a few videos. Where we talk about some
other background properties. But there we
2262
03:11:25,680 --> 03:11:33,130
go for now, we've actually set our image and
now it is set on our website. So when you
2263
03:11:33,130 --> 03:11:42,920
think of a URL, you're most likely thinking
of linking to google images or some sort of
2264
03:11:42,920 --> 03:11:49,640
web URL. But that's not the only type of URL
that we can use a URL is just a link to an
2265
03:11:49,640 --> 03:11:54,819
endpoint. This right here is a URL, it's just
not linking to a website, it's instead linking
2266
03:11:54,819 --> 03:11:59,949
to a local picture, or stylesheet, or whatever
you're trying to link to. So what I'm actually
2267
03:11:59,949 --> 03:12:05,560
going to show you is that we can use these
local URLs in here. So I'm going to erase
2268
03:12:05,560 --> 03:12:09,130
this a little bit longer. Now, I'm going to
paste in our new URL here, go ahead and refresh
2269
03:12:09,130 --> 03:12:12,390
the page. And now you can see that it still
works perfectly. Because again, it's linking
2270
03:12:12,390 --> 03:12:17,010
to an endpoint, it's just not on our website,
it's instead stored on our local machine.
2271
03:12:17,010 --> 03:12:21,830
So there we go, we have that set up now. But
there's actually another way that you can
2272
03:12:21,830 --> 03:12:26,529
set background images. And this goes the same
for background colors. So why I like to use
2273
03:12:26,529 --> 03:12:31,920
the background property is because you can
set anything you want in one go. You can set
2274
03:12:31,920 --> 03:12:35,770
it as a color as an image, and he do many
other things. But instead, you can actually
2275
03:12:35,770 --> 03:12:40,720
use very specific properties that work for
specific value. So for example, in this case,
2276
03:12:40,720 --> 03:12:45,800
we can use background image. And from here,
we can go ahead and copy paste the URL, like
2277
03:12:45,800 --> 03:12:51,350
that, make sure to add your semicolon. Now
I'm going to go ahead and erase this and show
2278
03:12:51,350 --> 03:12:56,649
you that it still works perfectly fine. So
you see I refresh the page, and it's still
2279
03:12:56,649 --> 03:12:59,729
working. And this goes the same for for background
colors, you can go ahead and add a background
2280
03:12:59,729 --> 03:13:03,130
color, and then add some random RGB value
just going to go for a full black for now.
2281
03:13:03,130 --> 03:13:06,979
And you can see that it still works. The only
problem is if I go ahead and paste in that
2282
03:13:06,979 --> 03:13:10,530
URL here. Oh, what if I go ahead and paste
in that URL here,
2283
03:13:10,530 --> 03:13:14,399
So in this video, we're going to be looking
at a different type of background in CSS.
2284
03:13:14,399 --> 03:13:23,220
So now that we've covered basic color types,
and we've also covered a little bit of background,
2285
03:13:23,220 --> 03:13:30,560
and using background tracks, we're going to
move on to an alternate way of creating backgrounds.
2286
03:13:30,560 --> 03:13:36,750
And that's through background images. So right
now we know the basics of coloring, so we
2287
03:13:36,750 --> 03:13:41,949
were able to call it a text. Now with our
own custom colors using a color picker, we
2288
03:13:41,949 --> 03:13:47,449
can also go ahead and use our own, you know,
backgrounds and things like that with our
2289
03:13:47,449 --> 03:13:53,029
own colors. But now what I want to cover is
looking at different types of backgrounds
2290
03:13:53,029 --> 03:13:58,370
themselves. So in this case, we're going to
be looking at images. So first of all, when
2291
03:13:58,370 --> 03:14:04,979
we want to set the background to an image,
we can just go ahead and add an RGB color
2292
03:14:04,979 --> 03:14:10,229
code, we're going to need to go and actually
link to an image. So I'm going to show you
2293
03:14:10,229 --> 03:14:15,100
a really easy way of doing this, the first
thing we're going to need is an image. And
2294
03:14:15,100 --> 03:14:22,649
for this method, you can actually use images
with from the internet without having to download
2295
03:14:22,649 --> 03:14:32,380
them using URLs. So show you how to do that
now. So if I go ahead and search for a landscape
2296
03:14:32,380 --> 03:14:37,939
image, just like this. And now we want to
look for a sort of low resolution one, we
2297
03:14:37,939 --> 03:14:43,199
don't want to do too big, I think this will
be pretty good, it's going to look a little
2298
03:14:43,199 --> 03:14:49,970
bit weird, but just for this purpose, we're
going to use it. So now what we need to do
2299
03:14:49,970 --> 03:14:54,250
is get the URL link to this image. So you
can do this by right clicking on it. And then
2300
03:14:54,250 --> 03:14:59,350
you're going to go ahead and click on copy
image address. Okay, so what this is going
2301
03:14:59,350 --> 03:15:05,569
to do is get the actual link to the image
itself. Right now this link is going to Google
2302
03:15:05,569 --> 03:15:10,680
Images. But what we actually need is the link
to the image itself. So there we go, we have
2303
03:15:10,680 --> 03:15:15,430
that set up. Now we need to go ahead and add
the image to the page. So under here, I'm
2304
03:15:15,430 --> 03:15:32,060
going to just erase this color code for now.
And I'm going to show you how to add our image.
2305
03:15:32,060 --> 03:15:37,310
So there's this thing in CSS, they're called
functions. Now, we're not really going to
2306
03:15:37,310 --> 03:15:42,860
go very in depth about them. But pretty much
what they do is they take a few inputs, they
2307
03:15:42,860 --> 03:15:45,250
process them, and they give an output. So
the first example of a function that we've
2308
03:15:45,250 --> 03:15:50,110
already used is this right here, it takes
three inputs A red, a green, and a blue, does
2309
03:15:50,110 --> 03:15:55,460
some magic behind the scenes, and then gives
us a color back. So what we're going to do
2310
03:15:55,460 --> 03:16:01,110
here is use another function called URL. So
what this is going to do is take in the link
2311
03:16:01,110 --> 03:16:07,600
or to the URL, and then it's going to find
that image and set it. So in quotations, it
2312
03:16:07,600 --> 03:16:12,180
doesn't have to be in quotations, just remember
that you're going to paste in your image.
2313
03:16:12,180 --> 03:16:19,399
So remember, I just copied this from the image
address. And now we have it here. So we have
2314
03:16:19,399 --> 03:16:26,540
the image. Let's go ahead and check it out
on our website. So there we go. You can see
2315
03:16:26,540 --> 03:16:32,460
that whoops, you can see that our image is
set here. Now there's a few issues, obviously
2316
03:16:32,460 --> 03:16:37,610
with the repetition and everything, but we're
not going to be covering those until maybe
2317
03:16:37,610 --> 03:16:40,480
in a few videos. Where we talk about some
other background properties. But there we
2318
03:16:40,480 --> 03:16:44,580
go for now, we've actually set our image and
now it is set on our website. So when you
2319
03:16:44,580 --> 03:16:48,670
think of a URL, you're most likely thinking
of linking to google images or some sort of
2320
03:16:48,670 --> 03:16:53,729
web URL. But that's not the only type of URL
that we can use a URL is just a link to an
2321
03:16:53,729 --> 03:16:59,689
endpoint. This right here is a URL, it's just
not linking to a website, it's instead linking
2322
03:16:59,689 --> 03:17:05,010
to a local picture, or stylesheet, or whatever
you're trying to link to. So what I'm actually
2323
03:17:05,010 --> 03:17:10,990
going to show you is that we can use these
local URLs in here. So I'm going to erase
2324
03:17:10,990 --> 03:17:16,290
this a little bit longer. Now, I'm going to
paste in our new URL here, go ahead and refresh
2325
03:17:16,290 --> 03:17:21,170
the page. And now you can see that it still
works perfectly. Because again, it's linking
2326
03:17:21,170 --> 03:17:25,680
to an endpoint, it's just not on our website,
it's instead stored on our local machine.
2327
03:17:25,680 --> 03:17:30,760
So there we go, we have that set up now. But
there's actually another way that you can
2328
03:17:30,760 --> 03:17:36,220
set background images. And this goes the same
for background colors. So why I like to use
2329
03:17:36,220 --> 03:17:41,850
the background property is because you can
set anything you want in one go. You can set
2330
03:17:41,850 --> 03:17:46,880
it as a color as an image, and he do many
other things. But instead, you can actually
2331
03:17:46,880 --> 03:17:51,710
use very specific properties that work for
specific value. So for example, in this case,
2332
03:17:51,710 --> 03:17:59,640
we can use background image. And from here,
we can go ahead and copy paste the URL, like
2333
03:17:59,640 --> 03:18:06,950
that, make sure to add your semicolon. Now
I'm going to go ahead and erase this and show
2334
03:18:06,950 --> 03:18:12,500
you that it still works perfectly fine. So
you see I refresh the page, and it's still
2335
03:18:12,500 --> 03:18:17,770
working. And this goes the same for for background
colors, you can go ahead and add a background
2336
03:18:17,770 --> 03:18:22,220
color, and then add some random RGB value
just going to go for a full black for now.
2337
03:18:22,220 --> 03:18:27,590
And you can see that it still works. The only
problem is if I go ahead and paste in that
2338
03:18:27,590 --> 03:18:32,120
URL here. Oh, what if I go ahead and paste
in that URL here,
2339
03:18:32,120 --> 03:18:38,460
just gonna link to it straight. So if I go
ahead and add the URL to the color, it's not
2340
03:18:38,460 --> 03:18:42,640
going to work, because this is specifically
for colors. Alright, so there we go. That's
2341
03:18:42,640 --> 03:18:45,700
pretty much it. For background images, it's
quite easy to use, all you have to do is make
2342
03:18:45,700 --> 03:18:49,890
sure that you have a working URL, you can
just test it by putting it in and seeing the
2343
03:18:49,890 --> 03:18:54,970
backroads loading properly. And from there,
just use your URL function and a suitable
2344
03:18:54,970 --> 03:18:59,830
property, such as background or background
image, and you should be good to go. Alright,
2345
03:18:59,830 --> 03:19:02,439
let's move on. So in this video, we're going
to be looking at some more background properties.
2346
03:19:02,439 --> 03:19:08,850
Now we're not going to be looking at all of
them. Because most of these aren't really
2347
03:19:08,850 --> 03:19:10,439
useful. And they're not really used in everyday
life. But what I'm going to be doing is showing
2348
03:19:10,439 --> 03:19:13,380
you the main properties that you can use with
backgrounds that can really change how your
2349
03:19:13,380 --> 03:19:16,680
backgrounds look. So we're actually going
to be covering covering only two in this video.
2350
03:19:16,680 --> 03:19:21,300
So that's background size, and background
repeat. So the first thing I want to cover
2351
03:19:21,300 --> 03:19:26,750
is background repeat, because I think it's
the most important. So you can see we have
2352
03:19:26,750 --> 03:19:30,090
our background there, I already set the height
and width, don't worry about these values
2353
03:19:30,090 --> 03:19:33,020
or the properties or anything. Again, we'll
talk about those later in this in this course.
2354
03:19:33,020 --> 03:19:36,370
But for now, you can see that we have our
background here, which is actually inside
2355
03:19:36,370 --> 03:19:42,430
of a div. So I set the div height and width.
And now there's a background here. So I want
2356
03:19:42,430 --> 03:19:46,840
to mess around with this background and see
what I can do. So first of all, you'll notice
2357
03:19:46,840 --> 03:19:52,359
that we can see here that we have so for example,
two or three or four of the same image. And
2358
03:19:52,359 --> 03:19:56,630
pretty much what's happening is the image
is being repeated, so that it can fill up
2359
03:19:56,630 --> 03:20:00,930
all of the content space. Now this is done
by default, because again, all of the values
2360
03:20:00,930 --> 03:20:06,069
and pixels and the dimensions are absolute.
They're not like other programs where you
2361
03:20:06,069 --> 03:20:10,439
can just throw a picture on there, and it'll
automatically resize. When you're working
2362
03:20:10,439 --> 03:20:15,390
with web development. It takes those raw dimensions,
it just plugs them straight into the website.
2363
03:20:15,390 --> 03:20:23,449
So that's why we need to do a little bit of
styling. So you can see that this image is
2364
03:20:23,449 --> 03:20:27,300
big enough. And remember, because this is
a direct image, what's happening here is we
2365
03:20:27,300 --> 03:20:31,670
have an image tag, and then the image is just
being plugged straight in there. Whereas with
2366
03:20:31,670 --> 03:20:41,120
here, we don't actually have an image tag,
what we have is an empty div, which is just
2367
03:20:41,120 --> 03:20:51,110
think of it if you don't know what that is
think of it as a container. It has a width
2368
03:20:51,110 --> 03:20:56,890
and height of this much. But then this is
an empty box. All we're doing is filling it
2369
03:20:56,890 --> 03:21:03,590
with this image. So instead of plugging the
image straight in, we're just filling an empty
2370
03:21:03,590 --> 03:21:08,170
box with these images. And of course, the
image isn't big enough to fill it. So what
2371
03:21:08,170 --> 03:21:12,200
we have to do is or what HTML actually does
by default is repeat this. So if you don't
2372
03:21:12,200 --> 03:21:15,080
want that there is an easy way to fix it.
Now it's probably not going to give you the
2373
03:21:15,080 --> 03:21:19,090
result that you expected. But what you're
going to do is go ahead and say background
2374
03:21:19,090 --> 03:21:24,390
background, dash repeat Pretty much you can
either set this to no repeat, which is the
2375
03:21:24,390 --> 03:21:31,340
default. Or you Oh, sorry, no repeat is the
default. Yeah. So repeat is going to be the
2376
03:21:31,340 --> 03:21:37,450
default value. But if you want to set it to
no repeat, this is pretty much going to remove
2377
03:21:37,450 --> 03:21:44,899
that repeating property. Now, although it
might look like now this image is going to
2378
03:21:44,899 --> 03:21:49,960
cover the whole thing, watch what happens,
you can see that it only takes up that small
2379
03:21:49,960 --> 03:21:55,840
box. And this might look like it just resized
everything. But if I go ahead and add a background
2380
03:21:55,840 --> 03:22:03,230
color to this, like that, and I'm just gonna
say red. And I go ahead and refresh the page,
2381
03:22:03,230 --> 03:22:13,189
you can see what's actually happening here
is that we have the image, and it's not taking
2382
03:22:13,189 --> 03:22:23,520
up the full image if I go ahead and set this
to repeat.
2383
03:22:23,520 --> 03:22:38,439
just gonna link to it straight. So if I go
ahead and add the URL to the color, it's not
2384
03:22:38,439 --> 03:22:40,540
going to work, because this is specifically
for colors. Alright, so there we go. That's
2385
03:22:40,540 --> 03:22:45,760
pretty much it. For background images, it's
quite easy to use, all you have to do is make
2386
03:22:45,760 --> 03:22:55,260
sure that you have a working URL, you can
just test it by putting it in and seeing the
2387
03:22:55,260 --> 03:23:00,660
backroads loading properly. And from there,
just use your URL function and a suitable
2388
03:23:00,660 --> 03:23:05,770
property, such as background or background
image, and you should be good to go. Alright,
2389
03:23:05,770 --> 03:23:11,560
let's move on. So in this video, we're going
to be looking at some more background properties.
2390
03:23:11,560 --> 03:23:19,080
Now we're not going to be looking at all of
them. Because most of these aren't really
2391
03:23:19,080 --> 03:23:25,730
useful. And they're not really used in everyday
life. But what I'm going to be doing is showing
2392
03:23:25,730 --> 03:23:29,550
you the main properties that you can use with
backgrounds that can really change how your
2393
03:23:29,550 --> 03:23:34,479
backgrounds look. So we're actually going
to be covering covering only two in this video.
2394
03:23:34,479 --> 03:23:38,430
So that's background size, and background
repeat. So the first thing I want to cover
2395
03:23:38,430 --> 03:23:44,620
is background repeat, because I think it's
the most important. So you can see we have
2396
03:23:44,620 --> 03:23:49,590
our background there, I already set the height
and width, don't worry about these values
2397
03:23:49,590 --> 03:23:53,530
or the properties or anything. Again, we'll
talk about those later in this in this course.
2398
03:23:53,530 --> 03:23:59,770
But for now, you can see that we have our
background here, which is actually inside
2399
03:23:59,770 --> 03:24:09,189
of a div. So I set the div height and width.
And now there's a background here. So I want
2400
03:24:09,189 --> 03:24:14,080
to mess around with this background and see
what I can do. So first of all, you'll notice
2401
03:24:14,080 --> 03:24:20,609
that we can see here that we have so for example,
two or three or four of the same image. And
2402
03:24:20,609 --> 03:24:26,800
pretty much what's happening is the image
is being repeated, so that it can fill up
2403
03:24:26,800 --> 03:24:30,850
all of the content space. Now this is done
by default, because again, all of the values
2404
03:24:30,850 --> 03:24:34,199
and pixels and the dimensions are absolute.
They're not like other programs where you
2405
03:24:34,199 --> 03:24:39,250
can just throw a picture on there, and it'll
automatically resize. When you're working
2406
03:24:39,250 --> 03:24:46,300
with web development. It takes those raw dimensions,
it just plugs them straight into the website.
2407
03:24:46,300 --> 03:24:53,120
So that's why we need to do a little bit of
styling. So you can see that this image is
2408
03:24:53,120 --> 03:24:56,540
big enough. And remember, because this is
a direct image, what's happening here is we
2409
03:24:56,540 --> 03:25:00,680
have an image tag, and then the image is just
being plugged straight in there. Whereas with
2410
03:25:00,680 --> 03:25:05,130
here, we don't actually have an image tag,
what we have is an empty div, which is just
2411
03:25:05,130 --> 03:25:09,920
think of it if you don't know what that is
think of it as a container. It has a width
2412
03:25:09,920 --> 03:25:16,479
and height of this much. But then this is
an empty box. All we're doing is filling it
2413
03:25:16,479 --> 03:25:21,170
with this image. So instead of plugging the
image straight in, we're just filling an empty
2414
03:25:21,170 --> 03:25:29,330
box with these images. And of course, the
image isn't big enough to fill it. So what
2415
03:25:29,330 --> 03:25:31,920
we have to do is or what HTML actually does
by default is repeat this. So if you don't
2416
03:25:31,920 --> 03:25:37,950
want that there is an easy way to fix it.
Now it's probably not going to give you the
2417
03:25:37,950 --> 03:25:44,689
result that you expected. But what you're
going to do is go ahead and say background
2418
03:25:44,689 --> 03:25:51,739
background, dash repeat Pretty much you can
either set this to no repeat, which is the
2419
03:25:51,739 --> 03:25:55,460
default. Or you Oh, sorry, no repeat is the
default. Yeah. So repeat is going to be the
2420
03:25:55,460 --> 03:26:01,220
default value. But if you want to set it to
no repeat, this is pretty much going to remove
2421
03:26:01,220 --> 03:26:07,310
that repeating property. Now, although it
might look like now this image is going to
2422
03:26:07,310 --> 03:26:12,130
cover the whole thing, watch what happens,
you can see that it only takes up that small
2423
03:26:12,130 --> 03:26:18,399
box. And this might look like it just resized
everything. But if I go ahead and add a background
2424
03:26:18,399 --> 03:26:23,620
color to this, like that, and I'm just gonna
say red. And I go ahead and refresh the page,
2425
03:26:23,620 --> 03:26:28,640
you can see what's actually happening here
is that we have the image, and it's not taking
2426
03:26:28,640 --> 03:26:32,170
up the full image if I go ahead and set this
to repeat.
2427
03:26:32,170 --> 03:26:44,010
Now the background is taking up the full image.
So I'm actually just going to go ahead and
2428
03:26:44,010 --> 03:26:54,810
set this to a basic steel blue, I think that's
one of my favorite CSS named colors. So there
2429
03:26:54,810 --> 03:27:01,729
we go. Now that we know how to adjust the
repet repetition of these backgrounds, why
2430
03:27:01,729 --> 03:27:04,840
don't we go ahead and actually talk about
background size, because that's the important
2431
03:27:04,840 --> 03:27:10,060
one, that's going to allow us to fill this
whole container. So first of all, now that
2432
03:27:10,060 --> 03:27:15,910
we know the background repeat just changes,
if it repeats or not, we need to know how
2433
03:27:15,910 --> 03:27:21,000
to alter the size, we can do this using a
property called background size. So I'm going
2434
03:27:21,000 --> 03:27:25,041
to go ahead and actually erase this, we don't
need it for now, just like that. So you can
2435
03:27:25,041 --> 03:27:32,320
actually go ahead and set the size of the
background. And remember, depending on whether
2436
03:27:32,320 --> 03:27:38,630
you set it to repeat or not, this is going
to change your effect. So right now, it's
2437
03:27:38,630 --> 03:27:43,149
still on repeat since we removed that property.
But pretty much the way to manipulate this
2438
03:27:43,149 --> 03:27:48,550
is the first value is going to be the height.
So for example, let's say I wanted to take
2439
03:27:48,550 --> 03:27:52,670
up 50 pixels, then with a direct space, remember,
no commas nothing, you're going to then enter
2440
03:27:52,670 --> 03:27:58,460
the width. So I'm going to say maybe 100 pixels.
Let's go ahead and refresh now. And you can
2441
03:27:58,460 --> 03:28:02,680
see that because our repeat is actually off.
Sorry, our repeat is on, we can see that it
2442
03:28:02,680 --> 03:28:04,720
just keeps repeating until this whole space
is filled up. Now, obviously, it's going to
2443
03:28:04,720 --> 03:28:11,170
be pretty hard to get this exactly at the
dimensions. If I actually go ahead and set
2444
03:28:11,170 --> 03:28:13,970
this to 400 pixels. And 70%, we didn't really
talk about percentages much, you can see it's
2445
03:28:13,970 --> 03:28:18,359
still repeating. So it's very hard to get
this working in the way that you want it to
2446
03:28:18,359 --> 03:28:21,120
cover the whole thing exactly, even if you
use the direct values. So there's actually
2447
03:28:21,120 --> 03:28:24,470
a keyword that you can use to fix this up.
All you have to do is type cover here. So
2448
03:28:24,470 --> 03:28:29,369
if I go ahead and refresh, you can see now
the image takes up the full width. And although
2449
03:28:29,369 --> 03:28:32,570
it sacrifices the quality, pretty much what's
happening here is this cover value is going
2450
03:28:32,570 --> 03:28:35,710
to resize the image based on the dimensions
just right to that it fits this whole thing.
2451
03:28:35,710 --> 03:28:41,300
There's also one more keyword that you can
use, which is called contain. But the only
2452
03:28:41,300 --> 03:28:47,850
problem is with contain is it's going to resize
it as much as possible. The only problem is
2453
03:28:47,850 --> 03:28:53,210
it trying to resize it without messing with
the proportions. So let's say that this is
2454
03:28:53,210 --> 03:29:01,480
maybe a two to one ratio. So for every two
widths, there's one height. So let's just
2455
03:29:01,480 --> 03:29:06,870
use that as an example. Basically, what's
happening here is that no matter how much
2456
03:29:06,870 --> 03:29:11,370
you stretch this, you cannot go the full way
without stretching it off the screen. So contain
2457
03:29:11,370 --> 03:29:13,210
doesn't do that. Instead, it just repeats
the image. Now if we actually change this
2458
03:29:13,210 --> 03:29:19,830
back to cover, you can see that it does cut
off part of that image because it just stretches
2459
03:29:19,830 --> 03:29:28,399
it out the full way until the image color
or the background covers the full width. So
2460
03:29:28,399 --> 03:29:31,540
there you go. That's pretty much it for background
size. Now I would recommend going instead
2461
03:29:31,540 --> 03:29:35,600
not with the sizing option pixels, but instead
using the cover keyword or the contain keyword,
2462
03:29:35,600 --> 03:29:38,880
if you know that your proportions are right,
or if you need it for some other purpose.
2463
03:29:38,880 --> 03:29:43,020
So yeah, pretty much those are the two main
other background properties that you're going
2464
03:29:43,020 --> 03:29:50,390
to be using. Obviously, there's many more,
but they're not as useful. And they don't
2465
03:29:50,390 --> 03:29:57,050
really make as much of a difference as these
two. Alright, let's move on.
2466
03:29:57,050 --> 03:30:04,890
Now the background is taking up the full image.
So I'm actually just going to go ahead and
2467
03:30:04,890 --> 03:30:10,820
set this to a basic steel blue, I think that's
one of my favorite CSS named colors. So there
2468
03:30:10,820 --> 03:30:15,649
we go. Now that we know how to adjust the
repet repetition of these backgrounds, why
2469
03:30:15,649 --> 03:30:20,380
don't we go ahead and actually talk about
background size, because that's the important
2470
03:30:20,380 --> 03:30:24,982
one, that's going to allow us to fill this
whole container. So first of all, now that
2471
03:30:24,982 --> 03:30:29,569
we know the background repeat just changes,
if it repeats or not, we need to know how
2472
03:30:29,569 --> 03:30:37,060
to alter the size, we can do this using a
property called background size. So I'm going
2473
03:30:37,060 --> 03:30:43,230
to go ahead and actually erase this, we don't
need it for now, just like that. So you can
2474
03:30:43,230 --> 03:30:45,100
actually go ahead and set the size of the
background. And remember, depending on whether
2475
03:30:45,100 --> 03:30:49,989
you set it to repeat or not, this is going
to change your effect. So right now, it's
2476
03:30:49,989 --> 03:30:53,779
still on repeat since we removed that property.
But pretty much the way to manipulate this
2477
03:30:53,779 --> 03:30:58,200
is the first value is going to be the height.
So for example, let's say I wanted to take
2478
03:30:58,200 --> 03:31:01,100
up 50 pixels, then with a direct space, remember,
no commas nothing, you're going to then enter
2479
03:31:01,100 --> 03:31:05,140
the width. So I'm going to say maybe 100 pixels.
Let's go ahead and refresh now. And you can
2480
03:31:05,140 --> 03:31:11,279
see that because our repeat is actually off.
Sorry, our repeat is on, we can see that it
2481
03:31:11,279 --> 03:31:15,319
just keeps repeating until this whole space
is filled up. Now, obviously, it's going to
2482
03:31:15,319 --> 03:31:20,199
be pretty hard to get this exactly at the
dimensions. If I actually go ahead and set
2483
03:31:20,199 --> 03:31:25,529
this to 400 pixels. And 70%, we didn't really
talk about percentages much, you can see it's
2484
03:31:25,529 --> 03:31:29,530
still repeating. So it's very hard to get
this working in the way that you want it to
2485
03:31:29,530 --> 03:31:33,950
cover the whole thing exactly, even if you
use the direct values. So there's actually
2486
03:31:33,950 --> 03:31:38,833
a keyword that you can use to fix this up.
All you have to do is type cover here. So
2487
03:31:38,833 --> 03:31:42,529
if I go ahead and refresh, you can see now
the image takes up the full width. And although
2488
03:31:42,529 --> 03:31:52,300
it sacrifices the quality, pretty much what's
happening here is this cover value is going
2489
03:31:52,300 --> 03:31:58,479
to resize the image based on the dimensions
just right to that it fits this whole thing.
2490
03:31:58,479 --> 03:32:04,100
There's also one more keyword that you can
use, which is called contain. But the only
2491
03:32:04,100 --> 03:32:12,180
problem is with contain is it's going to resize
it as much as possible. The only problem is
2492
03:32:12,180 --> 03:32:16,229
it trying to resize it without messing with
the proportions. So let's say that this is
2493
03:32:16,229 --> 03:32:23,489
maybe a two to one ratio. So for every two
widths, there's one height. So let's just
2494
03:32:23,489 --> 03:32:29,460
use that as an example. Basically, what's
happening here is that no matter how much
2495
03:32:29,460 --> 03:32:35,450
you stretch this, you cannot go the full way
without stretching it off the screen. So contain
2496
03:32:35,450 --> 03:32:41,290
doesn't do that. Instead, it just repeats
the image. Now if we actually change this
2497
03:32:41,290 --> 03:32:47,830
back to cover, you can see that it does cut
off part of that image because it just stretches
2498
03:32:47,830 --> 03:32:54,949
it out the full way until the image color
or the background covers the full width. So
2499
03:32:54,949 --> 03:32:59,560
there you go. That's pretty much it for background
size. Now I would recommend going instead
2500
03:32:59,560 --> 03:33:04,811
not with the sizing option pixels, but instead
using the cover keyword or the contain keyword,
2501
03:33:04,811 --> 03:33:11,410
if you know that your proportions are right,
or if you need it for some other purpose.
2502
03:33:11,410 --> 03:33:14,510
So yeah, pretty much those are the two main
other background properties that you're going
2503
03:33:14,510 --> 03:33:19,569
to be using. Obviously, there's many more,
but they're not as useful. And they don't
2504
03:33:19,569 --> 03:33:27,060
really make as much of a difference as these
two. Alright, let's move on.
2505
03:33:27,060 --> 03:33:32,899
So in this video, we're going to be talking
a little bit more about RGB colors. But we're
2506
03:33:32,899 --> 03:33:37,040
actually going to be adding one more feature
to this. So right now we've talked about RGB,
2507
03:33:37,040 --> 03:33:41,660
which is our basic color set. We have a red,
a green and a blue. There's actually one more
2508
03:33:41,660 --> 03:33:45,420
that we're missing out on the can really improve
the quality of our colors. And that's a or
2509
03:33:45,420 --> 03:33:49,979
alpha. So right now you can see we have an
RGB color code. But what if we wanted to add
2510
03:33:49,979 --> 03:33:53,890
this mysterious alpha component? What will
we do? So I'm actually going to go ahead and
2511
03:33:53,890 --> 03:33:57,180
use it as the background. Well, the first
thing you need to do is change the RGB name
2512
03:33:57,180 --> 03:34:00,540
to RGB a. And in this way, we've completely
changed the way the color looks. Now if we
2513
03:34:00,540 --> 03:34:05,061
go ahead and refresh the page, nothing's changed.
But now we can actually manipulate that alpha
2514
03:34:05,061 --> 03:34:08,819
value. So all we have to do is after green
Sorry, blue, keep getting those two mixed
2515
03:34:08,819 --> 03:34:13,170
up. After the final value, you're gonna add
another comma. And here is where you can put
2516
03:34:13,170 --> 03:34:17,270
any value between zero and one. So now that
you know what you can do with it, alpha is
2517
03:34:17,270 --> 03:34:21,500
pretty much the transparency or opacity of
a color zero, meaning it's completely transparent,
2518
03:34:21,500 --> 03:34:28,500
you can't see it at all. And one, meaning
it's fully visible. Think of this in percentages.
2519
03:34:28,500 --> 03:34:34,319
For example, zero is 0%, and one is 100% 0.5,
would be 50%. So if you think of it that way,
2520
03:34:34,319 --> 03:34:38,101
you can really think about opacity in a much
easier way. So I'm going to go ahead and actually
2521
03:34:38,101 --> 03:34:43,479
set 0.4. So right now we're at zero or 40%
opacity. Now, if we refresh the page, you
2522
03:34:43,479 --> 03:34:47,970
can see that the color is still there, it's
just a lot lighter. Now, you're probably asking
2523
03:34:47,970 --> 03:34:53,520
like, why don't you just go and maybe make
the color lighter? Well, it's actually much
2524
03:34:53,520 --> 03:35:00,250
easier to control it this way. And on top
of that, if you want things like maybe fading,
2525
03:35:00,250 --> 03:35:06,080
or you want to maybe change a color fade into
a different one, you can't really just change
2526
03:35:06,080 --> 03:35:11,351
the color every time, because in animation,
it's much easier to just change the opacity,
2527
03:35:11,351 --> 03:35:14,980
reduce it or increase it, then change the
color every time. So it's also much easier
2528
03:35:14,980 --> 03:35:19,580
to use RGB a colors when you're trying to
just control the overall look of a color.
2529
03:35:19,580 --> 03:35:25,030
So usually, when you're using just simply
RGB colors, you can only get a certain look.
2530
03:35:25,030 --> 03:35:29,189
But once you add opacity into the mix, you
can completely change the way that it looks.
2531
03:35:29,189 --> 03:35:34,540
So pretty much here's the takeaway they're
supposed to take from this video, you can
2532
03:35:34,540 --> 03:35:41,899
have a fourth component to an RGB color, which
is a now this becomes an RGB a color. Now
2533
03:35:41,899 --> 03:35:48,061
this a value stands for alpha, or opacity
or transparency, whatever you want to call
2534
03:35:48,061 --> 03:35:54,200
it, then this value isn't like just from zero
to 255. Instead, you have to set a value between
2535
03:35:54,200 --> 03:35:59,600
zero and one. If you think of it in terms
of percentages, it becomes a lot easier, zero
2536
03:35:59,600 --> 03:36:03,229
being the no or zero, when there's no transparency,
sorry, when they're when it's fully transparent.
2537
03:36:03,229 --> 03:36:06,330
And then one being when it's completely visible.
Alright, so that's pretty much it for this
2538
03:36:06,330 --> 03:36:10,290
RGBA color scheme, it's very easy to use,
you don't really need to use a color picker.
2539
03:36:10,290 --> 03:36:14,830
For that, you can just think about how opaque
you want it. And from there, you can set your
2540
03:36:14,830 --> 03:36:15,870
value. All right, let's move on.
2541
03:36:15,870 --> 03:36:18,550
So in this video, we're going to be talking
a little bit more about RGB colors. But we're
2542
03:36:18,550 --> 03:36:22,870
actually going to be adding one more feature
to this. So right now we've talked about RGB,
2543
03:36:22,870 --> 03:36:27,859
which is our basic color set. We have a red,
a green and a blue. There's actually one more
2544
03:36:27,859 --> 03:36:34,359
that we're missing out on the can really improve
the quality of our colors. And that's a or
2545
03:36:34,359 --> 03:36:37,949
alpha. So right now you can see we have an
RGB color code. But what if we wanted to add
2546
03:36:37,949 --> 03:36:40,000
this mysterious alpha component? What will
we do? So I'm actually going to go ahead and
2547
03:36:40,000 --> 03:36:43,160
use it as the background. Well, the first
thing you need to do is change the RGB name
2548
03:36:43,160 --> 03:36:48,739
to RGB a. And in this way, we've completely
changed the way the color looks. Now if we
2549
03:36:48,739 --> 03:36:51,370
go ahead and refresh the page, nothing's changed.
But now we can actually manipulate that alpha
2550
03:36:51,370 --> 03:36:57,970
value. So all we have to do is after green
Sorry, blue, keep getting those two mixed
2551
03:36:57,970 --> 03:37:03,160
up. After the final value, you're gonna add
another comma. And here is where you can put
2552
03:37:03,160 --> 03:37:07,410
any value between zero and one. So now that
you know what you can do with it, alpha is
2553
03:37:07,410 --> 03:37:09,899
pretty much the transparency or opacity of
a color zero, meaning it's completely transparent,
2554
03:37:09,899 --> 03:37:13,780
you can't see it at all. And one, meaning
it's fully visible. Think of this in percentages.
2555
03:37:13,780 --> 03:37:21,000
For example, zero is 0%, and one is 100% 0.5,
would be 50%. So if you think of it that way,
2556
03:37:21,000 --> 03:37:26,820
you can really think about opacity in a much
easier way. So I'm going to go ahead and actually
2557
03:37:26,820 --> 03:37:30,109
set 0.4. So right now we're at zero or 40%
opacity. Now, if we refresh the page, you
2558
03:37:30,109 --> 03:37:38,260
can see that the color is still there, it's
just a lot lighter. Now, you're probably asking
2559
03:37:38,260 --> 03:37:44,600
like, why don't you just go and maybe make
the color lighter? Well, it's actually much
2560
03:37:44,600 --> 03:37:52,330
easier to control it this way. And on top
of that, if you want things like maybe fading,
2561
03:37:52,330 --> 03:37:58,030
or you want to maybe change a color fade into
a different one, you can't really just change
2562
03:37:58,030 --> 03:38:03,811
the color every time, because in animation,
it's much easier to just change the opacity,
2563
03:38:03,811 --> 03:38:10,180
reduce it or increase it, then change the
color every time. So it's also much easier
2564
03:38:10,180 --> 03:38:15,080
to use RGB a colors when you're trying to
just control the overall look of a color.
2565
03:38:15,080 --> 03:38:19,939
So usually, when you're using just simply
RGB colors, you can only get a certain look.
2566
03:38:19,939 --> 03:38:29,649
But once you add opacity into the mix, you
can completely change the way that it looks.
2567
03:38:29,649 --> 03:38:34,529
So pretty much here's the takeaway they're
supposed to take from this video, you can
2568
03:38:34,529 --> 03:38:44,290
have a fourth component to an RGB color, which
is a now this becomes an RGB a color. Now
2569
03:38:44,290 --> 03:38:48,870
this a value stands for alpha, or opacity
or transparency, whatever you want to call
2570
03:38:48,870 --> 03:38:56,340
it, then this value isn't like just from zero
to 255. Instead, you have to set a value between
2571
03:38:56,340 --> 03:39:02,510
zero and one. If you think of it in terms
of percentages, it becomes a lot easier, zero
2572
03:39:02,510 --> 03:39:07,649
being the no or zero, when there's no transparency,
sorry, when they're when it's fully transparent.
2573
03:39:07,649 --> 03:39:12,979
And then one being when it's completely visible.
Alright, so that's pretty much it for this
2574
03:39:12,979 --> 03:39:18,760
RGBA color scheme, it's very easy to use,
you don't really need to use a color picker.
2575
03:39:18,760 --> 03:39:25,779
For that, you can just think about how opaque
you want it. And from there, you can set your
2576
03:39:25,779 --> 03:39:27,640
value. All right, let's move on.
2577
03:39:27,640 --> 03:39:32,920
So in this video, this is going to be talking
about the last feature with using colors.
2578
03:39:32,920 --> 03:39:40,300
And it's a little bit hard to grasp at first.
But once you start using it, you can really
2579
03:39:40,300 --> 03:39:47,640
get used to it. So we're going to be working
with gradients in this video on for now, I'm
2580
03:39:47,640 --> 03:39:54,800
just going to go ahead and erase this background.
And I'm just going to have a single color.
2581
03:39:54,800 --> 03:39:59,159
So I'm just going to say steel blue. And I'm
going to also erase this color property. So
2582
03:39:59,159 --> 03:40:01,980
now we have a background of the steel blue
color. There we go. So now it's working. So
2583
03:40:01,980 --> 03:40:06,560
pretty much if you don't know what a gradient
is already, it's kind of a transition between
2584
03:40:06,560 --> 03:40:12,609
two colors. So it's not just a sharp, red
to blue in one go. It smoothly green, you
2585
03:40:12,609 --> 03:40:17,819
know, moves or diffuses from through the colors.
So for example, you start just completely
2586
03:40:17,819 --> 03:40:24,770
red. And then you move up along and as as
you go up, it gets more and more blue. So
2587
03:40:24,770 --> 03:40:30,120
you're sort of mixing between the two colors.
So if you've ever done any painting before,
2588
03:40:30,120 --> 03:40:35,989
you're used, maybe coloring pencils, if you
kind of use paint and draw between the two
2589
03:40:35,989 --> 03:40:40,479
colors, depending on the proportions between
them, it's going to make sort of a purple
2590
03:40:40,479 --> 03:40:45,810
ish, and then it transitions like that. So
pretty much that's what's going on here without
2591
03:40:45,810 --> 03:40:51,439
gradients is we're transitioning between two
colors. Now of course, you can do more than
2592
03:40:51,439 --> 03:40:58,189
two, you can put three, four, you can put
as many colors as you want. But pretty much
2593
03:40:58,189 --> 03:41:03,270
what you have to take away from this is that
a gradient is just a transition between a
2594
03:41:03,270 --> 03:41:08,930
number of colors. Okay, so now that we know
what a gradient is, let's go ahead and get
2595
03:41:08,930 --> 03:41:10,630
started adding them. So there are actually
two types of gradients, radial and linear.
2596
03:41:10,630 --> 03:41:15,060
So radial gradients are circular, they kind
of move outwards from a center. And depending
2597
03:41:15,060 --> 03:41:22,739
on the percentages or how much you want of
each color, it's going to change the way the
2598
03:41:22,739 --> 03:41:28,670
gradient looks. A linear gradient on the other
hand is the one that I described earlier,
2599
03:41:28,670 --> 03:41:34,390
a smooth red transition to blue, it could
go from left to right, top to bottom and even
2600
03:41:34,390 --> 03:41:40,279
diagonally depending on how we define the
direction later in this video when we start
2601
03:41:40,279 --> 03:41:43,979
creating our gradients, alright, let's get
started. So the first thing I want to work
2602
03:41:43,979 --> 03:41:51,080
with is linear gradients. So the way to do
this just with our RGBA or a URL, all we have
2603
03:41:51,080 --> 03:41:56,650
to do is type linear dash gradient. Just like
that. And from here, we can start defining
2604
03:41:56,650 --> 03:42:01,899
our directions. So if you don't already know
about directions already, pretty much there
2605
03:42:01,899 --> 03:42:08,850
are four different positions top, bottom,
left and right. And you can also combine the
2606
03:42:08,850 --> 03:42:14,590
two to create corners. So for example, top
right would be the top right corner. So first
2607
03:42:14,590 --> 03:42:21,359
of all, what you're going to want to do is
type two. And then you're going to say the
2608
03:42:21,359 --> 03:42:26,699
name of the direction. So in this case, I'm
just going to say two, right. So what this
2609
03:42:26,699 --> 03:42:34,090
is going to be saying is you want the grid
to move to the right side. So it's going to
2610
03:42:34,090 --> 03:42:38,800
be going this way. Now, there's also another
way to do this I'll talk about in just a second.
2611
03:42:38,800 --> 03:42:42,909
But for now, let's leave it like this. And
then after your comma, you're going to add
2612
03:42:42,909 --> 03:42:47,229
as many colors as you want. So in this case,
I'm going to add red, and blue. And remember
2613
03:42:47,229 --> 03:42:51,830
to separate them also by a comma. Let's go
ahead and refresh and see what's happening,
2614
03:42:51,830 --> 03:42:58,620
you can see that we have a red slowly transitioning
into a blue to the right side. So remember,
2615
03:42:58,620 --> 03:43:06,521
it starts with the first color and moves on.
Let's go ahead and add a green in there, and
2616
03:43:06,521 --> 03:43:11,620
then a steel blue, and then a blue. Now we
have four colors that are slowly transitioning,
2617
03:43:11,620 --> 03:43:24,270
we have a red, that slowly transition into
a green, and then a steel blue, you can sort
2618
03:43:24,270 --> 03:43:32,920
of see it there and then a blue. And just
saying we don't actually have to use these
2619
03:43:32,920 --> 03:43:38,550
name colors, I just wanted to use them because
it looked it was quite easy to look at. So
2620
03:43:38,550 --> 03:43:46,520
what we can actually do and here's your first
use for Opacity is you can go ahead and let's
2621
03:43:46,520 --> 03:43:50,689
just take a random color here. So to write
Remember, this is starting here, we're going
2622
03:43:50,689 --> 03:43:54,610
to paste in that color. But then we're going
to finish it with an RGB a color,
2623
03:43:54,610 --> 03:44:00,770
So in this video, this is going to be talking
about the last feature with using colors.
2624
03:44:00,770 --> 03:44:05,380
And it's a little bit hard to grasp at first.
But once you start using it, you can really
2625
03:44:05,380 --> 03:44:11,550
get used to it. So we're going to be working
with gradients in this video on for now, I'm
2626
03:44:11,550 --> 03:44:16,830
just going to go ahead and erase this background.
And I'm just going to have a single color.
2627
03:44:16,830 --> 03:44:21,690
So I'm just going to say steel blue. And I'm
going to also erase this color property. So
2628
03:44:21,690 --> 03:44:27,090
now we have a background of the steel blue
color. There we go. So now it's working. So
2629
03:44:27,090 --> 03:44:34,120
pretty much if you don't know what a gradient
is already, it's kind of a transition between
2630
03:44:34,120 --> 03:44:39,060
two colors. So it's not just a sharp, red
to blue in one go. It smoothly green, you
2631
03:44:39,060 --> 03:44:43,399
know, moves or diffuses from through the colors.
So for example, you start just completely
2632
03:44:43,399 --> 03:44:49,800
red. And then you move up along and as as
you go up, it gets more and more blue. So
2633
03:44:49,800 --> 03:44:54,290
you're sort of mixing between the two colors.
So if you've ever done any painting before,
2634
03:44:54,290 --> 03:45:02,330
you're used, maybe coloring pencils, if you
kind of use paint and draw between the two
2635
03:45:02,330 --> 03:45:06,500
colors, depending on the proportions between
them, it's going to make sort of a purple
2636
03:45:06,500 --> 03:45:13,080
ish, and then it transitions like that. So
pretty much that's what's going on here without
2637
03:45:13,080 --> 03:45:18,250
gradients is we're transitioning between two
colors. Now of course, you can do more than
2638
03:45:18,250 --> 03:45:26,020
two, you can put three, four, you can put
as many colors as you want. But pretty much
2639
03:45:26,020 --> 03:45:30,250
what you have to take away from this is that
a gradient is just a transition between a
2640
03:45:30,250 --> 03:45:36,380
number of colors. Okay, so now that we know
what a gradient is, let's go ahead and get
2641
03:45:36,380 --> 03:45:42,180
started adding them. So there are actually
two types of gradients, radial and linear.
2642
03:45:42,180 --> 03:45:46,540
So radial gradients are circular, they kind
of move outwards from a center. And depending
2643
03:45:46,540 --> 03:45:51,280
on the percentages or how much you want of
each color, it's going to change the way the
2644
03:45:51,280 --> 03:45:57,870
gradient looks. A linear gradient on the other
hand is the one that I described earlier,
2645
03:45:57,870 --> 03:46:03,521
a smooth red transition to blue, it could
go from left to right, top to bottom and even
2646
03:46:03,521 --> 03:46:08,830
diagonally depending on how we define the
direction later in this video when we start
2647
03:46:08,830 --> 03:46:16,000
creating our gradients, alright, let's get
started. So the first thing I want to work
2648
03:46:16,000 --> 03:46:22,830
with is linear gradients. So the way to do
this just with our RGBA or a URL, all we have
2649
03:46:22,830 --> 03:46:32,699
to do is type linear dash gradient. Just like
that. And from here, we can start defining
2650
03:46:32,699 --> 03:46:35,520
our directions. So if you don't already know
about directions already, pretty much there
2651
03:46:35,520 --> 03:46:39,500
are four different positions top, bottom,
left and right. And you can also combine the
2652
03:46:39,500 --> 03:46:44,200
two to create corners. So for example, top
right would be the top right corner. So first
2653
03:46:44,200 --> 03:46:48,940
of all, what you're going to want to do is
type two. And then you're going to say the
2654
03:46:48,940 --> 03:46:53,819
name of the direction. So in this case, I'm
just going to say two, right. So what this
2655
03:46:53,819 --> 03:47:02,840
is going to be saying is you want the grid
to move to the right side. So it's going to
2656
03:47:02,840 --> 03:47:09,449
be going this way. Now, there's also another
way to do this I'll talk about in just a second.
2657
03:47:09,449 --> 03:47:15,899
But for now, let's leave it like this. And
then after your comma, you're going to add
2658
03:47:15,899 --> 03:47:23,830
as many colors as you want. So in this case,
I'm going to add red, and blue. And remember
2659
03:47:23,830 --> 03:47:31,699
to separate them also by a comma. Let's go
ahead and refresh and see what's happening,
2660
03:47:31,699 --> 03:47:40,859
you can see that we have a red slowly transitioning
into a blue to the right side. So remember,
2661
03:47:40,859 --> 03:47:46,010
it starts with the first color and moves on.
Let's go ahead and add a green in there, and
2662
03:47:46,010 --> 03:47:52,850
then a steel blue, and then a blue. Now we
have four colors that are slowly transitioning,
2663
03:47:52,850 --> 03:47:59,330
we have a red, that slowly transition into
a green, and then a steel blue, you can sort
2664
03:47:59,330 --> 03:48:08,100
of see it there and then a blue. And just
saying we don't actually have to use these
2665
03:48:08,100 --> 03:48:16,729
name colors, I just wanted to use them because
it looked it was quite easy to look at. So
2666
03:48:16,729 --> 03:48:22,810
what we can actually do and here's your first
use for Opacity is you can go ahead and let's
2667
03:48:22,810 --> 03:48:27,640
just take a random color here. So to write
Remember, this is starting here, we're going
2668
03:48:27,640 --> 03:48:33,240
to paste in that color. But then we're going
to finish it with an RGB a color,
2669
03:48:33,240 --> 03:48:38,640
like that. And pretty much what's what's going
to happen is this is going to be a slowly
2670
03:48:38,640 --> 03:48:42,360
fading out color, just like this. So you can
see what's happening is we start with a fully
2671
03:48:42,360 --> 03:48:47,470
functional color, which has a full track or
a has no transparency at all. And we slowly
2672
03:48:47,470 --> 03:48:54,710
slowly make it fade more and more out until
we can't see the picture at all, or the color
2673
03:48:54,710 --> 03:48:58,920
in this case. So yeah, that's pretty much
a great way of looking at it. And that's pretty
2674
03:48:58,920 --> 03:49:03,180
much it for linear gradients. Let's talk about
actually making diagonal gradients now. So
2675
03:49:03,180 --> 03:49:08,189
we know that we can have to write, we can
also have to top for example, if you wanted
2676
03:49:08,189 --> 03:49:13,640
to start from the start from the bottom, just
like that. And you can see now it goes up.
2677
03:49:13,640 --> 03:49:17,660
But what if we wanted to make it diagonal.
So let's say we wanted to finish in the bottom
2678
03:49:17,660 --> 03:49:22,010
right corner, what you would do is just type
it out like this to bottom right. Now if we
2679
03:49:22,010 --> 03:49:24,680
refresh the page, you can see that it slowly
goes down and fades out just at the bottom
2680
03:49:24,680 --> 03:49:27,910
right. So there we go. That's pretty much
it for positioning. But there's actually another
2681
03:49:27,910 --> 03:49:30,300
way to do this, and it's through angles. So
if you don't already know how to use angles,
2682
03:49:30,300 --> 03:49:32,710
then you can pretty much skip this step because
it's quite hard to get the use of it. But
2683
03:49:32,710 --> 03:49:40,479
once you learn how to actually work with angles,
and you know how to, you know, move them around
2684
03:49:40,479 --> 03:49:54,770
things like that, it becomes very easy to
work with them. So let's say you wanted them
2685
03:49:54,770 --> 03:50:01,510
to go in a very specific direction. So for
example, you wanted it to end somewhere here.
2686
03:50:01,510 --> 03:50:08,350
Now, obviously, you can't use words for positioning,
because they only work at certain places such
2687
03:50:08,350 --> 03:50:16,069
as the corners. So if you wanted to do this,
you're going to have to go ahead and use angles.
2688
03:50:16,069 --> 03:50:22,319
So first thing I'm going to do is go ahead
and erase this part because we're not using
2689
03:50:22,319 --> 03:50:31,439
positioning, and then we're going to go ahead
and type our angle. So the first thing I'm
2690
03:50:31,439 --> 03:50:39,540
going to do is define the place that I wanted
to end. So let's say this time I wanted to
2691
03:50:39,540 --> 03:50:46,000
add on the left here. So what I'm going to
do is go ahead and say minus 90, because remember
2692
03:50:46,000 --> 03:50:57,430
what's happening here is we want it to just
flip completely around. So let's say this
2693
03:50:57,430 --> 03:51:04,582
is our starting angle is zero, and we go all
the way down minus 90. So if you don't already
2694
03:51:04,582 --> 03:51:09,960
know 90 is kind of a quarter turn. And what's
going to happen is from here, we can type
2695
03:51:09,960 --> 03:51:15,819
D, G, or degrees. And this is going to set
the angle that we wanted. So let's go ahead
2696
03:51:15,819 --> 03:51:19,949
and refresh the page. You can see that now
it goes from right to left. Now this is a
2697
03:51:19,949 --> 03:51:24,330
pretty bad example considering we can just
do this normally, by typing to left. Well,
2698
03:51:24,330 --> 03:51:30,040
why don't we go ahead and choose something
a little bit more specific. So I'm going to
2699
03:51:30,040 --> 03:51:33,859
go 146 degrees. So just remember that pointing
upwards is kind of the starting position.
2700
03:51:33,859 --> 03:51:41,439
And then we turn 90 degrees, and then just
a little bit over halfway. And I think that's
2701
03:51:41,439 --> 03:51:48,710
not a very good example. So I'm going to go
with 160. Now you can see once I refresh the
2702
03:51:48,710 --> 03:51:53,590
page that it ends, sort of around the corner,
but not exactly on. And if I actually go ahead
2703
03:51:53,590 --> 03:52:01,359
and add something like maybe 215 or something
like that, go ahead and refresh, you can see
2704
03:52:01,359 --> 03:52:03,550
that they are ending in different places,
it's a lot more specific. Now, it's not very
2705
03:52:03,550 --> 03:52:06,684
obvious with this kind of fading color. But
what's happening here is we can directly control
2706
03:52:06,684 --> 03:52:11,750
where we want our gradient to end. So that's
one way of using linear gradients. Now let's
2707
03:52:11,750 --> 03:52:17,180
go ahead and talk about the next type of gradient,
which are radial gradients. So first of all,
2708
03:52:17,180 --> 03:52:22,350
I'm just going to erase this whole thing here
because I don't really need it. Now, radial
2709
03:52:22,350 --> 03:52:27,470
gradients don't work in the same way that
linear ones do instead of having a specified
2710
03:52:27,470 --> 03:52:32,109
direction. So for example, you want to go
from Right to left or from top to bottom,
2711
03:52:32,109 --> 03:52:36,210
instead, what happens is we can actually define
the percentages or proportions of each color
2712
03:52:36,210 --> 03:52:42,730
that we want. The next thing I'm going to
talk about is actually this background size.
2713
03:52:42,730 --> 03:52:49,659
So one thing you need to note is that you
cannot specify the cover, background size
2714
03:52:49,659 --> 03:52:55,200
or anything like that for these radial gradients,
because they just won't work. So what we're
2715
03:52:55,200 --> 03:52:59,670
gonna have to do is go ahead and remove this.
There we go. Now let's go ahead and add our
2716
03:52:59,670 --> 03:53:03,489
radial gradient. So I'm going to go ahead
and type radio dash gradient,
2717
03:53:03,489 --> 03:53:12,130
like that. And pretty much what's what's going
to happen is this is going to be a slowly
2718
03:53:12,130 --> 03:53:20,070
fading out color, just like this. So you can
see what's happening is we start with a fully
2719
03:53:20,070 --> 03:53:24,140
functional color, which has a full track or
a has no transparency at all. And we slowly
2720
03:53:24,140 --> 03:53:28,689
slowly make it fade more and more out until
we can't see the picture at all, or the color
2721
03:53:28,689 --> 03:53:34,510
in this case. So yeah, that's pretty much
a great way of looking at it. And that's pretty
2722
03:53:34,510 --> 03:53:39,340
much it for linear gradients. Let's talk about
actually making diagonal gradients now. So
2723
03:53:39,340 --> 03:53:45,029
we know that we can have to write, we can
also have to top for example, if you wanted
2724
03:53:45,029 --> 03:53:50,630
to start from the start from the bottom, just
like that. And you can see now it goes up.
2725
03:53:50,630 --> 03:53:53,100
But what if we wanted to make it diagonal.
So let's say we wanted to finish in the bottom
2726
03:53:53,100 --> 03:53:59,560
right corner, what you would do is just type
it out like this to bottom right. Now if we
2727
03:53:59,560 --> 03:54:05,920
refresh the page, you can see that it slowly
goes down and fades out just at the bottom
2728
03:54:05,920 --> 03:54:14,390
right. So there we go. That's pretty much
it for positioning. But there's actually another
2729
03:54:14,390 --> 03:54:19,720
way to do this, and it's through angles. So
if you don't already know how to use angles,
2730
03:54:19,720 --> 03:54:24,020
then you can pretty much skip this step because
it's quite hard to get the use of it. But
2731
03:54:24,020 --> 03:54:27,500
once you learn how to actually work with angles,
and you know how to, you know, move them around
2732
03:54:27,500 --> 03:54:31,670
things like that, it becomes very easy to
work with them. So let's say you wanted them
2733
03:54:31,670 --> 03:54:35,760
to go in a very specific direction. So for
example, you wanted it to end somewhere here.
2734
03:54:35,760 --> 03:54:40,330
Now, obviously, you can't use words for positioning,
because they only work at certain places such
2735
03:54:40,330 --> 03:54:46,500
as the corners. So if you wanted to do this,
you're going to have to go ahead and use angles.
2736
03:54:46,500 --> 03:54:51,030
So first thing I'm going to do is go ahead
and erase this part because we're not using
2737
03:54:51,030 --> 03:54:55,630
positioning, and then we're going to go ahead
and type our angle. So the first thing I'm
2738
03:54:55,630 --> 03:55:01,160
going to do is define the place that I wanted
to end. So let's say this time I wanted to
2739
03:55:01,160 --> 03:55:06,870
add on the left here. So what I'm going to
do is go ahead and say minus 90, because remember
2740
03:55:06,870 --> 03:55:12,110
what's happening here is we want it to just
flip completely around. So let's say this
2741
03:55:12,110 --> 03:55:19,180
is our starting angle is zero, and we go all
the way down minus 90. So if you don't already
2742
03:55:19,180 --> 03:55:26,080
know 90 is kind of a quarter turn. And what's
going to happen is from here, we can type
2743
03:55:26,080 --> 03:55:34,130
D, G, or degrees. And this is going to set
the angle that we wanted. So let's go ahead
2744
03:55:34,130 --> 03:55:40,430
and refresh the page. You can see that now
it goes from right to left. Now this is a
2745
03:55:40,430 --> 03:55:46,689
pretty bad example considering we can just
do this normally, by typing to left. Well,
2746
03:55:46,689 --> 03:55:51,560
why don't we go ahead and choose something
a little bit more specific. So I'm going to
2747
03:55:51,560 --> 03:55:55,500
go 146 degrees. So just remember that pointing
upwards is kind of the starting position.
2748
03:55:55,500 --> 03:55:58,820
And then we turn 90 degrees, and then just
a little bit over halfway. And I think that's
2749
03:55:58,820 --> 03:56:03,229
not a very good example. So I'm going to go
with 160. Now you can see once I refresh the
2750
03:56:03,229 --> 03:56:05,780
page that it ends, sort of around the corner,
but not exactly on. And if I actually go ahead
2751
03:56:05,780 --> 03:56:12,479
and add something like maybe 215 or something
like that, go ahead and refresh, you can see
2752
03:56:12,479 --> 03:56:16,979
that they are ending in different places,
it's a lot more specific. Now, it's not very
2753
03:56:16,979 --> 03:56:23,500
obvious with this kind of fading color. But
what's happening here is we can directly control
2754
03:56:23,500 --> 03:56:30,069
where we want our gradient to end. So that's
one way of using linear gradients. Now let's
2755
03:56:30,069 --> 03:56:35,640
go ahead and talk about the next type of gradient,
which are radial gradients. So first of all,
2756
03:56:35,640 --> 03:56:43,190
I'm just going to erase this whole thing here
because I don't really need it. Now, radial
2757
03:56:43,190 --> 03:56:48,380
gradients don't work in the same way that
linear ones do instead of having a specified
2758
03:56:48,380 --> 03:56:53,600
direction. So for example, you want to go
from Right to left or from top to bottom,
2759
03:56:53,600 --> 03:57:00,500
instead, what happens is we can actually define
the percentages or proportions of each color
2760
03:57:00,500 --> 03:57:06,330
that we want. The next thing I'm going to
talk about is actually this background size.
2761
03:57:06,330 --> 03:57:10,310
So one thing you need to note is that you
cannot specify the cover, background size
2762
03:57:10,310 --> 03:57:15,420
or anything like that for these radial gradients,
because they just won't work. So what we're
2763
03:57:15,420 --> 03:57:20,760
gonna have to do is go ahead and remove this.
There we go. Now let's go ahead and add our
2764
03:57:20,760 --> 03:57:23,230
radial gradient. So I'm going to go ahead
and type radio dash gradient,
2765
03:57:23,230 --> 03:57:27,330
just like that. And now what we can do is
specify a certain amount of colors. So for
2766
03:57:27,330 --> 03:57:30,360
example, I'm just going to start out with
red and blue. Now if we refresh the page,
2767
03:57:30,360 --> 03:57:32,550
you can see it starts off red, and ends and
blue. But we can actually add more than two
2768
03:57:32,550 --> 03:57:36,540
colors, just like with our, our linear gradient
there, what we can actually do is go ahead
2769
03:57:36,540 --> 03:57:42,750
and type in let's For example, let's just
say green as an example. Now if we refresh
2770
03:57:42,750 --> 03:57:47,390
the page, you can see that we've added a third
color. Now, if we wanted to change the proportions,
2771
03:57:47,390 --> 03:57:53,620
so for example, let's pretend that this blue
is taking up too much space, we don't want
2772
03:57:53,620 --> 03:57:58,674
that much, we can actually specify how much
we want of each. So let's change the proportions,
2773
03:57:58,674 --> 03:58:07,290
what we can do is go ahead and add percentages.
So what I'm going to do first is go and specify
2774
03:58:07,290 --> 03:58:11,110
what I want here. Now one thing to note is
that these have to be in order, you have to
2775
03:58:11,110 --> 03:58:15,979
have the minimum percentage, or the smallest
percentage at the start, and then the largest
2776
03:58:15,979 --> 03:58:22,029
at the finish. So I'm going to go ahead and
start off with something small, like 20%,
2777
03:58:22,029 --> 03:58:29,250
then I'm going to have let's say 40%, blue,
and 55% green. So now if I go ahead and refresh
2778
03:58:29,250 --> 03:58:41,451
the page, you can see that there is a lot
more green and a lot less blue, and red. So
2779
03:58:41,451 --> 03:58:45,659
the final thing I want to cover for radial
gradients is the shape. Now you can actually
2780
03:58:45,659 --> 03:58:50,180
specify the shape that you want. Now right
now I have an ellipse or sort of oval shape,
2781
03:58:50,180 --> 03:58:54,770
we can actually change it, all we have to
do is type the name of the shape. Now there
2782
03:58:54,770 --> 03:59:00,890
are two values, you can put here ellipse,
which is the default, and circle, I'm going
2783
03:59:00,890 --> 03:59:10,460
to go ahead and type circle. Now if I go ahead
and refresh, you can see that this is in a
2784
03:59:10,460 --> 03:59:14,149
much more circular shape, rather than the
previous oval. And although it's not a perfect
2785
03:59:14,149 --> 03:59:17,840
circle, obviously, our proportions aren't
going to change what it looks like. Alright,
2786
03:59:17,840 --> 03:59:23,040
so that's pretty much it for gradients. There's
quite a lot to learn about these. And there's
2787
03:59:23,040 --> 03:59:27,430
a lot more features that you can cover. But
for now, I think this is great. Now what I'm
2788
03:59:27,430 --> 03:59:32,420
going to do is go ahead and just create another
gradient, another linear gradient right under
2789
03:59:32,420 --> 03:59:37,410
this one, just so you can see what it looks
like. So for example, I'm going to go ahead,
2790
03:59:37,410 --> 03:59:48,110
and maybe let's just go for the body background
for now, I'm going to go ahead and actually
2791
03:59:48,110 --> 03:59:56,380
add a linear gradient gradient here. And I'm
going to say, let's just say to bottom, because
2792
03:59:56,380 --> 04:00:01,920
again, we wanted this kind of stretch from
top to bottom. So now what we're going to
2793
04:00:01,920 --> 04:00:08,229
do is start off very strong. So we're going
to have our main RGBA color, or RGB, whoops,
2794
04:00:08,229 --> 04:00:15,880
our main color here. So I'm going to copy
this. So this is going to be a fully, fully
2795
04:00:15,880 --> 04:00:23,400
visible color, starting from the top, and
then we're going to end with a much less visible
2796
04:00:23,400 --> 04:00:28,990
color. So there you go. Now let's go ahead
and refresh the page. And you can see that
2797
04:00:28,990 --> 04:00:35,260
maybe there's a little bit of an error there.
Oh, yeah, forgot to spell it. There we go.
2798
04:00:35,260 --> 04:00:38,989
Now we can go ahead and refresh. And you can
see it's still not working so much errors,
2799
04:00:38,989 --> 04:00:44,550
you're probably Yep, forgot the got the parentheses
there. Just make sure that you're doing this,
2800
04:00:44,550 --> 04:00:51,359
right, because sometimes you can make some
silly errors. So for example, if you look
2801
04:00:51,359 --> 04:00:59,710
here, we were actually we were missing a bracket.
So now if we go ahead and refresh, there we
2802
04:00:59,710 --> 04:01:07,620
go. It's a lot better now. So we start off
with a nice, fully visible color, and we end
2803
04:01:07,620 --> 04:01:12,250
off with a less visible color. Alright, so
there we go. That's pretty much it for gradients,
2804
04:01:12,250 --> 04:01:15,739
you can go ahead and download this file from
the project, you can go ahead and look at
2805
04:01:15,739 --> 04:01:19,659
how everything works here, mess around with
it, see what you can do, because there is
2806
04:01:19,659 --> 04:01:22,520
a lot to gradients and although they're not
used everyday, they're still very useful tools,
2807
04:01:22,520 --> 04:01:26,830
and they can really help you out in your web
development careers. Alright, let's move on.
2808
04:01:26,830 --> 04:01:32,280
just like that. And now what we can do is
specify a certain amount of colors. So for
2809
04:01:32,280 --> 04:01:37,949
example, I'm just going to start out with
red and blue. Now if we refresh the page,
2810
04:01:37,949 --> 04:01:43,920
you can see it starts off red, and ends and
blue. But we can actually add more than two
2811
04:01:43,920 --> 04:01:47,239
colors, just like with our, our linear gradient
there, what we can actually do is go ahead
2812
04:01:47,239 --> 04:01:57,350
and type in let's For example, let's just
say green as an example. Now if we refresh
2813
04:01:57,350 --> 04:02:02,670
the page, you can see that we've added a third
color. Now, if we wanted to change the proportions,
2814
04:02:02,670 --> 04:02:06,739
so for example, let's pretend that this blue
is taking up too much space, we don't want
2815
04:02:06,739 --> 04:02:12,100
that much, we can actually specify how much
we want of each. So let's change the proportions,
2816
04:02:12,100 --> 04:02:18,270
what we can do is go ahead and add percentages.
So what I'm going to do first is go and specify
2817
04:02:18,270 --> 04:02:28,939
what I want here. Now one thing to note is
that these have to be in order, you have to
2818
04:02:28,939 --> 04:02:37,100
have the minimum percentage, or the smallest
percentage at the start, and then the largest
2819
04:02:37,100 --> 04:02:47,310
at the finish. So I'm going to
go ahead and start off with something small,
2820
04:02:47,310 --> 04:02:57,010
like 20%, then I'm going to have let's say
40%, blue, and 55% green. So now if I go ahead
2821
04:02:57,010 --> 04:03:04,020
and refresh the page, you can see that there
is a lot more green and a lot less blue, and
2822
04:03:04,020 --> 04:03:10,450
red. So the final thing I want to cover for
radial gradients is the shape. Now you can
2823
04:03:10,450 --> 04:03:21,960
actually specify the shape that you want.
Now right now I have an ellipse or sort of
2824
04:03:21,960 --> 04:03:27,090
oval shape, we can actually change it, all
we have to do is type the name of the shape.
2825
04:03:27,090 --> 04:03:38,529
Now there are two values, you can put here
ellipse, which is the default, and circle,
2826
04:03:38,529 --> 04:03:46,770
I'm going to go ahead and type circle. Now
if I go ahead and refresh, you can see that
2827
04:03:46,770 --> 04:03:52,340
this is in a much more circular shape, rather
than the previous oval. And although it's
2828
04:03:52,340 --> 04:03:57,500
not a perfect circle, obviously, our proportions
aren't going to change what it looks like.
2829
04:03:57,500 --> 04:04:01,740
Alright, so that's pretty much it for gradients.
There's quite a lot to learn about these.
2830
04:04:01,740 --> 04:04:08,940
And there's a lot more features that you can
cover. But for now, I think this is great.
2831
04:04:08,940 --> 04:04:16,720
Now what I'm going to do is go ahead and just
create another gradient, another linear gradient
2832
04:04:16,720 --> 04:04:24,250
right under this one, just so you can see
what it looks like. So for example, I'm going
2833
04:04:24,250 --> 04:04:31,560
to go ahead, and maybe let's just go for the
body background for now, I'm going to go ahead
2834
04:04:31,560 --> 04:04:35,149
and actually add a linear gradient gradient
here. And I'm going to say, let's just say
2835
04:04:35,149 --> 04:04:39,069
to bottom, because again, we wanted this kind
of stretch from top to bottom. So now what
2836
04:04:39,069 --> 04:04:43,360
we're going to do is start off very strong.
So we're going to have our main RGBA color,
2837
04:04:43,360 --> 04:04:50,380
or RGB, whoops, our main color here. So I'm
going to copy this. So this is going to be
2838
04:04:50,380 --> 04:04:56,660
a fully, fully visible color, starting from
the top, and then we're going to end with
2839
04:04:56,660 --> 04:05:02,180
a much less visible color. So there you go.
Now let's go ahead and refresh the page. And
2840
04:05:02,180 --> 04:05:06,939
you can see that maybe there's a little bit
of an error there. Oh, yeah, forgot to spell
2841
04:05:06,939 --> 04:05:11,060
it. There we go. Now we can go ahead and refresh.
And you can see it's still not working so
2842
04:05:11,060 --> 04:05:14,710
much errors, you're probably Yep, forgot the
got the parentheses there. Just make sure
2843
04:05:14,710 --> 04:05:18,880
that you're doing this, right, because sometimes
you can make some silly errors. So for example,
2844
04:05:18,880 --> 04:05:23,500
if you look here, we were actually we were
missing a bracket. So now if we go ahead and
2845
04:05:23,500 --> 04:05:27,270
refresh, there we go. It's a lot better now.
So we start off with a nice, fully visible
2846
04:05:27,270 --> 04:05:31,340
color, and we end off with a less visible
color. Alright, so there we go. That's pretty
2847
04:05:31,340 --> 04:05:35,870
much it for gradients, you can go ahead and
download this file from the project, you can
2848
04:05:35,870 --> 04:05:42,609
go ahead and look at how everything works
here, mess around with it, see what you can
2849
04:05:42,609 --> 04:05:47,040
do, because there is a lot to gradients and
although they're not used everyday, they're
2850
04:05:47,040 --> 04:05:51,239
still very useful tools, and they can really
help you out in your web development careers.
2851
04:05:51,239 --> 04:05:52,319
Alright, let's move on.
2852
04:05:52,319 --> 04:05:56,609
So in this video, we're going to be talking
about some of the different types of units
2853
04:05:56,609 --> 04:06:01,250
in CSS. So so far, we've been working with
some basic coloring techniques, we've learned
2854
04:06:01,250 --> 04:06:05,580
about selectors, and then different properties.
And then we've learned about some of these
2855
04:06:05,580 --> 04:06:10,170
different values, but we haven't actually
learned what all of these different things
2856
04:06:10,170 --> 04:06:13,730
mean this this PX this percentage, and we
don't actually know how they work. So what
2857
04:06:13,730 --> 04:06:21,720
I'm going to be doing today is talking about
some of the different types of units and how
2858
04:06:21,720 --> 04:06:25,390
you can identify which one to use. So first
thing I want to talk about is the difference
2859
04:06:25,390 --> 04:06:29,540
between the two types of units which are absolute
units, and rarely have units. So firstly,
2860
04:06:29,540 --> 04:06:34,120
we have to talk about some of the units we've
already been using, for example, pixels. Now
2861
04:06:34,120 --> 04:06:37,720
pixels is a little bit special, I'll explain
you. I'll explain it to you in just a second.
2862
04:06:37,720 --> 04:06:41,510
But pretty much the commonly used absolute
units are things like centimeters, millimeters
2863
04:06:41,510 --> 04:06:46,670
and inches, which are absolute, they it's
not dependent on anything else. If you set
2864
04:06:46,670 --> 04:06:48,439
it as one inch, it's going to be one inch
long, no matter if you're doing it on a phone,
2865
04:06:48,439 --> 04:06:52,430
or an ultra wide TV. So that's what absolute
units are, they aren't affected by anything
2866
04:06:52,430 --> 04:06:57,439
around them. The second group are relative
units. And these are a little bit different.
2867
04:06:57,439 --> 04:07:03,260
Relative units are usually dependent on something.
So for example, our percentage unit here is
2868
04:07:03,260 --> 04:07:06,779
dependent on the parent elements while unit.
So for example, if this service image here
2869
04:07:06,779 --> 04:07:10,700
or here, has a width of 70%, that means that
the parent element of this service image or
2870
04:07:10,700 --> 04:07:16,980
this service image right here, which in this
case is our body, take 70% of its width of
2871
04:07:16,980 --> 04:07:21,680
its total width. So the whole way through
of the body is 100%. And 70% is going to be
2872
04:07:21,680 --> 04:07:26,409
somewhere around here, because that's what
we set it as now notice that when I start
2873
04:07:26,409 --> 04:07:32,290
resizing this, you can see that it still takes
up 70%. And obviously, right now it doesn't
2874
04:07:32,290 --> 04:07:36,739
work because I haven't refreshed the page.
But you can see, no matter how small I make
2875
04:07:36,739 --> 04:07:42,500
it, it's only going to take up 70% of the
total body width. So this is really good for
2876
04:07:42,500 --> 04:07:44,990
something like a responsive design. Because
what happens is when you're using absolute
2877
04:07:44,990 --> 04:07:49,280
units in a responsive design, let's say you
set this width as 200 pixels on a phone, it's
2878
04:07:49,280 --> 04:07:56,130
going to appear very large, whereas on an
ultra wide TV, it's going to appear too small.
2879
04:07:56,130 --> 04:08:00,920
So using something like percentages would
be very useful, because then you could resize
2880
04:08:00,920 --> 04:08:06,729
your window here, however you like it and
still have that look that you want. So that's
2881
04:08:06,729 --> 04:08:10,369
pretty much it for percentages. But there's
also a lot of different relative values that
2882
04:08:10,369 --> 04:08:17,710
we can use. And I'm going to go through all
of these in just a second. But the first thing
2883
04:08:17,710 --> 04:08:21,659
I want to talk about is this special unit,
which is pixels. Now pixels is a little bit
2884
04:08:21,659 --> 04:08:24,100
different. Now, although it is considered
an absolute unit, it is actually relatively
2885
04:08:24,100 --> 04:08:27,659
scale based on what device you're on. So if
you don't already know your screen right now
2886
04:08:27,659 --> 04:08:35,330
that you're watching this video on is made
up of a bunch of little tiny pixels. Now there's
2887
04:08:35,330 --> 04:08:39,290
this concept in computing, it's called DPI,
it's pretty much used to calculate the resolution
2888
04:08:39,290 --> 04:08:43,390
of your screen. And depending on the number
of pixels you have, the resolution is going
2889
04:08:43,390 --> 04:08:48,220
to change. So on low DPI, tablets or things
like that, anything that has a very low resolution.
2890
04:08:48,220 --> 04:08:52,340
So for example, if you're on YouTube, and
you've changed your resolution to four ADP,
2891
04:08:52,340 --> 04:08:58,290
what's going to happen is then the video is
going to sort of adjust how many pixels are
2892
04:08:58,290 --> 04:09:04,640
in that video. Now, I'm not going to get too
deep into how pixels are changed and things
2893
04:09:04,640 --> 04:09:10,640
like that. But pretty much what happens is
on high resolution devices, these pixels aren't
2894
04:09:10,640 --> 04:09:14,220
going to appear the same as on low resolution
devices, because obviously, this is taking
2895
04:09:14,220 --> 04:09:17,890
up only 400 pixels of height. And if you have
an ultra high display a very high definition
2896
04:09:17,890 --> 04:09:22,590
TV 400 pixels is only going to be about half
of what it is here. So what actually happens
2897
04:09:22,590 --> 04:09:28,199
in this is on these high DPI displays, each
pixel in this unit is actually taking up multiple
2898
04:09:28,199 --> 04:09:37,000
pixels relative to the resolution of the display.
So for example, on a TV, every pixel, according
2899
04:09:37,000 --> 04:09:41,950
to this height would actually take up something
like four pixels. So this is to give it that
2900
04:09:41,950 --> 04:09:49,029
absolute illusion. Now although it is in theory,
or at its core relative, when you're when
2901
04:09:49,029 --> 04:09:54,210
you're actually using it, it is an absolute
value. So that's just one thing you need to
2902
04:09:54,210 --> 04:09:58,739
keep in mind. Now don't worry too much about
pixels, you know, redefinitions, things like
2903
04:09:58,739 --> 04:10:05,080
that. But we're not focusing on that. For
now, we're just focusing on how we can use
2904
04:10:05,080 --> 04:10:11,520
different values for different things. So
let's go ahead and cover some of the different
2905
04:10:11,520 --> 04:10:18,910
units that we can use for absolute unit. So
the easiest way to do this is through changing
2906
04:10:18,910 --> 04:10:24,239
the size of the text. Now again, we're going
to cover this much later in this section.
2907
04:10:24,239 --> 04:10:30,609
So don't worry about that too much. So the
first one we can use is centimeters. So I
2908
04:10:30,609 --> 04:10:34,199
can see the font size is two centimeters.
Now, if I refresh the page, you can see that
2909
04:10:34,199 --> 04:10:40,530
it is a lot bigger. Remember, if you actually
took a ruler and measured the font size, you
2910
04:10:40,530 --> 04:10:44,010
would get two centimeters. There's also many
more such as millimeters and inches and pretty
2911
04:10:44,010 --> 04:10:48,430
much everything in between. So you can see
that's also a lot smaller. So we have our
2912
04:10:48,430 --> 04:10:52,939
standard pixels here, but there's actually
a few more that we can use. Now they're not
2913
04:10:52,939 --> 04:10:59,620
very they're not used that commonly so I'm
not really going to go over them that much.
2914
04:10:59,620 --> 04:11:05,760
But there Is he there, there are some other
units that you can use instead of pixels that
2915
04:11:05,760 --> 04:11:08,359
kind of follow that same formula. So there
is something called PT, which are points,
2916
04:11:08,359 --> 04:11:12,489
and it's a little bit bigger than a pixel.
So if I go ahead and refresh that, you can
2917
04:11:12,489 --> 04:11:17,920
see that that actually gets a little bit taller.
Go ahead and change that back to pixels, you
2918
04:11:17,920 --> 04:11:25,380
can see that does get quite a little bit taller.
And there's also PC. Again, it's quite similar
2919
04:11:25,380 --> 04:11:37,060
to px and PT. But in this case, a PC is a
lot bigger. So you can see how much bigger
2920
04:11:37,060 --> 04:11:43,350
it actually is. Actually, one PC is 12 points.
So that's just shows you how much bigger it
2921
04:11:43,350 --> 04:11:53,450
is. So there we go. That's just a little bit
of some of the other absolute values. Now
2922
04:11:53,450 --> 04:11:58,930
let's cover relative values. So the first
one, the first one that we actually already
2923
04:11:58,930 --> 04:12:04,400
covered was percentage. So we already looked
at, you know, our percent symbol over here,
2924
04:12:04,400 --> 04:12:10,170
which pretty much takes up, again, a certain
size or whatever value of its parent element.
2925
04:12:10,170 --> 04:12:16,779
But there's actually many more that I want
to cover. The first one I'm going to look
2926
04:12:16,779 --> 04:12:23,390
at is E M. So pretty much what if what I do
here is it's going to represent the size relative
2927
04:12:23,390 --> 04:12:28,199
to the current standard font size. So let's
just pretend that we know that this font size
2928
04:12:28,199 --> 04:12:34,920
is value, let's just call it F, what's going
to happen is if we set the body font size
2929
04:12:34,920 --> 04:12:39,920
to two, em, you're going to double everything
or double it based on F, which is our font
2930
04:12:39,920 --> 04:12:49,140
size. So if I set to em here, just like that,
and go ahead and refresh the page, you can
2931
04:12:49,140 --> 04:12:55,580
see that all of the text is double the standard
font size. So again, this is completely relative
2932
04:12:55,580 --> 04:13:01,310
to the standard font size. So I'm actually
going to go ahead and erase this here and
2933
04:13:01,310 --> 04:13:06,240
start using style tags. Instead, I feel like
it's just going to be a lot easier to you
2934
04:13:06,240 --> 04:13:10,529
know, move around and easy, easily move that
around. So now we've covered percent an EM
2935
04:13:10,529 --> 04:13:16,080
so those are the two main types of relative
units. But there's actually two more that
2936
04:13:16,080 --> 04:13:21,120
I want to cover, which is view width and view
height. So in web design, and in development,
2937
04:13:21,120 --> 04:13:26,550
in general, there's this thing called the
viewport, which is pretty much the dimensions
2938
04:13:26,550 --> 04:13:30,619
of whatever you're viewing it on. So in this
case, our viewport would be the bodies width,
2939
04:13:30,619 --> 04:13:34,340
and then the bodies height. So VW and VH,
view, view width and view height actually
2940
04:13:34,340 --> 04:13:35,540
allow you to work with
2941
04:13:35,540 --> 04:13:42,790
So in this video, we're going to be talking
about some of the different types of units
2942
04:13:42,790 --> 04:13:51,460
in CSS. So so far, we've been working with
some basic coloring techniques, we've learned
2943
04:13:51,460 --> 04:13:55,949
about selectors, and then different properties.
And then we've learned about some of these
2944
04:13:55,949 --> 04:13:58,470
different values, but we haven't actually
learned what all of these different things
2945
04:13:58,470 --> 04:14:00,189
mean this this PX this percentage, and we
don't actually know how they work. So what
2946
04:14:00,189 --> 04:14:04,530
I'm going to be doing today is talking about
some of the different types of units and how
2947
04:14:04,530 --> 04:14:11,439
you can identify which one to use. So first
thing I want to talk about is the difference
2948
04:14:11,439 --> 04:14:15,279
between the two types of units which are absolute
units, and rarely have units. So firstly,
2949
04:14:15,279 --> 04:14:20,500
we have to talk about some of the units we've
already been using, for example, pixels. Now
2950
04:14:20,500 --> 04:14:23,710
pixels is a little bit special, I'll explain
you. I'll explain it to you in just a second.
2951
04:14:23,710 --> 04:14:26,340
But pretty much the commonly used absolute
units are things like centimeters, millimeters
2952
04:14:26,340 --> 04:14:27,380
and inches, which are absolute, they it's
not dependent on anything else. If you set
2953
04:14:27,380 --> 04:14:31,260
it as one inch, it's going to be one inch
long, no matter if you're doing it on a phone,
2954
04:14:31,260 --> 04:14:36,520
or an ultra wide TV. So that's what absolute
units are, they aren't affected by anything
2955
04:14:36,520 --> 04:14:40,210
around them. The second group are relative
units. And these are a little bit different.
2956
04:14:40,210 --> 04:14:44,300
Relative units are usually dependent on something.
So for example, our percentage unit here is
2957
04:14:44,300 --> 04:14:48,380
dependent on the parent elements while unit.
So for example, if this service image here
2958
04:14:48,380 --> 04:14:53,890
or here, has a width of 70%, that means that
the parent element of this service image or
2959
04:14:53,890 --> 04:15:01,720
this service image right here, which in this
case is our body, take 70% of its width of
2960
04:15:01,720 --> 04:15:10,970
its total width. So the whole way through
of the body is 100%. And 70% is going to be
2961
04:15:10,970 --> 04:15:17,220
somewhere around here, because that's what
we set it as now notice that when I start
2962
04:15:17,220 --> 04:15:22,580
resizing this, you can see that it still takes
up 70%. And obviously, right now it doesn't
2963
04:15:22,580 --> 04:15:28,370
work because I haven't refreshed the page.
But you can see, no matter how small I make
2964
04:15:28,370 --> 04:15:39,620
it, it's only going to take up 70% of the
total body width. So this is really good for
2965
04:15:39,620 --> 04:15:43,949
something like a responsive design. Because
what happens is when you're using absolute
2966
04:15:43,949 --> 04:15:49,949
units in a responsive design, let's say you
set this width as 200 pixels on a phone, it's
2967
04:15:49,949 --> 04:15:54,410
going to appear very large, whereas on an
ultra wide TV, it's going to appear too small.
2968
04:15:54,410 --> 04:15:58,390
So using something like percentages would
be very useful, because then you could resize
2969
04:15:58,390 --> 04:16:03,430
your window here, however you like it and
still have that look that you want. So that's
2970
04:16:03,430 --> 04:16:06,979
pretty much it for percentages. But there's
also a lot of different relative values that
2971
04:16:06,979 --> 04:16:14,300
we can use. And I'm going to go through all
of these in just a second. But the first thing
2972
04:16:14,300 --> 04:16:18,409
I want to talk about is this special unit,
which is pixels. Now pixels is a little bit
2973
04:16:18,409 --> 04:16:22,100
different. Now, although it is considered
an absolute unit, it is actually relatively
2974
04:16:22,100 --> 04:16:26,920
scale based on what device you're on. So if
you don't already know your screen right now
2975
04:16:26,920 --> 04:16:32,040
that you're watching this video on is made
up of a bunch of little tiny pixels. Now there's
2976
04:16:32,040 --> 04:16:34,319
this concept in computing, it's called DPI,
it's pretty much used to calculate the resolution
2977
04:16:34,319 --> 04:16:37,430
of your screen. And depending on the number
of pixels you have, the resolution is going
2978
04:16:37,430 --> 04:16:42,600
to change. So on low DPI, tablets or things
like that, anything that has a very low resolution.
2979
04:16:42,600 --> 04:16:44,890
So for example, if you're on YouTube, and
you've changed your resolution to four ADP,
2980
04:16:44,890 --> 04:16:50,180
what's going to happen is then the video is
going to sort of adjust how many pixels are
2981
04:16:50,180 --> 04:16:54,580
in that video. Now, I'm not going to get too
deep into how pixels are changed and things
2982
04:16:54,580 --> 04:16:57,430
like that. But pretty much what happens is
on high resolution devices, these pixels aren't
2983
04:16:57,430 --> 04:16:59,069
going to appear the same as on low resolution
devices, because obviously, this is taking
2984
04:16:59,069 --> 04:17:02,479
up only 400 pixels of height. And if you have
an ultra high display a very high definition
2985
04:17:02,479 --> 04:17:06,400
TV 400 pixels is only going to be about half
of what it is here. So what actually happens
2986
04:17:06,400 --> 04:17:11,920
in this is on these high DPI displays, each
pixel in this unit is actually taking up multiple
2987
04:17:11,920 --> 04:17:17,119
pixels relative to the resolution of the display.
So for example, on a TV, every pixel, according
2988
04:17:17,119 --> 04:17:23,290
to this height would actually take up something
like four pixels. So this is to give it that
2989
04:17:23,290 --> 04:17:27,609
absolute illusion. Now although it is in theory,
or at its core relative, when you're when
2990
04:17:27,609 --> 04:17:32,790
you're actually using it, it is an absolute
value. So that's just one thing you need to
2991
04:17:32,790 --> 04:17:37,920
keep in mind. Now don't worry too much about
pixels, you know, redefinitions, things like
2992
04:17:37,920 --> 04:17:43,729
that. But we're not focusing on that. For
now, we're just focusing on how we can use
2993
04:17:43,729 --> 04:17:48,029
different values for different things. So
let's go ahead and cover some of the different
2994
04:17:48,029 --> 04:17:56,989
units that we can use for absolute unit. So
the easiest way to do this is through changing
2995
04:17:56,989 --> 04:18:00,080
the size of the text. Now again, we're going
to cover this much later in this section.
2996
04:18:00,080 --> 04:18:02,160
So don't worry about that too much. So the
first one we can use is centimeters. So I
2997
04:18:02,160 --> 04:18:04,050
can see the font size is two centimeters.
Now, if I refresh the page, you can see that
2998
04:18:04,050 --> 04:18:07,890
it is a lot bigger. Remember, if you actually
took a ruler and measured the font size, you
2999
04:18:07,890 --> 04:18:10,790
would get two centimeters. There's also many
more such as millimeters and inches and pretty
3000
04:18:10,790 --> 04:18:14,470
much everything in between. So you can see
that's also a lot smaller. So we have our
3001
04:18:14,470 --> 04:18:19,560
standard pixels here, but there's actually
a few more that we can use. Now they're not
3002
04:18:19,560 --> 04:18:24,340
very they're not used that commonly so I'm
not really going to go over them that much.
3003
04:18:24,340 --> 04:18:33,170
But there Is he there, there are some other
units that you can use instead of pixels that
3004
04:18:33,170 --> 04:18:38,140
kind of follow that same formula. So there
is something called PT, which are points,
3005
04:18:38,140 --> 04:18:40,950
and it's a little bit bigger than a pixel.
So if I go ahead and refresh that, you can
3006
04:18:40,950 --> 04:18:43,779
see that that actually gets a little bit taller.
Go ahead and change that back to pixels, you
3007
04:18:43,779 --> 04:18:48,439
can see that does get quite a little bit taller.
And there's also PC. Again, it's quite similar
3008
04:18:48,439 --> 04:18:54,600
to px and PT. But in this case, a PC is a
lot bigger. So you can see how much bigger
3009
04:18:54,600 --> 04:18:58,390
it actually is. Actually, one PC is 12 points.
So that's just shows you how much bigger it
3010
04:18:58,390 --> 04:19:02,390
is. So there we go. That's just a little bit
of some of the other absolute values. Now
3011
04:19:02,390 --> 04:19:07,130
let's cover relative values. So the first
one, the first one that we actually already
3012
04:19:07,130 --> 04:19:10,600
covered was percentage. So we already looked
at, you know, our percent symbol over here,
3013
04:19:10,600 --> 04:19:15,930
which pretty much takes up, again, a certain
size or whatever value of its parent element.
3014
04:19:15,930 --> 04:19:20,640
But there's actually many more that I want
to cover. The first one I'm going to look
3015
04:19:20,640 --> 04:19:27,850
at is E M. So pretty much what if what I do
here is it's going to represent the size relative
3016
04:19:27,850 --> 04:19:32,500
to the current standard font size. So let's
just pretend that we know that this font size
3017
04:19:32,500 --> 04:19:37,970
is value, let's just call it F, what's going
to happen is if we set the body font size
3018
04:19:37,970 --> 04:19:42,630
to two, em, you're going to double everything
or double it based on F, which is our font
3019
04:19:42,630 --> 04:19:48,290
size. So if I set to em here, just like that,
and go ahead and refresh the page, you can
3020
04:19:48,290 --> 04:19:56,260
see that all of the text is double the standard
font size. So again, this is completely relative
3021
04:19:56,260 --> 04:19:58,680
to the standard font size. So I'm actually
going to go ahead and erase this here and
3022
04:19:58,680 --> 04:20:10,659
start using style tags. Instead, I feel like
it's just going to be a lot easier to you
3023
04:20:10,659 --> 04:20:15,040
know, move around and easy, easily move that
around. So now we've covered percent an EM
3024
04:20:15,040 --> 04:20:19,660
so those are the two main types of relative
units. But there's actually two more that
3025
04:20:19,660 --> 04:20:26,140
I want to cover, which is view width and view
height. So in web design, and in development,
3026
04:20:26,140 --> 04:20:30,020
in general, there's this thing called the
viewport, which is pretty much the dimensions
3027
04:20:30,020 --> 04:20:35,220
of whatever you're viewing it on. So in this
case, our viewport would be the bodies width,
3028
04:20:35,220 --> 04:20:39,500
and then the bodies height. So VW and VH,
view, view width and view height actually
3029
04:20:39,500 --> 04:20:40,880
allow you to work with
3030
04:20:40,880 --> 04:20:47,529
work with this viewport in a very easy way.
So one v w or v h is equal to 1% of the total
3031
04:20:47,529 --> 04:20:52,630
body width or body height. So remember, this
isn't based on the parent element, this is
3032
04:20:52,630 --> 04:20:57,020
based on the total viewport, this could be
the HTML document the body tag, it depends
3033
04:20:57,020 --> 04:21:03,430
on what you're viewing it on. So for example,
if I go ahead and change the width here to
3034
04:21:03,430 --> 04:21:07,600
70 v w, this is pretty much equivalent to
70 times 1% of the total viewport. And obviously,
3035
04:21:07,600 --> 04:21:12,520
if I go ahead and refresh the page, you can
see it gets just a little bit bigger because
3036
04:21:12,520 --> 04:21:16,520
there's actually a viewport itself is bigger
than the body tag, which is the parent element.
3037
04:21:16,520 --> 04:21:24,640
Now we'll talk about that later in the course,
because it's quite advanced. But what you
3038
04:21:24,640 --> 04:21:33,279
can see here is that right here, it doesn't
actually affect it because the body is almost
3039
04:21:33,279 --> 04:21:39,470
completely equivalent to the viewport. But
for example, if we wanted to set the font
3040
04:21:39,470 --> 04:21:47,180
size of one of these TDs to 70% would be which
we, which would be 70% of this T row, it would
3041
04:21:47,180 --> 04:21:52,810
actually look completely different from 70
v w, which is 70% of the total viewport. So
3042
04:21:52,810 --> 04:21:58,040
that's just one thing I want to keep in mind,
you can also set more than 100%, it doesn't
3043
04:21:58,040 --> 04:22:03,369
have to be completely set in stone. So if
I actually wanted to say VH. So 400 times
3044
04:22:03,369 --> 04:22:11,869
1% of the view height, what would happen here
is that this image would become four times
3045
04:22:11,869 --> 04:22:20,270
the total height of the viewport. So that's
just also one thing to keep in mind. So I'm
3046
04:22:20,270 --> 04:22:25,859
going to go ahead and change this back to
pixels. We'll just keep that with the same
3047
04:22:25,859 --> 04:22:31,790
because it doesn't really make that much of
an impact. Okay, so there we go. Those are
3048
04:22:31,790 --> 04:22:36,080
some of the different units in CSS, I've actually
attached a little reference sheet that you
3049
04:22:36,080 --> 04:22:40,149
can use, you can refer to, to this to this
lecture, you can go ahead click on it. And
3050
04:22:40,149 --> 04:22:44,870
if you want to revise any of these you can,
but just a fair warning, you're not really
3051
04:22:44,870 --> 04:22:52,529
going to be using a lot of these units, the
main ones you're going to use, you're most
3052
04:22:52,529 --> 04:22:57,439
likely pixels and percent. But for some cases,
you're going to want to use some other units.
3053
04:22:57,439 --> 04:23:01,460
So although absolute units are still useful
in some cases, so for example, if you want
3054
04:23:01,460 --> 04:23:06,930
a very specific dimensions or viewport on
your screen, so for example, if you only want
3055
04:23:06,930 --> 04:23:13,279
users to access something on the phone, then
or a very specific phone, then you can go
3056
04:23:13,279 --> 04:23:18,010
ahead and use pixels because it's going to
look the same no matter what phone people
3057
04:23:18,010 --> 04:23:23,939
use, because it's all going to be the same.
The only problem is is when people start using
3058
04:23:23,939 --> 04:23:27,870
different devices using absolute values are
going to look very different based on On what
3059
04:23:27,870 --> 04:23:33,569
device you're using. And that's why you should
kind of stick to using these, these relative
3060
04:23:33,569 --> 04:23:36,770
units instead of using things like pixels,
centimeters and millimeters. So things like
3061
04:23:36,770 --> 04:23:40,080
em percent view width and view height would
be very, very useful, because then you can
3062
04:23:40,080 --> 04:23:45,390
scale it based on whatever device you want.
So for example, it's going to look the same,
3063
04:23:45,390 --> 04:23:47,810
or at least this width, whether you're using
it on a phone, or a desktop computer, because
3064
04:23:47,810 --> 04:23:52,170
again, it takes up 70% of the width no matter
what it is. So that's just some of the basics
3065
04:23:52,170 --> 04:23:57,930
about some of these units. Now, like I said,
you don't need to know these by heart, you
3066
04:23:57,930 --> 04:24:06,100
can just go ahead and keep them at the back
of your head. And once we start using them
3067
04:24:06,100 --> 04:24:10,869
and start using them in our, you know, font
layout, things like that, we'll actually start
3068
04:24:10,869 --> 04:24:15,620
using these units a lot more, and they will
make a lot more sense. So this is just a quick
3069
04:24:15,620 --> 04:24:19,760
introduction to these units and why we should
use them. And you're not supposed to be going
3070
04:24:19,760 --> 04:24:24,029
ahead and you know, completely mastering every
single one by now. Alright, let's move on.
3071
04:24:24,029 --> 04:24:29,580
work with this viewport in a very easy way.
So one v w or v h is equal to 1% of the total
3072
04:24:29,580 --> 04:24:33,220
body width or body height. So remember, this
isn't based on the parent element, this is
3073
04:24:33,220 --> 04:24:39,450
based on the total viewport, this could be
the HTML document the body tag, it depends
3074
04:24:39,450 --> 04:24:43,619
on what you're viewing it on. So for example,
if I go ahead and change the width here to
3075
04:24:43,619 --> 04:24:49,370
70 v w, this is pretty much equivalent to
70 times 1% of the total viewport. And obviously,
3076
04:24:49,370 --> 04:24:54,210
if I go ahead and refresh the page, you can
see it gets just a little bit bigger because
3077
04:24:54,210 --> 04:25:02,159
there's actually a viewport itself is bigger
than the body tag, which is the parent element.
3078
04:25:02,159 --> 04:25:13,780
Now we'll talk about that later in the course,
because it's quite advanced. But what you
3079
04:25:13,780 --> 04:25:18,260
can see here is that right here, it doesn't
actually affect it because the body is almost
3080
04:25:18,260 --> 04:25:24,680
completely equivalent to the viewport. But
for example, if we wanted to set the font
3081
04:25:24,680 --> 04:25:31,530
size of one of these TDs to 70% would be which
we, which would be 70% of this T row, it would
3082
04:25:31,530 --> 04:25:36,380
actually look completely different from 70
v w, which is 70% of the total viewport. So
3083
04:25:36,380 --> 04:25:39,080
that's just one thing I want to keep in mind,
you can also set more than 100%, it doesn't
3084
04:25:39,080 --> 04:25:44,050
have to be completely set in stone. So if
I actually wanted to say VH. So 400 times
3085
04:25:44,050 --> 04:25:50,939
1% of the view height, what would happen here
is that this image would become four times
3086
04:25:50,939 --> 04:25:57,390
the total height of the viewport. So that's
just also one thing to keep in mind. So I'm
3087
04:25:57,390 --> 04:25:59,510
going to go ahead and change this back to
pixels. We'll just keep that with the same
3088
04:25:59,510 --> 04:26:04,760
because it doesn't really make that much of
an impact. Okay, so there we go. Those are
3089
04:26:04,760 --> 04:26:09,699
some of the different units in CSS, I've actually
attached a little reference sheet that you
3090
04:26:09,699 --> 04:26:14,210
can use, you can refer to, to this to this
lecture, you can go ahead click on it. And
3091
04:26:14,210 --> 04:26:20,859
if you want to revise any of these you can,
but just a fair warning, you're not really
3092
04:26:20,859 --> 04:26:26,199
going to be using a lot of these units, the
main ones you're going to use, you're most
3093
04:26:26,199 --> 04:26:31,909
likely pixels and percent. But for some cases,
you're going to want to use some other units.
3094
04:26:31,909 --> 04:26:38,180
So although absolute units are still useful
in some cases, so for example, if you want
3095
04:26:38,180 --> 04:26:42,890
a very specific dimensions or viewport on
your screen, so for example, if you only want
3096
04:26:42,890 --> 04:26:47,979
users to access something on the phone, then
or a very specific phone, then you can go
3097
04:26:47,979 --> 04:26:57,180
ahead and use pixels because it's going to
look the same no matter what phone people
3098
04:26:57,180 --> 04:27:05,590
use, because it's all going to be the same.
The only problem is is when people start using
3099
04:27:05,590 --> 04:27:10,300
different devices using absolute values are
going to look very different based on On what
3100
04:27:10,300 --> 04:27:15,659
device you're using. And that's why you should
kind of stick to using these, these relative
3101
04:27:15,659 --> 04:27:21,729
units instead of using things like pixels,
centimeters and millimeters. So things like
3102
04:27:21,729 --> 04:27:27,560
em percent view width and view height would
be very, very useful, because then you can
3103
04:27:27,560 --> 04:27:32,640
scale it based on whatever device you want.
So for example, it's going to look the same,
3104
04:27:32,640 --> 04:27:39,130
or at least this width, whether you're using
it on a phone, or a desktop computer, because
3105
04:27:39,130 --> 04:27:46,979
again, it takes up 70% of the width no matter
what it is. So that's just some of the basics
3106
04:27:46,979 --> 04:27:51,720
about some of these units. Now, like I said,
you don't need to know these by heart, you
3107
04:27:51,720 --> 04:27:57,710
can just go ahead and keep them at the back
of your head. And once we start using them
3108
04:27:57,710 --> 04:28:03,659
and start using them in our, you know, font
layout, things like that, we'll actually start
3109
04:28:03,659 --> 04:28:09,200
using these units a lot more, and they will
make a lot more sense. So this is just a quick
3110
04:28:09,200 --> 04:28:13,369
introduction to these units and why we should
use them. And you're not supposed to be going
3111
04:28:13,369 --> 04:28:17,050
ahead and you know, completely mastering every
single one by now. Alright, let's move on.
3112
04:28:17,050 --> 04:28:30,250
So the next few videos are going to be focused
on font and text manipulation. So we're going
3113
04:28:30,250 --> 04:28:34,640
to be working with actually changing how this
text looks. First thing I want to talk about
3114
04:28:34,640 --> 04:28:38,109
is there's actually two parts to this section,
text manipulation and font manipulation. And
3115
04:28:38,109 --> 04:28:42,819
although they sound like the same thing, they're
actually very different. So the first part
3116
04:28:42,819 --> 04:28:45,940
in this video, we're going to be covering
text manipulation. Now, there's not that much
3117
04:28:45,940 --> 04:28:51,750
to look at. But pretty much the difference
between the two is that text manipulation
3118
04:28:51,750 --> 04:28:56,439
is looking at things that you can change no
matter the font. So for example, something
3119
04:28:56,439 --> 04:29:01,420
like sizing would not apply, because the size
is going to be based obviously on the font
3120
04:29:01,420 --> 04:29:04,910
itself. So basically, things like underlining
or capitalization are going to be completely
3121
04:29:04,910 --> 04:29:10,439
regardless of the font, you can change them
no matter what they do. But things like bolding
3122
04:29:10,439 --> 04:29:15,189
and things like size, bolding, things like
that, they are completely dependent on the
3123
04:29:15,189 --> 04:29:20,100
font, because again, the font decides how
it how the font itself is going to look. So
3124
04:29:20,100 --> 04:29:27,409
it decides the size, the bolding, and just
the overall style. So the first part in this
3125
04:29:27,409 --> 04:29:34,770
video, we're going to be covering text manipulation.
And in the next few videos, we're going to
3126
04:29:34,770 --> 04:29:37,939
be looking at actual font manipulation. So
things like external fonts, which is probably
3127
04:29:37,939 --> 04:29:41,990
the most exciting part of this course, and
things like weight and bolding. Alright, let's
3128
04:29:41,990 --> 04:29:47,409
get started. So the first two things I want
to cover are text decoration and text transform.
3129
04:29:47,409 --> 04:29:55,420
So these are properties that are going to
be relating to the style of the text. Now
3130
04:29:55,420 --> 04:30:01,870
I know I just said that fonts. And mostly
styling is dependent on the font. But in this
3131
04:30:01,870 --> 04:30:11,199
case, these these properties don't actually
rely on the font at all. So let's get started.
3132
04:30:11,199 --> 04:30:14,590
So the first thing I'm going to talk about
is text decoration. So although it sounds
3133
04:30:14,590 --> 04:30:21,069
like you can do a bunch of cool things with
this, the only real thing that you can do
3134
04:30:21,069 --> 04:30:28,280
is change the lining of the text. So we're
going to go ahead and work with this anchor
3135
04:30:28,280 --> 04:30:32,739
tag here. So I'm going to go ahead and add
a cloud, there's already a class there, actually,
3136
04:30:32,739 --> 04:30:38,029
we can just go ahead and select it. So I'm
going to go dot link, like that. And now what
3137
04:30:38,029 --> 04:30:43,040
I can actually do is change the lining of
this right here. So by default, anchor tags
3138
04:30:43,040 --> 04:30:46,949
have a text decoration of underline, there's
actually three more properties that we can
3139
04:30:46,949 --> 04:30:53,990
use. So that the property to use it, it's
called text dash decoration, it's pretty obvious.
3140
04:30:53,990 --> 04:30:58,840
Now the first one I'm going to look at is
none. So this completely removes the line
3141
04:30:58,840 --> 04:31:07,060
from our links, they're completely gone, you
don't have them anymore. The next one, which
3142
04:31:07,060 --> 04:31:11,030
is the one by default is underlined, like
that. So that's our normal link, then you
3143
04:31:11,030 --> 04:31:15,659
have line through which is line dash through.
And it's pretty obvious what that does just
3144
04:31:15,659 --> 04:31:20,010
put the line straight through. And then of
course, there's the overlying which is the
3145
04:31:20,010 --> 04:31:25,770
line on the top. So there we go. Now we have
a line on the top. Now, although you won't
3146
04:31:25,770 --> 04:31:30,760
see the the two that we just showed line through
and overlap very commonly, it is very common
3147
04:31:30,760 --> 04:31:33,710
to see underline and text decoration none
applied. Because sometimes I'm sure you've
3148
04:31:33,710 --> 04:31:37,319
seen this in websites all over the place,
you can hover over links, and they may be
3149
04:31:37,319 --> 04:31:40,949
changed color. Again, we'll be learning how
to do that in this course. But you know, they
3150
04:31:40,949 --> 04:31:46,359
might change color and do all sorts of things,
but you usually don't see them with an underline.
3151
04:31:46,359 --> 04:31:50,279
So that's where this property comes into play.
So I'm just going to change this back to underline,
3152
04:31:50,279 --> 04:31:53,890
just to make things a little interesting.
Next thing I'm going to do is go ahead and
3153
04:31:53,890 --> 04:32:00,580
cover the next property, which in this case
is text transform. So you can see that we
3154
04:32:00,580 --> 04:32:04,479
have a bunch of text here. And let's say maybe
we're working as a freelancer and our client
3155
04:32:04,479 --> 04:32:10,130
wants us to capitalize all of our text. How
are we going to do that? Now obviously, we're
3156
04:32:10,130 --> 04:32:12,170
not going to go through and capitalize every
single individual word that's going to basically
3157
04:32:12,170 --> 04:32:16,119
be suicide. Although it is possible, it could
take a lot of time. So the easiest way to
3158
04:32:16,119 --> 04:32:22,070
do it is using the text transform property.
So I'm just going to go ahead and do this
3159
04:32:22,070 --> 04:32:28,380
on the whole body. For now, the property to
this is text dash transform, pretty easy to
3160
04:32:28,380 --> 04:32:33,110
memorize, or learn these because they don't
really require any weird memorization tactics.
3161
04:32:33,110 --> 04:32:38,790
So now what you can do is go ahead and add
our value. So there are three different values
3162
04:32:38,790 --> 04:32:39,790
that you can use for this uppercase, lowercase
and capitalize. So because we want to capitalize
3163
04:32:39,790 --> 04:32:42,359
everything, we can go ahead and type capitalize.
Now if we refresh the page, you can see every
3164
04:32:42,359 --> 04:32:46,960
single word is capitalized without us having
having to actually change the text. You can
3165
04:32:46,960 --> 04:32:51,399
also go ahead and use the other two, which
are lowercase and uppercase.
3166
04:32:51,399 --> 04:32:55,880
So the next few videos are going to be focused
on font and text manipulation. So we're going
3167
04:32:55,880 --> 04:33:03,029
to be working with actually changing how this
text looks. First thing I want to talk about
3168
04:33:03,029 --> 04:33:08,951
is there's actually two parts to this section,
text manipulation and font manipulation. And
3169
04:33:08,951 --> 04:33:14,092
although they sound like the same thing, they're
actually very different. So the first part
3170
04:33:14,092 --> 04:33:17,271
in this video, we're going to be covering
text manipulation. Now, there's not that much
3171
04:33:17,271 --> 04:33:19,771
to look at. But pretty much the difference
between the two is that text manipulation
3172
04:33:19,771 --> 04:33:26,881
is looking at things that you can change no
matter the font. So for example, something
3173
04:33:26,881 --> 04:33:37,191
like sizing would not apply, because the size
is going to be based obviously on the font
3174
04:33:37,191 --> 04:33:40,340
itself. So basically, things like underlining
or capitalization are going to be completely
3175
04:33:40,340 --> 04:33:43,201
regardless of the font, you can change them
no matter what they do. But things like bolding
3176
04:33:43,201 --> 04:33:45,410
and things like size, bolding, things like
that, they are completely dependent on the
3177
04:33:45,410 --> 04:33:49,000
font, because again, the font decides how
it how the font itself is going to look. So
3178
04:33:49,000 --> 04:33:53,551
it decides the size, the bolding, and just
the overall style. So the first part in this
3179
04:33:53,551 --> 04:33:57,871
video, we're going to be covering text manipulation.
And in the next few videos, we're going to
3180
04:33:57,871 --> 04:34:00,150
be looking at actual font manipulation. So
things like external fonts, which is probably
3181
04:34:00,150 --> 04:34:01,150
the most exciting part of this course, and
things like weight and bolding. Alright, let's
3182
04:34:01,150 --> 04:34:06,141
get started. So the first two things I want
to cover are text decoration and text transform.
3183
04:34:06,141 --> 04:34:09,080
So these are properties that are going to
be relating to the style of the text. Now
3184
04:34:09,080 --> 04:34:14,990
I know I just said that fonts. And mostly
styling is dependent on the font. But in this
3185
04:34:14,990 --> 04:34:21,820
case, these these properties don't actually
rely on the font at all. So let's get started.
3186
04:34:21,820 --> 04:34:24,422
So the first thing I'm going to talk about
is text decoration. So although it sounds
3187
04:34:24,422 --> 04:34:30,461
like you can do a bunch of cool things with
this, the only real thing that you can do
3188
04:34:30,461 --> 04:34:37,941
is change the lining of the text. So we're
going to go ahead and work with this anchor
3189
04:34:37,941 --> 04:34:47,691
tag here. So I'm going to go ahead and add
a cloud, there's already a class there, actually,
3190
04:34:47,691 --> 04:35:00,900
we can just go ahead and select it. So I'm
going to go dot link, like that. And now what
3191
04:35:00,900 --> 04:35:08,590
I can actually do is change the lining of
this right here. So by default, anchor tags
3192
04:35:08,590 --> 04:35:14,281
have a text decoration of underline, there's
actually three more properties that we can
3193
04:35:14,281 --> 04:35:16,141
use. So that the property to use it, it's
called text dash decoration, it's pretty obvious.
3194
04:35:16,141 --> 04:35:20,141
Now the first one I'm going to look at is
none. So this completely removes the line
3195
04:35:20,141 --> 04:35:25,910
from our links, they're completely gone, you
don't have them anymore. The next one, which
3196
04:35:25,910 --> 04:35:31,852
is the one by default is underlined, like
that. So that's our normal link, then you
3197
04:35:31,852 --> 04:35:37,250
have line through which is line dash through.
And it's pretty obvious what that does just
3198
04:35:37,250 --> 04:35:41,262
put the line straight through. And then of
course, there's the overlying which is the
3199
04:35:41,262 --> 04:35:50,230
line on the top. So there we go. Now we have
a line on the top. Now, although you won't
3200
04:35:50,230 --> 04:35:55,660
see the the two that we just showed line through
and overlap very commonly, it is very common
3201
04:35:55,660 --> 04:36:00,082
to see underline and text decoration none
applied. Because sometimes I'm sure you've
3202
04:36:00,082 --> 04:36:05,311
seen this in websites all over the place,
you can hover over links, and they may be
3203
04:36:05,311 --> 04:36:10,891
changed color. Again, we'll be learning how
to do that in this course. But you know, they
3204
04:36:10,891 --> 04:36:16,811
might change color and do all sorts of things,
but you usually don't see them with an underline.
3205
04:36:16,811 --> 04:36:21,311
So that's where this property comes into play.
So I'm just going to change this back to underline,
3206
04:36:21,311 --> 04:36:27,500
just to make things a little interesting.
Next thing I'm going to do is go ahead and
3207
04:36:27,500 --> 04:36:34,260
cover the next property, which in this case
is text transform. So you can see that we
3208
04:36:34,260 --> 04:36:36,570
have a bunch of text here. And let's say maybe
we're working as a freelancer and our client
3209
04:36:36,570 --> 04:36:39,480
wants us to capitalize all of our text. How
are we going to do that? Now obviously, we're
3210
04:36:39,480 --> 04:36:43,551
not going to go through and capitalize every
single individual word that's going to basically
3211
04:36:43,551 --> 04:36:48,381
be suicide. Although it is possible, it could
take a lot of time. So the easiest way to
3212
04:36:48,381 --> 04:36:56,951
do it is using the text transform property.
So I'm just going to go ahead and do this
3213
04:36:56,951 --> 04:37:04,131
on the whole body. For now, the property to
this is text dash transform, pretty easy to
3214
04:37:04,131 --> 04:37:08,871
memorize, or learn these because they don't
really require any weird memorization tactics.
3215
04:37:08,871 --> 04:37:16,010
So now what you can do is go ahead and add
our value. So there are three different values
3216
04:37:16,010 --> 04:37:20,891
that you can use for this uppercase, lowercase
and capitalize. So because we want to capitalize
3217
04:37:20,891 --> 04:37:25,090
everything, we can go ahead and type capitalize.
Now if we refresh the page, you can see every
3218
04:37:25,090 --> 04:37:28,602
single word is capitalized without us having
having to actually change the text. You can
3219
04:37:28,602 --> 04:37:31,811
also go ahead and use the other two, which
are lowercase and uppercase.
3220
04:37:31,811 --> 04:37:35,641
And that will obviously put everything in
uppercase for you. But now you're starting
3221
04:37:35,641 --> 04:37:41,150
to see a little bit about why these are text
manipulation and not font manipulation. Again,
3222
04:37:41,150 --> 04:37:46,180
it doesn't matter what font you're using,
whether you're using some weird symbol font,
3223
04:37:46,180 --> 04:37:50,900
or Times New Roman, you can always use these
to capitalize it, no matter what the font
3224
04:37:50,900 --> 04:37:55,881
is. On top of that, you can also move around
these lines, it's not dependent on the font
3225
04:37:55,881 --> 04:38:01,852
at all. So that's just a little bit about
our text manipulation properties. So the next
3226
04:38:01,852 --> 04:38:07,660
feature I want to cover is text align. So
this is a little bit different from the other
3227
04:38:07,660 --> 04:38:12,910
two that we've covered. Because it's not really
focused on the styling or decoration of our
3228
04:38:12,910 --> 04:38:17,441
text. Instead, it's going to be focused on
the justification or alignment of it. So if
3229
04:38:17,441 --> 04:38:22,451
you've ever used any text editor, for example,
Microsoft Word, or Google Docs, anything like
3230
04:38:22,451 --> 04:38:27,822
that, you'll know that you can justify your
text and align it to your site. So there are
3231
04:38:27,822 --> 04:38:31,100
four main ones that are included in CSS left,
right, center and justify. So I'm going to
3232
04:38:31,100 --> 04:38:39,061
breeze through the quick the first three ones,
because it's quite easy to use. But then the
3233
04:38:39,061 --> 04:38:46,311
last one I'm going to talk about a little
bit in more detail. So in order to achieve
3234
04:38:46,311 --> 04:38:49,570
this, you can go ahead and add text align
property. And here, I'm just going to go center
3235
04:38:49,570 --> 04:38:55,740
as an example. And you can see that now everything
is aligned. So the list items are a little
3236
04:38:55,740 --> 04:39:07,111
bit weird, they don't actually move the decoration
to the center, when you align it to the center,
3237
04:39:07,111 --> 04:39:13,900
but other than that all of the text is now
aligned to the center. So now let's talk about
3238
04:39:13,900 --> 04:39:19,461
justify. Now we're not going to go through
left and right, because we already know that
3239
04:39:19,461 --> 04:39:25,561
but what justify actually does, I'm just gonna
show you here is pretty much it takes all
3240
04:39:25,561 --> 04:39:32,320
of the text, and it kind of matches it. So
it's all fit in the same way, if you if it
3241
04:39:32,320 --> 04:39:35,250
makes sense. So although it might not fit
everything, the same length, what happens
3242
04:39:35,250 --> 04:39:36,911
is all of this text is now stretched out as
far as possible. So although you might not
3243
04:39:36,911 --> 04:39:39,692
be able to see a direct difference, let's
just look at this paragraph here, we're going
3244
04:39:39,692 --> 04:39:43,862
to just end off this property without changing
it, you can see that without the justify alignment,
3245
04:39:43,862 --> 04:39:51,542
all of these are different. So what actually
what the justify actually does is it sets
3246
04:39:51,542 --> 04:39:56,810
all of the lines to the same length. So I'm
going to go ahead and add that justify back.
3247
04:39:56,810 --> 04:40:01,942
So you can see this used a lot in research
papers, and, you know, academic papers, essays,
3248
04:40:01,942 --> 04:40:07,130
things like that. This justification is used
a lot. And although it's not very, it's not
3249
04:40:07,130 --> 04:40:13,170
really used very commonly, it's still a very
good feature if you have big bodies of text,
3250
04:40:13,170 --> 04:40:15,670
if you're trying to you know, make everything
look very streamlined. Alright, there we go.
3251
04:40:15,670 --> 04:40:21,070
So those are the four or sorry, three different
types of text manipulation properties that
3252
04:40:21,070 --> 04:40:24,740
you can use, and along with their respective
value. So I encourage you to go ahead and
3253
04:40:24,740 --> 04:40:29,830
try this out on your own, you can do a lot
of things with these three values alone, you
3254
04:40:29,830 --> 04:40:35,750
can really change how the page looks. Alright,
let's move on.
3255
04:40:35,750 --> 04:40:39,550
And that will obviously put everything in
uppercase for you. But now you're starting
3256
04:40:39,550 --> 04:40:43,930
to see a little bit about why these are text
manipulation and not font manipulation. Again,
3257
04:40:43,930 --> 04:40:47,702
it doesn't matter what font you're using,
whether you're using some weird symbol font,
3258
04:40:47,702 --> 04:40:52,730
or Times New Roman, you can always use these
to capitalize it, no matter what the font
3259
04:40:52,730 --> 04:41:00,980
is. On top of that, you can also move around
these lines, it's not dependent on the font
3260
04:41:00,980 --> 04:41:09,612
at all. So that's just a little bit about
our text manipulation properties. So the next
3261
04:41:09,612 --> 04:41:15,470
feature I want to cover is text align. So
this is a little bit different from the other
3262
04:41:15,470 --> 04:41:20,580
two that we've covered. Because it's not really
focused on the styling or decoration of our
3263
04:41:20,580 --> 04:41:25,352
text. Instead, it's going to be focused on
the justification or alignment of it. So if
3264
04:41:25,352 --> 04:41:31,162
you've ever used any text editor, for example,
Microsoft Word, or Google Docs, anything like
3265
04:41:31,162 --> 04:41:38,952
that, you'll know that you can justify your
text and align it to your site. So there are
3266
04:41:38,952 --> 04:41:43,560
four main ones that are included in CSS left,
right, center and justify. So I'm going to
3267
04:41:43,560 --> 04:41:50,102
breeze through the quick the first three ones,
because it's quite easy to use. But then the
3268
04:41:50,102 --> 04:41:57,010
last one I'm going to talk about a little
bit in more detail. So in order to achieve
3269
04:41:57,010 --> 04:41:59,910
this, you can go ahead and add text align
property. And here, I'm just going to go center
3270
04:41:59,910 --> 04:42:03,750
as an example. And you can see that now everything
is aligned. So the list items are a little
3271
04:42:03,750 --> 04:42:08,622
bit weird, they don't actually move the decoration
to the center, when you align it to the center,
3272
04:42:08,622 --> 04:42:15,372
but other than that all of the text is now
aligned to the center. So now let's talk about
3273
04:42:15,372 --> 04:42:19,580
justify. Now we're not going to go through
left and right, because we already know that
3274
04:42:19,580 --> 04:42:23,630
but what justify actually does, I'm just gonna
show you here is pretty much it takes all
3275
04:42:23,630 --> 04:42:28,252
of the text, and it kind of matches it. So
it's all fit in the same way, if you if it
3276
04:42:28,252 --> 04:42:31,112
makes sense. So although it might not fit
everything, the same length, what happens
3277
04:42:31,112 --> 04:42:35,920
is all of this text is now stretched out as
far as possible. So although you might not
3278
04:42:35,920 --> 04:42:41,092
be able to see a direct difference, let's
just look at this paragraph here, we're going
3279
04:42:41,092 --> 04:42:47,080
to just end off this property without changing
it, you can see that without the justify alignment,
3280
04:42:47,080 --> 04:42:50,922
all of these are different. So what actually
what the justify actually does is it sets
3281
04:42:50,922 --> 04:42:55,820
all of the lines to the same length. So I'm
going to go ahead and add that justify back.
3282
04:42:55,820 --> 04:43:00,272
So you can see this used a lot in research
papers, and, you know, academic papers, essays,
3283
04:43:00,272 --> 04:43:04,810
things like that. This justification is used
a lot. And although it's not very, it's not
3284
04:43:04,810 --> 04:43:10,240
really used very commonly, it's still a very
good feature if you have big bodies of text,
3285
04:43:10,240 --> 04:43:16,852
if you're trying to you know, make everything
look very streamlined. Alright, there we go.
3286
04:43:16,852 --> 04:43:20,760
So those are the four or sorry, three different
types of text manipulation properties that
3287
04:43:20,760 --> 04:43:26,192
you can use, and along with their respective
value. So I encourage you to go ahead and
3288
04:43:26,192 --> 04:43:35,220
try this out on your own, you can do a lot
of things with these three values alone, you
3289
04:43:35,220 --> 04:43:41,112
can really change how the page looks. Alright,
let's move on.
3290
04:43:41,112 --> 04:43:44,542
So in this video, we're going to be talking
about the other half of overall text manipulation.
3291
04:43:44,542 --> 04:43:49,670
And in this case, we're going to be looking
at different font properties. So in this video,
3292
04:43:49,670 --> 04:43:54,460
we're going to be looking at three font size,
font weight and font style. So first thing
3293
04:43:54,460 --> 04:44:00,170
I want to look at is font size. So right now
we have our pretty standard text here, right.
3294
04:44:00,170 --> 04:44:05,362
So I'm just actually going to go ahead and
erase our text transform from our previous
3295
04:44:05,362 --> 04:44:09,920
video. So now we have our text here. And what
I want to do is change the size of this. The
3296
04:44:09,920 --> 04:44:12,772
only problem is I want to use a responsive
design. So what I'm going to do is go ahead
3297
04:44:12,772 --> 04:44:18,070
and first use our font size property. And
then I'm going to go ahead and say let's just
3298
04:44:18,070 --> 04:44:24,512
say 1.25 em. So what happens here is make
this 25% more than the standard font size.
3299
04:44:24,512 --> 04:44:30,060
Now you can see it's a little bit bigger,
but it's not as big as doing something like
3300
04:44:30,060 --> 04:44:35,570
two n. So there we go. Now that we've done
that, we can also go ahead and actually use
3301
04:44:35,570 --> 04:44:39,060
pixel values, if we wanted to 40 pixels for
example, the only problem is this is going
3302
04:44:39,060 --> 04:44:47,970
to set everything consistently. So you can
see all of the sizes are the same, it doesn't
3303
04:44:47,970 --> 04:44:56,032
matter if they're a header, or while it does
actually matter. But because in the CSS defined
3304
04:44:56,032 --> 04:45:02,332
code, all of these headers actually have to
em but if we actually removed all of these,
3305
04:45:02,332 --> 04:45:07,122
they would be the same. So using something
like two e n, would be great, because what
3306
04:45:07,122 --> 04:45:12,320
actually happens is now everything stays consistent.
And it's also a relative unit. So that's always
3307
04:45:12,320 --> 04:45:17,660
good, because it stays responsive. So there
we go. That's pretty much it for font size,
3308
04:45:17,660 --> 04:45:25,942
I'm going to go ahead and actually change
this to one point 15 am, I think that's good.
3309
04:45:25,942 --> 04:45:32,772
So there we go. That's the first one. Now
let's go ahead and talk about font weight.
3310
04:45:32,772 --> 04:45:36,910
So this is a little bit more complicated.
So pretty much what font weight decides is
3311
04:45:36,910 --> 04:45:41,470
the bolding of a text or a font. So the values
for this can range from zero, which is nothing
3312
04:45:41,470 --> 04:45:44,720
all the way to? Well, pretty much infinity.
The only problem is, most fonts only support
3313
04:45:44,720 --> 04:45:50,122
up to 800, or 900. Because, again, for each
value, there is a different bolding stage.
3314
04:45:50,122 --> 04:45:56,872
So most fonts are only going to go up to maybe
100, or 900, some of them can go even higher.
3315
04:45:56,872 --> 04:46:03,420
But in theory, you can make these values as
big as you want. The only problem is, it's
3316
04:46:03,420 --> 04:46:08,640
not really going to show any change if you
make them very big. So there we go. That's
3317
04:46:08,640 --> 04:46:13,390
pretty much it for font weight, let's go ahead
and start adding it to our website. So let's
3318
04:46:13,390 --> 04:46:21,070
say I wanted to make our title a little bit
bolded. So I'm going to go ahead and say font
3319
04:46:21,070 --> 04:46:27,292
dash weight. And now I'm going to go ahead
and specify a value. Let's go ahead and start
3320
04:46:27,292 --> 04:46:32,890
with zero and see what happens, you can see
that nothing actually happens. But pretty
3321
04:46:32,890 --> 04:46:38,260
much like I said before, most fonts only support
certain values. So for example, 100 would
3322
04:46:38,260 --> 04:46:44,872
be a very specific kind of bolding, 200 300
400 and all the way up to as much as the font
3323
04:46:44,872 --> 04:46:51,782
supports. Now usually, the convention for
this is you're supposed to go up in hundreds
3324
04:46:51,782 --> 04:46:59,380
from 100. That's kind of like the minimum
supported font size. So if I go ahead and
3325
04:46:59,380 --> 04:47:05,092
set 100. Here, you can see it's very thin.
And if I go ahead and set it as 800, which
3326
04:47:05,092 --> 04:47:12,542
is usually the highest that you should go
realistically, this is kind of the standard
3327
04:47:12,542 --> 04:47:21,522
for each one. So there you go, you can set
it to something like 600, which isn't very
3328
04:47:21,522 --> 04:47:26,840
commonly seen, like I said, fonts only support
certain bolded ness, if that makes sense.
3329
04:47:26,840 --> 04:47:31,490
But you can go ahead and play around with
this. And like I said, depending on the font,
3330
04:47:31,490 --> 04:47:36,210
it's going to change what the text actually
looks like. So there we go. That's pretty
3331
04:47:36,210 --> 04:47:42,292
much it for font weight, I'm going to go ahead
and actually just set this to 400, which is
3332
04:47:42,292 --> 04:47:44,862
the standard font right there. So 400 is the
normal, it's like normal bolding, no bolding
3333
04:47:44,862 --> 04:47:49,330
and don't make it very thin. So that's kind
of what it's the normal range. So there we
3334
04:47:49,330 --> 04:47:54,292
go. That's it for font weight. Now let's go
ahead and look at font style. So just like
3335
04:47:54,292 --> 04:48:00,070
font sizes for size and font weight is for
bolding font style is for italic sizing. So
3336
04:48:00,070 --> 04:48:05,752
I'm going to go ahead and actually italicize
a small piece of text here. So let's just
3337
04:48:05,752 --> 04:48:11,452
go ahead into this. And I'm going to take
this first part, and actually just cut it
3338
04:48:11,452 --> 04:48:18,210
out. I'm going to create a span tag. So a
span tag is sort of an if you don't know it's
3339
04:48:18,210 --> 04:48:22,500
an inline day. It's an inline container tag,
which allows you to contain a certain pieces
3340
04:48:22,500 --> 04:48:28,900
of text without you know disrupting the flow
or moving them on to their own line. So I'm
3341
04:48:28,900 --> 04:48:34,400
going to give it a class, I'm just going to
say italics, I guess that would work. So then
3342
04:48:34,400 --> 04:48:40,890
I'm going to go ahead and use the class selector
italics. Open this up. Now we're going to
3343
04:48:40,890 --> 04:48:45,580
go ahead and start working on adding our italicizing.
So what you can do for this is called font
3344
04:48:45,580 --> 04:48:50,452
style. And although most of the selectors
these days are quite easy to remember, italics
3345
04:48:50,452 --> 04:48:58,230
and font style don't usually go hand in hand.
So it might be a little hard to remember this
3346
04:48:58,230 --> 04:49:04,050
one. So there's three different values they
can use for this normal, which is pretty much
3347
04:49:04,050 --> 04:49:08,470
the same as setting the font weight is 400
doesn't do anything, or it actually will change
3348
04:49:08,470 --> 04:49:15,082
it back to its normal state. Then you have
italic, which is to italicize it, and then
3349
04:49:15,082 --> 04:49:22,410
you have oblique, which is a little bit more
italic size. So let's go ahead and just add
3350
04:49:22,410 --> 04:49:27,612
the basic one. I'm gonna go and type metalic
here. Now if we refresh the page, you can
3351
04:49:27,612 --> 04:49:32,862
see that where it is, there we go. It's right
there
3352
04:49:32,862 --> 04:49:40,810
So in this video, we're going to be talking
about the other half of overall text manipulation.
3353
04:49:40,810 --> 04:49:46,550
And in this case, we're going to be looking
at different font properties. So in this video,
3354
04:49:46,550 --> 04:49:54,230
we're going to be looking at three font size,
font weight and font style. So first thing
3355
04:49:54,230 --> 04:50:02,590
I want to look at is font size. So right now
we have our pretty standard text here, right.
3356
04:50:02,590 --> 04:50:06,730
So I'm just actually going to go ahead and
erase our text transform from our previous
3357
04:50:06,730 --> 04:50:11,910
video. So now we have our text here. And what
I want to do is change the size of this. The
3358
04:50:11,910 --> 04:50:19,702
only problem is I want to use a responsive
design. So what I'm going to do is go ahead
3359
04:50:19,702 --> 04:50:26,372
and first use our font size property. And
then I'm going to go ahead and say let's just
3360
04:50:26,372 --> 04:50:30,820
say 1.25 em. So what happens here is make
this 25% more than the standard font size.
3361
04:50:30,820 --> 04:50:38,080
Now you can see it's a little bit bigger,
but it's not as big as doing something like
3362
04:50:38,080 --> 04:50:42,550
two n. So there we go. Now that we've done
that, we can also go ahead and actually use
3363
04:50:42,550 --> 04:50:50,140
pixel values, if we wanted to 40 pixels for
example, the only problem is this is going
3364
04:50:50,140 --> 04:50:55,362
to set everything consistently. So you can
see all of the sizes are the same, it doesn't
3365
04:50:55,362 --> 04:50:56,980
matter if they're a header, or while it does
actually matter. But because in the CSS defined
3366
04:50:56,980 --> 04:51:00,550
code, all of these headers actually have to
em but if we actually removed all of these,
3367
04:51:00,550 --> 04:51:07,720
they would be the same. So using something
like two e n, would be great, because what
3368
04:51:07,720 --> 04:51:13,080
actually happens is now everything stays consistent.
And it's also a relative unit. So that's always
3369
04:51:13,080 --> 04:51:19,410
good, because it stays responsive. So there
we go. That's pretty much it for font size,
3370
04:51:19,410 --> 04:51:23,460
I'm going to go ahead and actually change
this to one point 15 am, I think that's good.
3371
04:51:23,460 --> 04:51:27,272
So there we go. That's the first one. Now
let's go ahead and talk about font weight.
3372
04:51:27,272 --> 04:51:31,890
So this is a little bit more complicated.
So pretty much what font weight decides is
3373
04:51:31,890 --> 04:51:35,862
the bolding of a text or a font. So the values
for this can range from zero, which is nothing
3374
04:51:35,862 --> 04:51:41,592
all the way to? Well, pretty much infinity.
The only problem is, most fonts only support
3375
04:51:41,592 --> 04:51:46,602
up to 800, or 900. Because, again, for each
value, there is a different bolding stage.
3376
04:51:46,602 --> 04:51:50,880
So most fonts are only going to go up to maybe
100, or 900, some of them can go even higher.
3377
04:51:50,880 --> 04:51:58,510
But in theory, you can make these values as
big as you want. The only problem is, it's
3378
04:51:58,510 --> 04:52:01,612
not really going to show any change if you
make them very big. So there we go. That's
3379
04:52:01,612 --> 04:52:06,330
pretty much it for font weight, let's go ahead
and start adding it to our website. So let's
3380
04:52:06,330 --> 04:52:08,250
say I wanted to make our title a little bit
bolded. So I'm going to go ahead and say font
3381
04:52:08,250 --> 04:52:14,180
dash weight. And now I'm going to go ahead
and specify a value. Let's go ahead and start
3382
04:52:14,180 --> 04:52:17,830
with zero and see what happens, you can see
that nothing actually happens. But pretty
3383
04:52:17,830 --> 04:52:24,202
much like I said before, most fonts only support
certain values. So for example, 100 would
3384
04:52:24,202 --> 04:52:27,442
be a very specific kind of bolding, 200 300
400 and all the way up to as much as the font
3385
04:52:27,442 --> 04:52:30,560
supports. Now usually, the convention for
this is you're supposed to go up in hundreds
3386
04:52:30,560 --> 04:52:33,872
from 100. That's kind of like the minimum
supported font size. So if I go ahead and
3387
04:52:33,872 --> 04:52:36,952
set 100. Here, you can see it's very thin.
And if I go ahead and set it as 800, which
3388
04:52:36,952 --> 04:52:38,170
is usually the highest that you should go
realistically, this is kind of the standard
3389
04:52:38,170 --> 04:52:39,170
for each one. So there you go, you can set
it to something like 600, which isn't very
3390
04:52:39,170 --> 04:52:40,362
commonly seen, like I said, fonts only support
certain bolded ness, if that makes sense.
3391
04:52:40,362 --> 04:52:45,010
But you can go ahead and play around with
this. And like I said, depending on the font,
3392
04:52:45,010 --> 04:52:52,262
it's going to change what the text actually
looks like. So there we go. That's pretty
3393
04:52:52,262 --> 04:52:58,960
much it for font weight, I'm going to go ahead
and actually just set this to 400, which is
3394
04:52:58,960 --> 04:53:04,500
the standard font right there. So 400 is the
normal, it's like normal bolding, no bolding
3395
04:53:04,500 --> 04:53:07,640
and don't make it very thin. So that's kind
of what it's the normal range. So there we
3396
04:53:07,640 --> 04:53:11,660
go. That's it for font weight. Now let's go
ahead and look at font style. So just like
3397
04:53:11,660 --> 04:53:18,162
font sizes for size and font weight is for
bolding font style is for italic sizing. So
3398
04:53:18,162 --> 04:53:20,580
I'm going to go ahead and actually italicize
a small piece of text here. So let's just
3399
04:53:20,580 --> 04:53:25,810
go ahead into this. And I'm going to take
this first part, and actually just cut it
3400
04:53:25,810 --> 04:53:33,372
out. I'm going to create a span tag. So a
span tag is sort of an if you don't know it's
3401
04:53:33,372 --> 04:53:37,000
an inline day. It's an inline container tag,
which allows you to contain a certain pieces
3402
04:53:37,000 --> 04:53:43,930
of text without you know disrupting the flow
or moving them on to their own line. So I'm
3403
04:53:43,930 --> 04:53:48,032
going to give it a class, I'm just going to
say italics, I guess that would work. So then
3404
04:53:48,032 --> 04:53:53,990
I'm going to go ahead and use the class selector
italics. Open this up. Now we're going to
3405
04:53:53,990 --> 04:54:02,960
go ahead and start working on adding our italicizing.
So what you can do for this is called font
3406
04:54:02,960 --> 04:54:10,270
style. And although most of the selectors
these days are quite easy to remember, italics
3407
04:54:10,270 --> 04:54:15,560
and font style don't usually go hand in hand.
So it might be a little hard to remember this
3408
04:54:15,560 --> 04:54:23,550
one. So there's three different values they
can use for this normal, which is pretty much
3409
04:54:23,550 --> 04:54:31,910
the same as setting the font weight is 400
doesn't do anything, or it actually will change
3410
04:54:31,910 --> 04:54:35,310
it back to its normal state. Then you have
italic, which is to italicize it, and then
3411
04:54:35,310 --> 04:54:40,240
you have oblique, which is a little bit more
italic size. So let's go ahead and just add
3412
04:54:40,240 --> 04:54:44,210
the basic one. I'm gonna go and type metalic
here. Now if we refresh the page, you can
3413
04:54:44,210 --> 04:54:50,032
see that where it is, there we go. It's right
there
3414
04:54:50,032 --> 04:55:00,352
is a little bit more. The font, the font is
a little bit a little bit more italic size.
3415
04:55:00,352 --> 04:55:07,002
So there we go. Now let's go ahead and set
it as the other value which is oblique. And
3416
04:55:07,002 --> 04:55:13,380
you might notice a little bit of a difference.
So it's not immediately obvious, but it's
3417
04:55:13,380 --> 04:55:20,220
actually just a little bit more italicize.
So like I said, it's not very good. noticeable.
3418
04:55:20,220 --> 04:55:27,432
But that's just one thing to keep in mind.
So there we go, I'm just going to change this
3419
04:55:27,432 --> 04:55:32,240
back to italic. And that's pretty much it
for the three different font manipulation
3420
04:55:32,240 --> 04:55:37,170
techniques. Now, although I didn't cover font
family, which is what I'm going to cover in
3421
04:55:37,170 --> 04:55:48,012
the next video, these are the pretty much
three basic ones that you can use to work
3422
04:55:48,012 --> 04:55:52,590
with text without changing the font itself.
So you can go ahead and work with changing
3423
04:55:52,590 --> 04:55:58,042
the font weight, you know, make it bolded
or italicized, you can also change the size.
3424
04:55:58,042 --> 04:56:04,872
So you can really do a lot with this. But
font family is a little bit more complicated,
3425
04:56:04,872 --> 04:56:09,622
which is why I want to leave it for its own
video. All right, let's move on.
3426
04:56:09,622 --> 04:56:16,542
is a little bit more. The font, the font is
a little bit a little bit more italic size.
3427
04:56:16,542 --> 04:56:22,810
So there we go. Now let's go ahead and set
it as the other value which is oblique. And
3428
04:56:22,810 --> 04:56:29,240
you might notice a little bit of a difference.
So it's not immediately obvious, but it's
3429
04:56:29,240 --> 04:56:36,342
actually just a little bit more italicize.
So like I said, it's not very good. noticeable.
3430
04:56:36,342 --> 04:56:45,022
But that's just one thing to keep in mind.
So there we go, I'm just going to change this
3431
04:56:45,022 --> 04:56:50,202
back to italic. And that's pretty much it
for the three different font manipulation
3432
04:56:50,202 --> 04:56:54,560
techniques. Now, although I didn't cover font
family, which is what I'm going to cover in
3433
04:56:54,560 --> 04:57:00,172
the next video, these are the pretty much
three basic ones that you can use to work
3434
04:57:00,172 --> 04:57:04,600
with text without changing the font itself.
So you can go ahead and work with changing
3435
04:57:04,600 --> 04:57:08,470
the font weight, you know, make it bolded
or italicized, you can also change the size.
3436
04:57:08,470 --> 04:57:11,350
So you can really do a lot with this. But
font family is a little bit more complicated,
3437
04:57:11,350 --> 04:57:14,442
which is why I want to leave it for its own
video. All right, let's move on.
3438
04:57:14,442 --> 04:57:18,300
So in this video, we're going to be talking
about the last property related to text and
3439
04:57:18,300 --> 04:57:25,550
fonts. And that is font family. So I'm going
to talk a little bit about that. But in the
3440
04:57:25,550 --> 04:57:30,170
next few videos, we're going to actually looking
at how to include external fonts, which is
3441
04:57:30,170 --> 04:57:34,990
going to be a very fun activity. And that's
going to really change the way that we use
3442
04:57:34,990 --> 04:57:41,670
CSS. But before we do that, we need to learn
about font families. So first of all, if you
3443
04:57:41,670 --> 04:57:45,702
don't already know, a font family is basically
a collection of fonts that have similar features.
3444
04:57:45,702 --> 04:57:50,532
So there are three main font families that
you can use serif, sans serif, and monospace.
3445
04:57:50,532 --> 04:57:55,692
So first of all, let's talk about serif fonts.
So serif fonts have these small lines on the
3446
04:57:55,692 --> 04:57:58,032
end of some letters, and pretty much every
or a lot of the academic papers. And well
3447
04:57:58,032 --> 04:58:01,372
printed documents use these serif fonts. So
right now, for example, our font is a Sarah
3448
04:58:01,372 --> 04:58:07,430
because you can see these tiny lines at the
end of some of the letters. So these are used
3449
04:58:07,430 --> 04:58:12,050
very commonly on like I said, papers, essays,
you know, journals, anything that's pretty
3450
04:58:12,050 --> 04:58:18,670
much printed out or given to you physically,
is usually going to use a serif font. But
3451
04:58:18,670 --> 04:58:28,400
unfortunately, it makes it very hard to read
on the computer. So there's actually a another
3452
04:58:28,400 --> 04:58:34,310
group of fonts, that which is the sans serif
group. And if you don't know sans serif groups,
3453
04:58:34,310 --> 04:58:40,090
are basically the fonts that don't have those
lines, if it's not obvious enough, from name.
3454
04:58:40,090 --> 04:58:45,862
So right now, this is a serif font. A sans
serif font, on the other hand, would not have
3455
04:58:45,862 --> 04:58:51,300
those lines, it would look a lot cleaner,
and easier to read. Now, a lot of the websites
3456
04:58:51,300 --> 04:58:56,630
that you use today, so for example, pretty
much all the news websites, if you've used
3457
04:58:56,630 --> 04:59:00,942
WordPress before that also uses Sarah sorry,
sans serif fonts unless you specify otherwise,
3458
04:59:00,942 --> 04:59:04,300
Google Facebook, pretty much every website
that you see commonly today, the big ones,
3459
04:59:04,300 --> 04:59:07,582
usually always use Sans Serif fonts, because
they're much easier to read. So those are
3460
04:59:07,582 --> 04:59:11,570
the two main groups. But like I said, there's
also a third one, which is called mono space.
3461
04:59:11,570 --> 04:59:16,050
So mono space is pretty much where all of
the characters have the same width. So they
3462
04:59:16,050 --> 04:59:20,352
all take up kind of the same space each character.
Whereas something like this, you can see that
3463
04:59:20,352 --> 04:59:25,122
each letter kind of takes a different amount
of space, depending on what the letter is.
3464
04:59:25,122 --> 04:59:29,122
So some pretty good examples of a sarafan
are Times New Roman, which is probably the
3465
04:59:29,122 --> 04:59:33,752
most famous, and Georgia. Some pretty good
examples of Sans Serif fonts are Arial and
3466
04:59:33,752 --> 04:59:41,322
Calibri. If you've ever used Google Docs before,
Calibri is a pretty common font. And then
3467
04:59:41,322 --> 04:59:47,320
a pretty good example of a monospace font
is Korea new if you know what that is. Korea
3468
04:59:47,320 --> 04:59:53,952
news, one of the monospace fonts but like
I said, there's many more out there that you
3469
04:59:53,952 --> 04:59:58,612
can use. Like I said, it all depends on what
family you pick, and what what kind of result
3470
04:59:58,612 --> 05:00:03,720
you're trying to achieve out of your fonts
or you're trying to make it readable Are you
3471
05:00:03,720 --> 05:00:10,370
making a paper or a journal, it all depends
on what you want out of your while document.
3472
05:00:10,370 --> 05:00:14,990
So in this case, because we're doing or creating
a website, we're gonna want to use Sans Serif
3473
05:00:14,990 --> 05:00:21,282
fonts. So in order to specify a font family,
or in specific a font, you're gonna have to
3474
05:00:21,282 --> 05:00:23,032
use the font family
3475
05:00:23,032 --> 05:00:28,692
So in this video, we're going to be talking
about the last property related to text and
3476
05:00:28,692 --> 05:00:34,692
fonts. And that is font family. So I'm going
to talk a little bit about that. But in the
3477
05:00:34,692 --> 05:00:40,452
next few videos, we're going to actually looking
at how to include external fonts, which is
3478
05:00:40,452 --> 05:00:44,810
going to be a very fun activity. And that's
going to really change the way that we use
3479
05:00:44,810 --> 05:00:46,580
CSS. But before we do that, we need to learn
about font families. So first of all, if you
3480
05:00:46,580 --> 05:00:53,210
don't already know, a font family is basically
a collection of fonts that have similar features.
3481
05:00:53,210 --> 05:00:55,782
So there are three main font families that
you can use serif, sans serif, and monospace.
3482
05:00:55,782 --> 05:00:59,720
So first of all, let's talk about serif fonts.
So serif fonts have these small lines on the
3483
05:00:59,720 --> 05:01:04,442
end of some letters, and pretty much every
or a lot of the academic papers. And well
3484
05:01:04,442 --> 05:01:08,470
printed documents use these serif fonts. So
right now, for example, our font is a Sarah
3485
05:01:08,470 --> 05:01:13,260
because you can see these tiny lines at the
end of some of the letters. So these are used
3486
05:01:13,260 --> 05:01:16,782
very commonly on like I said, papers, essays,
you know, journals, anything that's pretty
3487
05:01:16,782 --> 05:01:21,442
much printed out or given to you physically,
is usually going to use a serif font. But
3488
05:01:21,442 --> 05:01:26,240
unfortunately, it makes it very hard to read
on the computer. So there's actually a another
3489
05:01:26,240 --> 05:01:31,782
group of fonts, that which is the sans serif
group. And if you don't know sans serif groups,
3490
05:01:31,782 --> 05:01:37,000
are basically the fonts that don't have those
lines, if it's not obvious enough, from name.
3491
05:01:37,000 --> 05:01:42,580
So right now, this is a serif font. A sans
serif font, on the other hand, would not have
3492
05:01:42,580 --> 05:01:47,710
those lines, it would look a lot cleaner,
and easier to read. Now, a lot of the websites
3493
05:01:47,710 --> 05:01:51,772
that you use today, so for example, pretty
much all the news websites, if you've used
3494
05:01:51,772 --> 05:01:55,670
WordPress before that also uses Sarah sorry,
sans serif fonts unless you specify otherwise,
3495
05:01:55,670 --> 05:01:59,102
Google Facebook, pretty much every website
that you see commonly today, the big ones,
3496
05:01:59,102 --> 05:02:05,100
usually always use Sans Serif fonts, because
they're much easier to read. So those are
3497
05:02:05,100 --> 05:02:13,230
the two main groups. But like I said, there's
also a third one, which is called mono space.
3498
05:02:13,230 --> 05:02:19,592
So mono space is pretty much where all of
the characters have the same width. So they
3499
05:02:19,592 --> 05:02:27,420
all take up kind of the same space each character.
Whereas something like this, you can see that
3500
05:02:27,420 --> 05:02:34,442
each letter kind of takes a different amount
of space, depending on what the letter is.
3501
05:02:34,442 --> 05:02:40,160
So some pretty good examples of a sarafan
are Times New Roman, which is probably the
3502
05:02:40,160 --> 05:02:45,160
most famous, and Georgia. Some pretty good
examples of Sans Serif fonts are Arial and
3503
05:02:45,160 --> 05:02:53,420
Calibri. If you've ever used Google Docs before,
Calibri is a pretty common font. And then
3504
05:02:53,420 --> 05:02:57,612
a pretty good example of a monospace font
is Korea new if you know what that is. Korea
3505
05:02:57,612 --> 05:03:02,100
news, one of the monospace fonts but like
I said, there's many more out there that you
3506
05:03:02,100 --> 05:03:07,390
can use. Like I said, it all depends on what
family you pick, and what what kind of result
3507
05:03:07,390 --> 05:03:12,081
you're trying to achieve out of your fonts
or you're trying to make it readable Are you
3508
05:03:12,081 --> 05:03:15,990
making a paper or a journal, it all depends
on what you want out of your while document.
3509
05:03:15,990 --> 05:03:21,112
So in this case, because we're doing or creating
a website, we're gonna want to use Sans Serif
3510
05:03:21,112 --> 05:03:26,042
fonts. So in order to specify a font family,
or in specific a font, you're gonna have to
3511
05:03:26,042 --> 05:03:27,800
use the font family
3512
05:03:27,800 --> 05:03:34,510
property. So if you go ahead and set font
family. Now, this isn't just for setting the
3513
05:03:34,510 --> 05:03:39,782
family. This is also for spreading the specific
fonts. And I'll talk about that in just a
3514
05:03:39,782 --> 05:03:50,000
second. So I'm going to go ahead and say sans
serif. So this is the font family that I want
3515
05:03:50,000 --> 05:03:54,282
and watch what happens to our page. Now, you
can see that it looks completely different.
3516
05:03:54,282 --> 05:03:59,550
We can actually read everything and it looks
a lot cleaner. So that's why I like san serif
3517
05:03:59,550 --> 05:04:03,650
fonts. And that's why most developers much
prefer Sans Serif fonts over serif fonts,
3518
05:04:03,650 --> 05:04:09,602
you can see that it just looks a lot easier
on the eyes. It's just much easier to read
3519
05:04:09,602 --> 05:04:15,380
and use. But like I said, you can you don't
just have to specify the family you can actually
3520
05:04:15,380 --> 05:04:16,710
specify the specific font. And you can actually
do this using the comma separator. So first
3521
05:04:16,710 --> 05:04:19,342
of all, I'm basic set times new roman as the
main font. And then I'm going to insert a
3522
05:04:19,342 --> 05:04:21,582
comma, and then serif. So I'll explain this
right now, first of all, if a font has more
3523
05:04:21,582 --> 05:04:24,862
than one word or it's separated by spaces,
you're going to need to use quotation marks
3524
05:04:24,862 --> 05:04:29,220
to contain it. Now, the second thing is this
comma here, pretty much what's going to happen
3525
05:04:29,220 --> 05:04:35,442
is, if Times New Roman is available, use that
as the font. But if it isn't available, then
3526
05:04:35,442 --> 05:04:41,310
fall back to the standard serif font. So you
can actually include more than just Times
3527
05:04:41,310 --> 05:04:46,750
New Roman on here. So you can include three
or even for layers sometimes. But for now,
3528
05:04:46,750 --> 05:04:50,410
we're just going to use two and we'll talk
about including very specific fonts in the
3529
05:04:50,410 --> 05:04:56,630
next two videos, where we're going to be including
these external fonts. So there we go. Pretty
3530
05:04:56,630 --> 05:05:04,432
much what this is saying is set the font family,
in this case, the font, as Times New Roman,
3531
05:05:04,432 --> 05:05:10,122
but if Times New Roman isn't available, maybe
you know, if you're using an external font,
3532
05:05:10,122 --> 05:05:14,980
maybe this server has crashed, or maybe it's
just not available on the browser, then use
3533
05:05:14,980 --> 05:05:19,362
the serif family, there's the general serif
font. So if I actually go ahead and remove
3534
05:05:19,362 --> 05:05:24,772
this, you're not going to see much of a difference
between Times New Roman and Sarath. Like I
3535
05:05:24,772 --> 05:05:31,112
said, you can see there's not much of a change
because it pretty much the same thing. But
3536
05:05:31,112 --> 05:05:35,510
it is there. And if you use a different Sarah
font, such as Georgia, there will be some
3537
05:05:35,510 --> 05:05:40,330
sort of a difference between the two, you
can see that now, although they aren't exactly,
3538
05:05:40,330 --> 05:05:45,372
they aren't exactly the same, you can see
they both contain those lines, things like
3539
05:05:45,372 --> 05:05:51,372
that. So that's why you commonly use more
than more than one fonts, just in case maybe,
3540
05:05:51,372 --> 05:05:56,900
if you're using a different browser, maybe
someone's using a very old browser, like Internet
3541
05:05:56,900 --> 05:06:04,550
Explorer six or seven, then you can use some
of the older fonts. So there you go. That's
3542
05:06:04,550 --> 05:06:09,782
pretty much it. For font families, it's really
not that hard to grasp. And once you really
3543
05:06:09,782 --> 05:06:14,910
get into it, it becomes a very, very useful
tool. So I'm going to go ahead and actually
3544
05:06:14,910 --> 05:06:18,920
just change this. But like I was saying, it
becomes a very useful tool, once you get into
3545
05:06:18,920 --> 05:06:23,380
the later parts of web development, because
changing the font can completely change the
3546
05:06:23,380 --> 05:06:29,452
look of your site. So that's just one thing
you want to keep in mind. Alright, let's move
3547
05:06:29,452 --> 05:06:30,452
on.
3548
05:06:30,452 --> 05:06:36,241
property. So if you go ahead and set font
family. Now, this isn't just for setting the
3549
05:06:36,241 --> 05:06:40,880
family. This is also for spreading the specific
fonts. And I'll talk about that in just a
3550
05:06:40,880 --> 05:06:49,040
second. So I'm going to go ahead and say sans
serif. So this is the font family that I want
3551
05:06:49,040 --> 05:06:52,350
and watch what happens to our page. Now, you
can see that it looks completely different.
3552
05:06:52,350 --> 05:06:56,922
We can actually read everything and it looks
a lot cleaner. So that's why I like san serif
3553
05:06:56,922 --> 05:07:00,282
fonts. And that's why most developers much
prefer Sans Serif fonts over serif fonts,
3554
05:07:00,282 --> 05:07:05,372
you can see that it just looks a lot easier
on the eyes. It's just much easier to read
3555
05:07:05,372 --> 05:07:11,130
and use. But like I said, you can you don't
just have to specify the family you can actually
3556
05:07:11,130 --> 05:07:15,590
specify the specific font. And you can actually
do this using the comma separator. So first
3557
05:07:15,590 --> 05:07:23,130
of all, I'm basic set times new roman as the
main font. And then I'm going to insert a
3558
05:07:23,130 --> 05:07:28,762
comma, and then serif. So I'll explain this
right now, first of all, if a font has more
3559
05:07:28,762 --> 05:07:33,400
than one word or it's separated by spaces,
you're going to need to use quotation marks
3560
05:07:33,400 --> 05:07:39,522
to contain it. Now, the second thing is this
comma here, pretty much what's going to happen
3561
05:07:39,522 --> 05:07:48,292
is, if Times New Roman is available, use that
as the font. But if it isn't available, then
3562
05:07:48,292 --> 05:07:53,442
fall back to the standard serif font. So you
can actually include more than just Times
3563
05:07:53,442 --> 05:07:57,500
New Roman on here. So you can include three
or even for layers sometimes. But for now,
3564
05:07:57,500 --> 05:08:00,900
we're just going to use two and we'll talk
about including very specific fonts in the
3565
05:08:00,900 --> 05:08:06,300
next two videos, where we're going to be including
these external fonts. So there we go. Pretty
3566
05:08:06,300 --> 05:08:13,140
much what this is saying is set the font family,
in this case, the font, as Times New Roman,
3567
05:08:13,140 --> 05:08:18,010
but if Times New Roman isn't available, maybe
you know, if you're using an external font,
3568
05:08:18,010 --> 05:08:22,250
maybe this server has crashed, or maybe it's
just not available on the browser, then use
3569
05:08:22,250 --> 05:08:28,220
the serif family, there's the general serif
font. So if I actually go ahead and remove
3570
05:08:28,220 --> 05:08:34,352
this, you're not going to see much of a difference
between Times New Roman and Sarath. Like I
3571
05:08:34,352 --> 05:08:43,830
said, you can see there's not much of a change
because it pretty much the same thing. But
3572
05:08:43,830 --> 05:08:48,830
it is there. And if you use a different Sarah
font, such as Georgia, there will be some
3573
05:08:48,830 --> 05:08:53,760
sort of a difference between the two, you
can see that now, although they aren't exactly,
3574
05:08:53,760 --> 05:08:59,042
they aren't exactly the same, you can see
they both contain those lines, things like
3575
05:08:59,042 --> 05:09:05,010
that. So that's why you commonly use more
than more than one fonts, just in case maybe,
3576
05:09:05,010 --> 05:09:09,010
if you're using a different browser, maybe
someone's using a very old browser, like Internet
3577
05:09:09,010 --> 05:09:15,310
Explorer six or seven, then you can use some
of the older fonts. So there you go. That's
3578
05:09:15,310 --> 05:09:20,660
pretty much it. For font families, it's really
not that hard to grasp. And once you really
3579
05:09:20,660 --> 05:09:24,942
get into it, it becomes a very, very useful
tool. So I'm going to go ahead and actually
3580
05:09:24,942 --> 05:09:31,832
just change this. But like I was saying, it
becomes a very useful tool, once you get into
3581
05:09:31,832 --> 05:09:37,470
the later parts of web development, because
changing the font can completely change the
3582
05:09:37,470 --> 05:09:42,910
look of your site. So that's just one thing
you want to keep in mind. Alright, let's move
3583
05:09:42,910 --> 05:09:43,910
on.
3584
05:09:43,910 --> 05:09:49,112
So in this video, we are going to be looking
at actually using some external fonts. We've
3585
05:09:49,112 --> 05:09:54,752
looked at fonts and text, and we know how
to manipulate it now. But we don't actually
3586
05:09:54,752 --> 05:09:59,322
know the one crucial piece, which is using
external fonts. So your computer will most
3587
05:09:59,322 --> 05:10:02,760
likely come preloaded with a bunch of different
fonts. If you use things like Microsoft Word,
3588
05:10:02,760 --> 05:10:07,452
or, you know, maybe Google Docs, things like
that. They all come with pre loaded fonts.
3589
05:10:07,452 --> 05:10:11,970
And although Google Docs technically isn't
on your computer, we'll just leave it in there
3590
05:10:11,970 --> 05:10:17,980
for now. So obviously, we have a lot of fonts
to choose from in CSS. But first of all, how
3591
05:10:17,980 --> 05:10:23,670
do we actually know which fonts to use? And
what if we don't have the font? I mean, you
3592
05:10:23,670 --> 05:10:27,910
know, maybe it doesn't come with our computer,
how are we supposed to get it? Well, the first
3593
05:10:27,910 --> 05:10:31,320
thing that I would recommend doing is going
and getting fonts from the internet. Now,
3594
05:10:31,320 --> 05:10:39,522
if you don't already know this, most people
would think that you know, the fonts that
3595
05:10:39,522 --> 05:10:45,350
you have are set for life, you can't download
anymore. Well, fonts are actually a huge growing
3596
05:10:45,350 --> 05:10:48,460
industry. And there are so many different
fonts out there that you can use, and you
3597
05:10:48,460 --> 05:10:51,012
can even make your own. So there's obviously
a lot more fonts to choose them than what's
3598
05:10:51,012 --> 05:10:56,640
provided on your computer. So in this video,
I'm going to be teaching you how to go and
3599
05:10:56,640 --> 05:11:03,542
find your own fonts. And then in the next
video, we're going to be including it into
3600
05:11:03,542 --> 05:11:09,100
our project. So the first source I'm going
to recommend here, which is actually only
3601
05:11:09,100 --> 05:11:13,220
source, but it's called Google fonts, it was
put together by Google. And it's a collection
3602
05:11:13,220 --> 05:11:17,670
of 915 font families. So you can see we have
a bunch of different fonts here. And when
3603
05:11:17,670 --> 05:11:20,292
I say font families, just think fonts default,
because
3604
05:11:20,292 --> 05:11:23,710
So in this video, we are going to be looking
at actually using some external fonts. We've
3605
05:11:23,710 --> 05:11:27,452
looked at fonts and text, and we know how
to manipulate it now. But we don't actually
3606
05:11:27,452 --> 05:11:31,822
know the one crucial piece, which is using
external fonts. So your computer will most
3607
05:11:31,822 --> 05:11:36,470
likely come preloaded with a bunch of different
fonts. If you use things like Microsoft Word,
3608
05:11:36,470 --> 05:11:41,112
or, you know, maybe Google Docs, things like
that. They all come with pre loaded fonts.
3609
05:11:41,112 --> 05:11:44,970
And although Google Docs technically isn't
on your computer, we'll just leave it in there
3610
05:11:44,970 --> 05:11:50,660
for now. So obviously, we have a lot of fonts
to choose from in CSS. But first of all, how
3611
05:11:50,660 --> 05:11:56,942
do we actually know which fonts to use? And
what if we don't have the font? I mean, you
3612
05:11:56,942 --> 05:12:02,180
know, maybe it doesn't come with our computer,
how are we supposed to get it? Well, the first
3613
05:12:02,180 --> 05:12:06,160
thing that I would recommend doing is going
and getting fonts from the internet. Now,
3614
05:12:06,160 --> 05:12:14,910
if you don't already know this, most people
would think that you know, the fonts that
3615
05:12:14,910 --> 05:12:21,022
you have are set for life, you can't download
anymore. Well, fonts are actually a huge growing
3616
05:12:21,022 --> 05:12:25,210
industry. And there are so many different
fonts out there that you can use, and you
3617
05:12:25,210 --> 05:12:31,430
can even make your own. So there's obviously
a lot more fonts to choose them than what's
3618
05:12:31,430 --> 05:12:36,640
provided on your computer. So in this video,
I'm going to be teaching you how to go and
3619
05:12:36,640 --> 05:12:45,840
find your own fonts. And then in the next
video, we're going to be including it into
3620
05:12:45,840 --> 05:12:50,362
our project. So the first source I'm going
to recommend here, which is actually only
3621
05:12:50,362 --> 05:12:53,872
source, but it's called Google fonts, it was
put together by Google. And it's a collection
3622
05:12:53,872 --> 05:13:01,010
of 915 font families. So you can see we have
a bunch of different fonts here. And when
3623
05:13:01,010 --> 05:13:04,032
I say font families, just think fonts default,
because
3624
05:13:04,032 --> 05:13:09,740
you know, when you think of it as a family,
you think there's multiple fonts, but there's
3625
05:13:09,740 --> 05:13:17,650
actually only one and then you can change
the bolding and other settings, we'll go over
3626
05:13:17,650 --> 05:13:24,372
that a little bit later in this video. So
you can head over to this, I've linked it
3627
05:13:24,372 --> 05:13:28,880
in the lecture resources, or you can just
copy the link here from video. And it's going
3628
05:13:28,880 --> 05:13:32,410
to take you to this site. So there's actually
915 families on this site, which is a lot
3629
05:13:32,410 --> 05:13:36,490
to choose from. Now you can see that there
are even you know things in different languages.
3630
05:13:36,490 --> 05:13:39,750
There's all sorts of different styles, maybe
from different general families. So this could
3631
05:13:39,750 --> 05:13:44,122
be from, you know, a sensory family. This
could be from a Sarah family. So you can see
3632
05:13:44,122 --> 05:13:49,862
that there are so many different choices that
you can use. And depending on what type of
3633
05:13:49,862 --> 05:13:55,180
website you want to create, you can actually
choose the fonts that you want. So I'm gonna
3634
05:13:55,180 --> 05:14:05,710
actually go through now and start picking
some fonts. So what I would recommend is just
3635
05:14:05,710 --> 05:14:10,772
go through and look at the many different
fonts you have here. So for example, I think
3636
05:14:10,772 --> 05:14:19,750
this is a very nice font. So what I'm going
to do is just go ahead and click this plus
3637
05:14:19,750 --> 05:14:23,741
icon And what it's going to do here it says
there's one family selected, right? If you
3638
05:14:23,741 --> 05:14:27,422
open it up, you can see that our font has
been selected. Now we're going to work on
3639
05:14:27,422 --> 05:14:32,560
embedding this in the next video. But for
now, I just want to leave it like this. So
3640
05:14:32,560 --> 05:14:37,480
you can see that we can actually go ahead
and customize our font now. So for example,
3641
05:14:37,480 --> 05:14:45,080
if I wanted to choose some different bolding,
so for example, you can see, this is a font
3642
05:14:45,080 --> 05:14:49,650
weight of 100. And this is a font weight of
900. So you can select as many as you want.
3643
05:14:49,650 --> 05:14:55,922
But you can see that we actually have a load
type here. So the reason that this is given
3644
05:14:55,922 --> 05:15:03,140
is because we are including this from the
internet, obviously. So if you try to pull
3645
05:15:03,140 --> 05:15:06,512
too many resources from an intranet or from,
you know, outside of your local machine, it's
3646
05:15:06,512 --> 05:15:14,350
going to really slow down the load time of
your website, because obviously, it's not
3647
05:15:14,350 --> 05:15:19,942
instantaneous, you need to send over requests,
and there's a whole lot that goes behind.
3648
05:15:19,942 --> 05:15:23,470
So while I would recommend is not trying to
select every single one of these weights,
3649
05:15:23,470 --> 05:15:29,710
only select the ones that you think you're
going to need. So for example, for now, I'm
3650
05:15:29,710 --> 05:15:36,942
just going to select the regular and the bolt.
Now, I don't want any italics. So I'm just
3651
05:15:36,942 --> 05:15:43,580
going to exclude this. And you can see that
our load time is fast. So we're okay. So you
3652
05:15:43,580 --> 05:15:48,230
can see that apart from our buildings, we
can actually select some of some of the stuff
3653
05:15:48,230 --> 05:15:53,282
from here. So instead of having to go into
our selection, we can actually just go and
3654
05:15:53,282 --> 05:15:59,542
straight select it. From here, we can also
change the size if we wanted to. And then
3655
05:15:59,542 --> 05:16:04,430
we can click the plus icon. So you can go
ahead and play around with those when you
3656
05:16:04,430 --> 05:16:09,050
include your own fonts. But for now, I think
I'm just going to go with the default size
3657
05:16:09,050 --> 05:16:15,512
and just add a bolded. So now I'm going to
go ahead and actually include a second font,
3658
05:16:15,512 --> 05:16:21,800
because it's pretty common in web development
and web design to include at least two fonts,
3659
05:16:21,800 --> 05:16:27,710
you know, maybe one for headings, and one
for text. So I'm going to go ahead and find
3660
05:16:27,710 --> 05:16:32,122
something that kind of fits in with the later
font that we have here, I'm going to just
3661
05:16:32,122 --> 05:16:43,640
select it back to the default size. So I'm
going to try and find something that kind
3662
05:16:43,640 --> 05:16:47,872
of matches this. It doesn't have to be obviously
exactly the same. It can just be something
3663
05:16:47,872 --> 05:16:51,402
that you know, kind of fits in the theme,
or makes the website look kind of complements
3664
05:16:51,402 --> 05:16:55,480
the other font. So I think this is good. It's
actually Sarah serif. So I don't I'm not going
3665
05:16:55,480 --> 05:16:58,072
to use it, you can see those lines there.
I'm looking for a sans serif font. Let me
3666
05:16:58,072 --> 05:17:02,372
see. So I think this is a pretty good font.
So what I'm going to do is go ahead and add
3667
05:17:02,372 --> 05:17:07,002
this as well just click on that plus icon.
And now we can actually customize both fonts.
3668
05:17:07,002 --> 05:17:10,942
So I'm going to go ahead and add that bold
700 as well, you can see that the load time
3669
05:17:10,942 --> 05:17:13,792
is moderate now because of course, we're including
more than one font, but we don't need to worry
3670
05:17:13,792 --> 05:17:17,502
about that too much. So there we go. We have
that setup now. So there we go. That's pretty
3671
05:17:17,502 --> 05:17:22,250
much it for Google fonts. And you know, using
all these different fonts, now you can go
3672
05:17:22,250 --> 05:17:24,820
ahead and customize it. Choose whatever makes
your website look good, or maybe whatever
3673
05:17:24,820 --> 05:17:30,070
you want. But just make sure that you choose
a font that really works with your website
3674
05:17:30,070 --> 05:17:32,130
well and make sure you don't include too many
different weights. So you can keep the load
3675
05:17:32,130 --> 05:17:36,782
time within Bay. So in the next video, we're
actually going to go through and start importing
3676
05:17:36,782 --> 05:17:45,060
this into our website. And I'm going to teach
you some really good failsafe tricks in case
3677
05:17:45,060 --> 05:17:47,532
Google Fonts fails. Alright, let's move on.
3678
05:17:47,532 --> 05:17:53,542
you know, when you think of it as a family,
you think there's multiple fonts, but there's
3679
05:17:53,542 --> 05:17:58,792
actually only one and then you can change
the bolding and other settings, we'll go over
3680
05:17:58,792 --> 05:18:04,080
that a little bit later in this video. So
you can head over to this, I've linked it
3681
05:18:04,080 --> 05:18:06,792
in the lecture resources, or you can just
copy the link here from video. And it's going
3682
05:18:06,792 --> 05:18:11,820
to take you to this site. So there's actually
915 families on this site, which is a lot
3683
05:18:11,820 --> 05:18:14,332
to choose from. Now you can see that there
are even you know things in different languages.
3684
05:18:14,332 --> 05:18:17,362
There's all sorts of different styles, maybe
from different general families. So this could
3685
05:18:17,362 --> 05:18:21,272
be from, you know, a sensory family. This
could be from a Sarah family. So you can see
3686
05:18:21,272 --> 05:18:23,480
that there are so many different choices that
you can use. And depending on what type of
3687
05:18:23,480 --> 05:18:29,042
website you want to create, you can actually
choose the fonts that you want. So I'm gonna
3688
05:18:29,042 --> 05:18:32,820
actually go through now and start picking
some fonts. So what I would recommend is just
3689
05:18:32,820 --> 05:18:38,112
go through and look at the many different
fonts you have here. So for example, I think
3690
05:18:38,112 --> 05:18:42,920
this is a very nice font. So what I'm going
to do is just go ahead and click this plus
3691
05:18:42,920 --> 05:18:45,400
icon And what it's going to do here it says
there's one family selected, right? If you
3692
05:18:45,400 --> 05:18:49,220
open it up, you can see that our font has
been selected. Now we're going to work on
3693
05:18:49,220 --> 05:18:54,910
embedding this in the next video. But for
now, I just want to leave it like this. So
3694
05:18:54,910 --> 05:18:57,510
you can see that we can actually go ahead
and customize our font now. So for example,
3695
05:18:57,510 --> 05:19:02,580
if I wanted to choose some different bolding,
so for example, you can see, this is a font
3696
05:19:02,580 --> 05:19:07,300
weight of 100. And this is a font weight of
900. So you can select as many as you want.
3697
05:19:07,300 --> 05:19:15,692
But you can see that we actually have a load
type here. So the reason that this is given
3698
05:19:15,692 --> 05:19:22,390
is because we are including this from the
internet, obviously. So if you try to pull
3699
05:19:22,390 --> 05:19:27,752
too many resources from an intranet or from,
you know, outside of your local machine, it's
3700
05:19:27,752 --> 05:19:32,952
going to really slow down the load time of
your website, because obviously, it's not
3701
05:19:32,952 --> 05:19:38,820
instantaneous, you need to send over requests,
and there's a whole lot that goes behind.
3702
05:19:38,820 --> 05:19:43,230
So while I would recommend is not trying to
select every single one of these weights,
3703
05:19:43,230 --> 05:19:48,000
only select the ones that you think you're
going to need. So for example, for now, I'm
3704
05:19:48,000 --> 05:19:55,362
just going to select the regular and the bolt.
Now, I don't want any italics. So I'm just
3705
05:19:55,362 --> 05:20:01,292
going to exclude this. And you can see that
our load time is fast. So we're okay. So you
3706
05:20:01,292 --> 05:20:05,640
can see that apart from our buildings, we
can actually select some of some of the stuff
3707
05:20:05,640 --> 05:20:11,172
from here. So instead of having to go into
our selection, we can actually just go and
3708
05:20:11,172 --> 05:20:15,202
straight select it. From here, we can also
change the size if we wanted to. And then
3709
05:20:15,202 --> 05:20:20,130
we can click the plus icon. So you can go
ahead and play around with those when you
3710
05:20:20,130 --> 05:20:24,622
include your own fonts. But for now, I think
I'm just going to go with the default size
3711
05:20:24,622 --> 05:20:29,300
and just add a bolded. So now I'm going to
go ahead and actually include a second font,
3712
05:20:29,300 --> 05:20:33,180
because it's pretty common in web development
and web design to include at least two fonts,
3713
05:20:33,180 --> 05:20:41,422
you know, maybe one for headings, and one
for text. So I'm going to go ahead and find
3714
05:20:41,422 --> 05:20:46,470
something that kind of fits in with the later
font that we have here, I'm going to just
3715
05:20:46,470 --> 05:20:56,340
select it back to the default size. So I'm
going to try and find something that kind
3716
05:20:56,340 --> 05:21:01,740
of matches this. It doesn't have to be obviously
exactly the same. It can just be something
3717
05:21:01,740 --> 05:21:07,580
that you know, kind of fits in the theme,
or makes the website look kind of complements
3718
05:21:07,580 --> 05:21:13,900
the other font. So I think this is good. It's
actually Sarah serif. So I don't I'm not going
3719
05:21:13,900 --> 05:21:17,970
to use it, you can see those lines there.
I'm looking for a sans serif font. Let me
3720
05:21:17,970 --> 05:21:21,760
see. So I think this is a pretty good font.
So what I'm going to do is go ahead and add
3721
05:21:21,760 --> 05:21:26,070
this as well just click on that plus icon.
And now we can actually customize both fonts.
3722
05:21:26,070 --> 05:21:31,180
So I'm going to go ahead and add that bold
700 as well, you can see that the load time
3723
05:21:31,180 --> 05:21:35,900
is moderate now because of course, we're including
more than one font, but we don't need to worry
3724
05:21:35,900 --> 05:21:40,740
about that too much. So there we go. We have
that setup now. So there we go. That's pretty
3725
05:21:40,740 --> 05:21:46,310
much it for Google fonts. And you know, using
all these different fonts, now you can go
3726
05:21:46,310 --> 05:21:49,320
ahead and customize it. Choose whatever makes
your website look good, or maybe whatever
3727
05:21:49,320 --> 05:21:52,970
you want. But just make sure that you choose
a font that really works with your website
3728
05:21:52,970 --> 05:21:59,490
well and make sure you don't include too many
different weights. So you can keep the load
3729
05:21:59,490 --> 05:22:06,782
time within Bay. So in the next video, we're
actually going to go through and start importing
3730
05:22:06,782 --> 05:22:11,460
this into our website. And I'm going to teach
you some really good failsafe tricks in case
3731
05:22:11,460 --> 05:22:13,032
Google Fonts fails. Alright, let's move on.
3732
05:22:13,032 --> 05:22:18,170
So in the previous video, we started looking
at what type of fonts we can use in our website.
3733
05:22:18,170 --> 05:22:22,430
Now we're going to go through and actually
include them. So first of all, let's just
3734
05:22:22,430 --> 05:22:28,010
look at our website. For now we have all of
our fonts setup, we have a bunch of text manipulation,
3735
05:22:28,010 --> 05:22:32,420
ready to go and working on the website. But
now what I'm going to do is actually go through
3736
05:22:32,420 --> 05:22:33,679
and start using these external fonts. So we're
not going to use this Arial font anymore,
3737
05:22:33,679 --> 05:22:41,160
so I'm going to go ahead and erase that. And
also for the font weight, I'm also going to
3738
05:22:41,160 --> 05:22:46,970
go ahead and erase that because there's some
issues with it that I'll talk about in just
3739
05:22:46,970 --> 05:22:52,172
a second. So there we go. Now that we removed,
all of the properties will be directly affected
3740
05:22:52,172 --> 05:22:57,862
by the font. Let's go ahead and work on setting
up our website with these external fonts.
3741
05:22:57,862 --> 05:23:03,710
So the first thing you'll notice here is that
when you go over to your Google fonts, it
3742
05:23:03,710 --> 05:23:10,372
gives you this link tag to include. So this
link tag is pretty much going to link to Google
3743
05:23:10,372 --> 05:23:14,640
fonts and pull them from their servers. So
this is what you're going to need to copy
3744
05:23:14,640 --> 05:23:16,970
right here. You're just going to copy this
and up in your HTML document, you're going
3745
05:23:16,970 --> 05:23:20,380
to paste your link tag above your stylesheet.
Now make sure you post it above this above
3746
05:23:20,380 --> 05:23:25,800
your stylesheet because you want to have the
fonts ready so that when your stylesheet comes
3747
05:23:25,800 --> 05:23:29,502
along and the compiler is reading it, all
of the fonts are already there and ready to
3748
05:23:29,502 --> 05:23:33,170
go. So there we go. Now that everything's
linked and set up, why don't we go ahead and
3749
05:23:33,170 --> 05:23:35,372
see what happened on our website. Obviously,
we removed the font You can see that nothing
3750
05:23:35,372 --> 05:23:41,032
actually happens. So, by doing this, we don't
actually set up our website to use our fonts,
3751
05:23:41,032 --> 05:23:48,220
we're just bringing them into our website.
Now what we need to do is go through in CSS
3752
05:23:48,220 --> 05:23:52,952
and start utilizing these fonts, so that we
can see the changes on the website. So on
3753
05:23:52,952 --> 05:23:57,662
top of that, this, there's this little text
here that allows you to do you know, you can
3754
05:23:57,662 --> 05:24:02,240
just copy the style straight, but I'm going
to go ahead and do it manually. So first of
3755
05:24:02,240 --> 05:24:10,460
all, let's go ahead and add our body font.
So I'm going to go ahead and say, font family.
3756
05:24:10,460 --> 05:24:17,380
And now we're going to go through and select
our font. So we included two fonts, Leto and
3757
05:24:17,380 --> 05:24:23,830
sorrow boon we're going to go through is go
ahead and see which one we want to use. So
3758
05:24:23,830 --> 05:24:29,420
I'm going to use Leto for the body text. So
right here in quotes, I'm going to go ahead
3759
05:24:29,420 --> 05:24:35,400
and say, Leto, just like that. And now let's
go ahead and refresh the page. And you can
3760
05:24:35,400 --> 05:24:40,532
see how much of a difference that makes. Now
using this new font, everything has changed,
3761
05:24:40,532 --> 05:24:44,990
it makes the website look completely different
from what it used to be. So there we go, we've
3762
05:24:44,990 --> 05:24:51,468
included that. But let's go ahead and include
our second font here. So I'm going to go through
3763
05:24:51,468 --> 05:24:58,050
and actually add it on the title and the subtitle.
And remember going back to specificity, the
3764
05:24:58,050 --> 05:25:03,342
class and Id selectors are going to be more
specific than the body selectors. So our font
3765
05:25:03,342 --> 05:25:08,602
family is going to override the body font
family. So let's go ahead and add that. Right
3766
05:25:08,602 --> 05:25:14,582
there. Just like that. And let's go ahead
and add it to our subtitle as well. All right,
3767
05:25:14,582 --> 05:25:18,100
well, let's go ahead and see what happens.
So you can see that, although the difference
3768
05:25:18,100 --> 05:25:22,042
is quite subtle, it's still changed the font
of the titles and subtitles. And you can see
3769
05:25:22,042 --> 05:25:26,710
why using two fonts on your website makes
it look a whole lot better. So there we go.
3770
05:25:26,710 --> 05:25:29,380
We've added all of our fonts. But the only
problem is, we know that what what's happening
3771
05:25:29,380 --> 05:25:34,492
beside behind the scenes is that this link
tag is going to Google servers, pulling these
3772
05:25:34,492 --> 05:25:39,850
fonts, and then including them in our website.
But what if it fails? What if there's no internet
3773
05:25:39,850 --> 05:25:43,452
connection, or what if it's down, maybe the
Google Fonts servers themselves are down.
3774
05:25:43,452 --> 05:25:50,532
This is where we need to use the trick we
learned in the font families video, in which
3775
05:25:50,532 --> 05:25:57,180
we can actually add a backup font to this.
And if we actually go on Google Fonts right
3776
05:25:57,180 --> 05:26:02,122
here, you can see they already do this. Now,
because the sans serif family is included
3777
05:26:02,122 --> 05:26:09,130
by default, what's going to happen is, normally
it's going to use the font specified. But
3778
05:26:09,130 --> 05:26:13,542
if there's some problem, and we can't get
these fonts, maybe Google servers are down,
3779
05:26:13,542 --> 05:26:17,454
it's going to go over to the next font. And
we know that sans serif is included on every
3780
05:26:17,454 --> 05:26:21,590
single machine, which means that it's going
to work fine. So let's go ahead and do that.
3781
05:26:21,590 --> 05:26:28,112
Now. If you remember, all we have to do is
go ahead and add a comma, and then put the
3782
05:26:28,112 --> 05:26:37,710
name of the family, which in this case is
sans serif. We're going to do this for the
3783
05:26:37,710 --> 05:26:39,300
other two as well.
3784
05:26:39,300 --> 05:26:48,300
So in the previous video, we started looking
at what type of fonts we can use in our website.
3785
05:26:48,300 --> 05:26:53,000
Now we're going to go through and actually
include them. So first of all, let's just
3786
05:26:53,000 --> 05:27:00,350
look at our website. For now we have all of
our fonts setup, we have a bunch of text manipulation,
3787
05:27:00,350 --> 05:27:06,582
ready to go and working on the website. But
now what I'm going to do is actually go through
3788
05:27:06,582 --> 05:27:11,332
and start using these external fonts. So we're
not going to use this Arial font anymore,
3789
05:27:11,332 --> 05:27:18,932
so I'm going to go ahead and erase that. And
also for the font weight, I'm also going to
3790
05:27:18,932 --> 05:27:23,050
go ahead and erase that because there's some
issues with it that I'll talk about in just
3791
05:27:23,050 --> 05:27:30,330
a second. So there we go. Now that we removed,
all of the properties will be directly affected
3792
05:27:30,330 --> 05:27:34,820
by the font. Let's go ahead and work on setting
up our website with these external fonts.
3793
05:27:34,820 --> 05:27:38,660
So the first thing you'll notice here is that
when you go over to your Google fonts, it
3794
05:27:38,660 --> 05:27:43,130
gives you this link tag to include. So this
link tag is pretty much going to link to Google
3795
05:27:43,130 --> 05:27:45,612
fonts and pull them from their servers. So
this is what you're going to need to copy
3796
05:27:45,612 --> 05:27:50,240
right here. You're just going to copy this
and up in your HTML document, you're going
3797
05:27:50,240 --> 05:27:55,180
to paste your link tag above your stylesheet.
Now make sure you post it above this above
3798
05:27:55,180 --> 05:28:00,192
your stylesheet because you want to have the
fonts ready so that when your stylesheet comes
3799
05:28:00,192 --> 05:28:06,352
along and the compiler is reading it, all
of the fonts are already there and ready to
3800
05:28:06,352 --> 05:28:09,920
go. So there we go. Now that everything's
linked and set up, why don't we go ahead and
3801
05:28:09,920 --> 05:28:12,840
see what happened on our website. Obviously,
we removed the font You can see that nothing
3802
05:28:12,840 --> 05:28:17,730
actually happens. So, by doing this, we don't
actually set up our website to use our fonts,
3803
05:28:17,730 --> 05:28:22,920
we're just bringing them into our website.
Now what we need to do is go through in CSS
3804
05:28:22,920 --> 05:28:28,282
and start utilizing these fonts, so that we
can see the changes on the website. So on
3805
05:28:28,282 --> 05:28:37,060
top of that, this, there's this little text
here that allows you to do you know, you can
3806
05:28:37,060 --> 05:28:46,070
just copy the style straight, but I'm going
to go ahead and do it manually. So first of
3807
05:28:46,070 --> 05:28:49,590
all, let's go ahead and add our body font.
So I'm going to go ahead and say, font family.
3808
05:28:49,590 --> 05:28:56,770
And now we're going to go through and select
our font. So we included two fonts, Leto and
3809
05:28:56,770 --> 05:29:01,603
sorrow boon we're going to go through is go
ahead and see which one we want to use. So
3810
05:29:01,603 --> 05:29:10,442
I'm going to use Leto for the body text. So
right here in quotes, I'm going to go ahead
3811
05:29:10,442 --> 05:29:17,090
and say, Leto, just like that. And now let's
go ahead and refresh the page. And you can
3812
05:29:17,090 --> 05:29:21,782
see how much of a difference that makes. Now
using this new font, everything has changed,
3813
05:29:21,782 --> 05:29:27,910
it makes the website look completely different
from what it used to be. So there we go, we've
3814
05:29:27,910 --> 05:29:35,010
included that. But let's go ahead and include
our second font here. So I'm going to go through
3815
05:29:35,010 --> 05:29:39,452
and actually add it on the title and the subtitle.
And remember going back to specificity, the
3816
05:29:39,452 --> 05:29:43,102
class and Id selectors are going to be more
specific than the body selectors. So our font
3817
05:29:43,102 --> 05:29:47,792
family is going to override the body font
family. So let's go ahead and add that. Right
3818
05:29:47,792 --> 05:29:52,460
there. Just like that. And let's go ahead
and add it to our subtitle as well. All right,
3819
05:29:52,460 --> 05:29:57,442
well, let's go ahead and see what happens.
So you can see that, although the difference
3820
05:29:57,442 --> 05:30:01,400
is quite subtle, it's still changed the font
of the titles and subtitles. And you can see
3821
05:30:01,400 --> 05:30:06,320
why using two fonts on your website makes
it look a whole lot better. So there we go.
3822
05:30:06,320 --> 05:30:10,590
We've added all of our fonts. But the only
problem is, we know that what what's happening
3823
05:30:10,590 --> 05:30:14,160
beside behind the scenes is that this link
tag is going to Google servers, pulling these
3824
05:30:14,160 --> 05:30:16,800
fonts, and then including them in our website.
But what if it fails? What if there's no internet
3825
05:30:16,800 --> 05:30:20,032
connection, or what if it's down, maybe the
Google Fonts servers themselves are down.
3826
05:30:20,032 --> 05:30:27,092
This is where we need to use the trick we
learned in the font families video, in which
3827
05:30:27,092 --> 05:30:34,050
we can actually add a backup font to this.
And if we actually go on Google Fonts right
3828
05:30:34,050 --> 05:30:39,770
here, you can see they already do this. Now,
because the sans serif family is included
3829
05:30:39,770 --> 05:30:44,012
by default, what's going to happen is, normally
it's going to use the font specified. But
3830
05:30:44,012 --> 05:30:47,442
if there's some problem, and we can't get
these fonts, maybe Google servers are down,
3831
05:30:47,442 --> 05:30:58,580
it's going to go over to the next font. And
we know that sans serif is included on every
3832
05:30:58,580 --> 05:31:03,352
single machine, which means that it's going
to work fine. So let's go ahead and do that.
3833
05:31:03,352 --> 05:31:07,500
Now. If you remember, all we have to do is
go ahead and add a comma, and then put the
3834
05:31:07,500 --> 05:31:11,782
name of the family, which in this case is
sans serif. We're going to do this for the
3835
05:31:11,782 --> 05:31:12,782
other two as well.
3836
05:31:12,782 --> 05:31:18,230
And this one as well. Now, of course, this
is going to change based on the font that
3837
05:31:18,230 --> 05:31:19,952
you use. And I'm actually going to show you
this right here. Let's remove both of these
3838
05:31:19,952 --> 05:31:23,670
and add a serif font. So this would be considered
a serif font. Let's go ahead and add that.
3839
05:31:23,670 --> 05:31:27,022
Now if we go ahead and look at the family,
well, it's actually not not serif. It's a
3840
05:31:27,022 --> 05:31:31,500
different family called cursive. But you can
see just to prove that point that the family
3841
05:31:31,500 --> 05:31:37,122
is going to depend on the font itself. So
we explained a little bit about font families
3842
05:31:37,122 --> 05:31:41,650
in that video. And obviously, all of them
have different characteristics. So of course,
3843
05:31:41,650 --> 05:31:47,230
like I said, it depends completely on the
type of font. So if I go ahead and see the
3844
05:31:47,230 --> 05:31:51,980
family there, you can see that that sans serif.
But if we use something like this font, it's
3845
05:31:51,980 --> 05:31:56,390
going to be a different font family. So that's
just one thing you need to keep in mind is
3846
05:31:56,390 --> 05:32:01,630
that you want to make sure your fallback font
is both included on every machine. And it's
3847
05:32:01,630 --> 05:32:08,710
kind of similar to our font here. Now, if
I actually go ahead and erase this, now let's
3848
05:32:08,710 --> 05:32:14,390
go ahead and see, obviously, there is a visual
difference, but it still has that same style.
3849
05:32:14,390 --> 05:32:20,140
There's no lines, it's clean to read. It's
just straightforward. So that's one thing
3850
05:32:20,140 --> 05:32:23,990
you want to make sure of. Alright, so that's
pretty much it for fonts. Next, we're going
3851
05:32:23,990 --> 05:32:32,262
to move on to layout, which is really gonna
change the way that this website looks. Alright,
3852
05:32:32,262 --> 05:32:33,262
let's move on.
3853
05:32:33,262 --> 05:32:39,180
And this one as well. Now, of course, this
is going to change based on the font that
3854
05:32:39,180 --> 05:32:43,160
you use. And I'm actually going to show you
this right here. Let's remove both of these
3855
05:32:43,160 --> 05:32:46,020
and add a serif font. So this would be considered
a serif font. Let's go ahead and add that.
3856
05:32:46,020 --> 05:32:51,150
Now if we go ahead and look at the family,
well, it's actually not not serif. It's a
3857
05:32:51,150 --> 05:32:57,500
different family called cursive. But you can
see just to prove that point that the family
3858
05:32:57,500 --> 05:33:05,210
is going to depend on the font itself. So
we explained a little bit about font families
3859
05:33:05,210 --> 05:33:10,930
in that video. And obviously, all of them
have different characteristics. So of course,
3860
05:33:10,930 --> 05:33:16,910
like I said, it depends completely on the
type of font. So if I go ahead and see the
3861
05:33:16,910 --> 05:33:27,862
family there, you can see that that sans serif.
But if we use something like this font, it's
3862
05:33:27,862 --> 05:33:34,960
going to be a different font family. So that's
just one thing you need to keep in mind is
3863
05:33:34,960 --> 05:33:42,710
that you want to make sure your fallback font
is both included on every machine. And it's
3864
05:33:42,710 --> 05:33:50,550
kind of similar to our font here. Now, if
I actually go ahead and erase this, now let's
3865
05:33:50,550 --> 05:33:57,160
go ahead and see, obviously, there is a visual
difference, but it still has that same style.
3866
05:33:57,160 --> 05:34:02,720
There's no lines, it's clean to read. It's
just straightforward. So that's one thing
3867
05:34:02,720 --> 05:34:04,872
you want to make sure of. Alright, so that's
pretty much it for fonts. Next, we're going
3868
05:34:04,872 --> 05:34:10,332
to move on to layout, which is really gonna
change the way that this website looks. Alright,
3869
05:34:10,332 --> 05:34:11,332
let's move on.
3870
05:34:11,332 --> 05:34:17,352
So the next few videos are going to be focused
on CSS layout. So we're pretty much done,
3871
05:34:17,352 --> 05:34:21,272
at least for now with coloring and text and
all of the cool features we can do with them.
3872
05:34:21,272 --> 05:34:25,210
But now we're gonna actually go through and
start using our skills with different well,
3873
05:34:25,210 --> 05:34:28,800
new skills that we can actually put together
and create really, really nice, awesome websites.
3874
05:34:28,800 --> 05:34:32,772
So layout is probably one of the most powerful
tools that you can use in CSS and completely
3875
05:34:32,772 --> 05:34:37,590
change the way your website looks. But before
we move on, we need to learn a little bit
3876
05:34:37,590 --> 05:34:40,141
of theory behind how CSS works. So there's
this concept in CSS called the box model,
3877
05:34:40,141 --> 05:34:43,192
and it's pretty much the the what happens
is every Simple element is surrounded by an
3878
05:34:43,192 --> 05:34:46,470
invisible box. Now this box has different
layers, which we're going to explain in the
3879
05:34:46,470 --> 05:34:49,922
next video. But all of these boxes are touching
together, they're kind of connected, what
3880
05:34:49,922 --> 05:34:54,470
you can do is actually change the shapes of
these boxes and change the shapes of the layers
3881
05:34:54,470 --> 05:34:58,740
in order to move things around, and position
them on a page in a way that makes the website
3882
05:34:58,740 --> 05:35:02,210
look much better. Now, obviously, this isn't
the only way of shaping your website, there
3883
05:35:02,210 --> 05:35:09,022
are so many different methods, Flexbox, and
grid, and we're all going to cover them later
3884
05:35:09,022 --> 05:35:18,210
in this course. But for now, this is the basic
kind of layout features that you need to use,
3885
05:35:18,210 --> 05:35:30,430
so that you can move on and start using some
of the most complex features. So this is kind
3886
05:35:30,430 --> 05:35:35,590
of what that invisible box looks like. So
at the center is where your content is. Now
3887
05:35:35,590 --> 05:35:42,080
I'm going to explain this in just a second,
all of these little terms, padding, border
3888
05:35:42,080 --> 05:35:46,910
and margin. But you can see that the center
contains the content. But then the other three
3889
05:35:46,910 --> 05:35:50,152
layers are something completely unknown. And
we're going to be going through and explaining
3890
05:35:50,152 --> 05:35:54,372
what those do. But for now, just understand
that you have the content on the center. But
3891
05:35:54,372 --> 05:35:58,952
then there's this invisible box around it,
that is split up into three layers. So let's
3892
05:35:58,952 --> 05:36:03,580
go over the first one, which is the padding.
Now the padding represents the space between
3893
05:36:03,580 --> 05:36:08,880
the content and the border of the content.
Now you can see up in this model, we have
3894
05:36:08,880 --> 05:36:15,622
this padding section, and then we have a border.
So pretty much what the border does is it
3895
05:36:15,622 --> 05:36:16,770
separates the content and the padding from
the margin. But pretty much let's just assume
3896
05:36:16,770 --> 05:36:21,242
for now that the margin kind of move things
around, and it doesn't actually move the content
3897
05:36:21,242 --> 05:36:26,932
around, what padding is supposed to do is
it's basically supposed to give more room
3898
05:36:26,932 --> 05:36:31,670
around the content itself, it's not really
meant to move the content around. So it'll
3899
05:36:31,670 --> 05:36:36,100
make some more sense when I go over margin
if you don't understand it now, but let's
3900
05:36:36,100 --> 05:36:39,942
move on to the next layer. The border is pretty
much the divide, or the separation line between
3901
05:36:39,942 --> 05:36:43,930
the content, the padding and the margin. So
borders can be styled and changed. And by
3902
05:36:43,930 --> 05:36:48,060
default, they're invisible. But we can actually
go through and change how they look which
3903
05:36:48,060 --> 05:36:53,050
we're going to be going through in a couple
videos time. So the border doesn't actually
3904
05:36:53,050 --> 05:36:59,170
create any spacing or anything itself, unless
you wanted to. But pretty much what the border
3905
05:36:59,170 --> 05:37:08,272
is supposed to be is kind of that division
line. So the last layer that I want to talk
3906
05:37:08,272 --> 05:37:11,310
about is the margin. So just like how the
padding is supposed to give spacing, or well
3907
05:37:11,310 --> 05:37:14,292
padding around the content, the margin is
supposed to move the content around and give
3908
05:37:14,292 --> 05:37:18,862
it space between other elements. So while
the padding is used for internal space, the
3909
05:37:18,862 --> 05:37:23,990
margin is used for external space and is made.
So that to give room and spacing around external
3910
05:37:23,990 --> 05:37:28,442
elements. So for example, if you have an image
and then some text under it, you can use the
3911
05:37:28,442 --> 05:37:36,412
margin of the text to kind of push it down
from the image, whereas the padding will just
3912
05:37:36,412 --> 05:37:43,872
kind of make internal space. Now, although
it's not the best example, as we go on and
3913
05:37:43,872 --> 05:37:49,922
start using it, you'll get this a lot more
if you don't already. Alright, so that's pretty
3914
05:37:49,922 --> 05:37:54,542
much it for the box model. It's a very, very
simple concept. But it can be really used
3915
05:37:54,542 --> 05:37:59,710
to a very high potential, and it does contain
a lot of features that we're going to be going
3916
05:37:59,710 --> 05:38:02,192
over in the next few videos. Alright, let's
move on.
3917
05:38:02,192 --> 05:38:07,550
So the next few videos are going to be focused
on CSS layout. So we're pretty much done,
3918
05:38:07,550 --> 05:38:12,310
at least for now with coloring and text and
all of the cool features we can do with them.
3919
05:38:12,310 --> 05:38:17,470
But now we're gonna actually go through and
start using our skills with different well,
3920
05:38:17,470 --> 05:38:23,372
new skills that we can actually put together
and create really, really nice, awesome websites.
3921
05:38:23,372 --> 05:38:27,490
So layout is probably one of the most powerful
tools that you can use in CSS and completely
3922
05:38:27,490 --> 05:38:30,390
change the way your website looks. But before
we move on, we need to learn a little bit
3923
05:38:30,390 --> 05:38:36,800
of theory behind how CSS works. So there's
this concept in CSS called the box model,
3924
05:38:36,800 --> 05:38:43,210
and it's pretty much the the what happens
is every Simple element is surrounded by an
3925
05:38:43,210 --> 05:38:48,090
invisible box. Now this box has different
layers, which we're going to explain in the
3926
05:38:48,090 --> 05:38:52,292
next video. But all of these boxes are touching
together, they're kind of connected, what
3927
05:38:52,292 --> 05:38:58,842
you can do is actually change the shapes of
these boxes and change the shapes of the layers
3928
05:38:58,842 --> 05:39:02,912
in order to move things around, and position
them on a page in a way that makes the website
3929
05:39:02,912 --> 05:39:07,390
look much better. Now, obviously, this isn't
the only way of shaping your website, there
3930
05:39:07,390 --> 05:39:12,050
are so many different methods, Flexbox, and
grid, and we're all going to cover them later
3931
05:39:12,050 --> 05:39:18,670
in this course. But for now, this is the basic
kind of layout features that you need to use,
3932
05:39:18,670 --> 05:39:26,240
so that you can move on and start using some
of the most complex features. So this is kind
3933
05:39:26,240 --> 05:39:32,130
of what that invisible box looks like. So
at the center is where your content is. Now
3934
05:39:32,130 --> 05:39:37,922
I'm going to explain this in just a second,
all of these little terms, padding, border
3935
05:39:37,922 --> 05:39:44,150
and margin. But you can see that the center
contains the content. But then the other three
3936
05:39:44,150 --> 05:39:46,532
layers are something completely unknown. And
we're going to be going through and explaining
3937
05:39:46,532 --> 05:39:48,880
what those do. But for now, just understand
that you have the content on the center. But
3938
05:39:48,880 --> 05:39:52,750
then there's this invisible box around it,
that is split up into three layers. So let's
3939
05:39:52,750 --> 05:39:56,420
go over the first one, which is the padding.
Now the padding represents the space between
3940
05:39:56,420 --> 05:40:01,032
the content and the border of the content.
Now you can see up in this model, we have
3941
05:40:01,032 --> 05:40:06,560
this padding section, and then we have a border.
So pretty much what the border does is it
3942
05:40:06,560 --> 05:40:11,942
separates the content and the padding from
the margin. But pretty much let's just assume
3943
05:40:11,942 --> 05:40:23,500
for now that the margin kind of move things
around, and it doesn't actually move the content
3944
05:40:23,500 --> 05:40:26,980
around, what padding is supposed to do is
it's basically supposed to give more room
3945
05:40:26,980 --> 05:40:31,250
around the content itself, it's not really
meant to move the content around. So it'll
3946
05:40:31,250 --> 05:40:35,622
make some more sense when I go over margin
if you don't understand it now, but let's
3947
05:40:35,622 --> 05:40:38,430
move on to the next layer. The border is pretty
much the divide, or the separation line between
3948
05:40:38,430 --> 05:40:41,260
the content, the padding and the margin. So
borders can be styled and changed. And by
3949
05:40:41,260 --> 05:40:45,430
default, they're invisible. But we can actually
go through and change how they look which
3950
05:40:45,430 --> 05:40:49,172
we're going to be going through in a couple
videos time. So the border doesn't actually
3951
05:40:49,172 --> 05:40:53,300
create any spacing or anything itself, unless
you wanted to. But pretty much what the border
3952
05:40:53,300 --> 05:40:59,730
is supposed to be is kind of that division
line. So the last layer that I want to talk
3953
05:40:59,730 --> 05:41:05,192
about is the margin. So just like how the
padding is supposed to give spacing, or well
3954
05:41:05,192 --> 05:41:09,810
padding around the content, the margin is
supposed to move the content around and give
3955
05:41:09,810 --> 05:41:13,000
it space between other elements. So while
the padding is used for internal space, the
3956
05:41:13,000 --> 05:41:19,230
margin is used for external space and is made.
So that to give room and spacing around external
3957
05:41:19,230 --> 05:41:24,590
elements. So for example, if you have an image
and then some text under it, you can use the
3958
05:41:24,590 --> 05:41:29,130
margin of the text to kind of push it down
from the image, whereas the padding will just
3959
05:41:29,130 --> 05:41:32,872
kind of make internal space. Now, although
it's not the best example, as we go on and
3960
05:41:32,872 --> 05:41:35,240
start using it, you'll get this a lot more
if you don't already. Alright, so that's pretty
3961
05:41:35,240 --> 05:41:39,952
much it for the box model. It's a very, very
simple concept. But it can be really used
3962
05:41:39,952 --> 05:41:45,130
to a very high potential, and it does contain
a lot of features that we're going to be going
3963
05:41:45,130 --> 05:41:48,252
over in the next few videos. Alright, let's
move on.
3964
05:41:48,252 --> 05:41:51,300
So now what we're going to be doing is going
through and starting to use the first layer
3965
05:41:51,300 --> 05:41:56,300
of the box model, which in this case is the
content itself. So although not technically
3966
05:41:56,300 --> 05:42:02,520
a layer of this invisible box, it's still
a big part of layout, and the shaping of things
3967
05:42:02,520 --> 05:42:08,240
on your document, because the way you shape
and while style, your content is going to
3968
05:42:08,240 --> 05:42:12,680
completely change how the rest of the box
models affected your padding and your margin.
3969
05:42:12,680 --> 05:42:16,122
So what we're going to be doing is going through
and using some of these. And if you actually
3970
05:42:16,122 --> 05:42:20,720
remember, right here, we have already used
the two main features of shaping content,
3971
05:42:20,720 --> 05:42:26,170
height and width. So we've already pretty
much learned these properties. But I'm going
3972
05:42:26,170 --> 05:42:31,800
to go through and do a couple more examples
just so you can get the shape of things and
3973
05:42:31,800 --> 05:42:38,702
how to use them. So first thing I want to
talk about is the units that you should use.
3974
05:42:38,702 --> 05:42:43,550
So usually on a page, the best way to do this
is using pixels or some absolute unit for
3975
05:42:43,550 --> 05:42:47,180
height. But then for width, use a relative
units such as v w, or percentage. Now we do
3976
05:42:47,180 --> 05:42:48,180
this because although height is very, very
hard to determine responsively at least, they
3977
05:42:48,180 --> 05:42:51,800
kind of stay the same as you move down so
the height is going to kind of stay consistent.
3978
05:42:51,800 --> 05:42:57,452
The only problem is the width completely changes
everything. So the width of devices is very
3979
05:42:57,452 --> 05:43:02,240
different from place to place. So a phone
would be quite a small width whereas you know
3980
05:43:02,240 --> 05:43:08,250
full screen TV would be very wide width. So
that's why you use relative units for width
3981
05:43:08,250 --> 05:43:12,742
is that you can keep it consistent. Or still,
you can keep both of the values consistent
3982
05:43:12,742 --> 05:43:16,480
while still using different units. So let's
go through and actually use it on this image
3983
05:43:16,480 --> 05:43:21,430
here. So the first thing I want to do is go
ahead and give this a class, we're actually
3984
05:43:21,430 --> 05:43:26,752
I'm going to give it an ID. So I'm going to
give it an ID of about us image, just like
3985
05:43:26,752 --> 05:43:34,140
that. All right, now, let's go ahead and select
it here, I'm going to go hash about us image.
3986
05:43:34,140 --> 05:43:38,340
Remember the id selector. And now what we're
going to do is go through and start adding
3987
05:43:38,340 --> 05:43:42,050
our, our properties. So the first thing I'm
going to add is the height. So I'm just going
3988
05:43:42,050 --> 05:43:48,990
to make this a cool 300 pixels, just to see
how it is. And most of this is very experimental,
3989
05:43:48,990 --> 05:43:51,250
you're not supposed to go through and change
everything. And, you know, well, well you
3990
05:43:51,250 --> 05:43:52,271
are, but you're not supposed to go through
and set everything to a constant value. So
3991
05:43:52,271 --> 05:43:54,140
you're supposed to, you know, play around,
see what works. And then once you're familiar
3992
05:43:54,140 --> 05:43:58,520
with it, and once you know what you want,
you can leave it as it is. So there we go,
3993
05:43:58,520 --> 05:44:01,770
we set the height. Now, obviously, this with
the width of the image itself is always relative,
3994
05:44:01,770 --> 05:44:06,332
but I'm going to go ahead and change it anyways,
I'm going to go ahead and say the width is
3995
05:44:06,332 --> 05:44:11,110
60 v w. Now, you could always say 60%, it
would pretty much be the same thing. But I'm
3996
05:44:11,110 --> 05:44:13,112
going to go ahead and use v w here just to
3997
05:44:13,112 --> 05:44:16,182
So now what we're going to be doing is going
through and starting to use the first layer
3998
05:44:16,182 --> 05:44:20,622
of the box model, which in this case is the
content itself. So although not technically
3999
05:44:20,622 --> 05:44:26,000
a layer of this invisible box, it's still
a big part of layout, and the shaping of things
4000
05:44:26,000 --> 05:44:31,862
on your document, because the way you shape
and while style, your content is going to
4001
05:44:31,862 --> 05:44:35,640
completely change how the rest of the box
models affected your padding and your margin.
4002
05:44:35,640 --> 05:44:41,400
So what we're going to be doing is going through
and using some of these. And if you actually
4003
05:44:41,400 --> 05:44:44,430
remember, right here, we have already used
the two main features of shaping content,
4004
05:44:44,430 --> 05:44:49,470
height and width. So we've already pretty
much learned these properties. But I'm going
4005
05:44:49,470 --> 05:44:56,380
to go through and do a couple more examples
just so you can get the shape of things and
4006
05:44:56,380 --> 05:44:59,412
how to use them. So first thing I want to
talk about is the units that you should use.
4007
05:44:59,412 --> 05:45:03,670
So usually on a page, the best way to do this
is using pixels or some absolute unit for
4008
05:45:03,670 --> 05:45:07,930
height. But then for width, use a relative
units such as v w, or percentage. Now we do
4009
05:45:07,930 --> 05:45:12,242
this because although height is very, very
hard to determine responsively at least, they
4010
05:45:12,242 --> 05:45:16,660
kind of stay the same as you move down so
the height is going to kind of stay consistent.
4011
05:45:16,660 --> 05:45:23,082
The only problem is the width completely changes
everything. So the width of devices is very
4012
05:45:23,082 --> 05:45:27,210
different from place to place. So a phone
would be quite a small width whereas you know
4013
05:45:27,210 --> 05:45:33,010
full screen TV would be very wide width. So
that's why you use relative units for width
4014
05:45:33,010 --> 05:45:37,372
is that you can keep it consistent. Or still,
you can keep both of the values consistent
4015
05:45:37,372 --> 05:45:41,542
while still using different units. So let's
go through and actually use it on this image
4016
05:45:41,542 --> 05:45:52,773
here. So the first thing I want to do is go
ahead and give this a class, we're actually
4017
05:45:52,773 --> 05:45:58,782
I'm going to give it an ID. So I'm going to
give it an ID of about us image, just like
4018
05:45:58,782 --> 05:46:08,550
that. All right, now, let's go ahead and select
it here, I'm going to go hash about us image.
4019
05:46:08,550 --> 05:46:13,372
Remember the id selector. And now what we're
going to do is go through and start adding
4020
05:46:13,372 --> 05:46:21,792
our, our properties. So the first thing I'm
going to add is the height. So I'm just going
4021
05:46:21,792 --> 05:46:26,532
to make this a cool 300 pixels, just to see
how it is. And most of this is very experimental,
4022
05:46:26,532 --> 05:46:30,751
you're not supposed to go through and change
everything. And, you know, well, well you
4023
05:46:30,751 --> 05:46:35,292
are, but you're not supposed to go through
and set everything to a constant value. So
4024
05:46:35,292 --> 05:46:40,730
you're supposed to, you know, play around,
see what works. And then once you're familiar
4025
05:46:40,730 --> 05:46:50,890
with it, and once you know what you want,
you can leave it as it is. So there we go,
4026
05:46:50,890 --> 05:46:55,622
we set the height. Now, obviously, this with
the width of the image itself is always relative,
4027
05:46:55,622 --> 05:47:02,480
but I'm going to go ahead and change it anyways,
I'm going to go ahead and say the width is
4028
05:47:02,480 --> 05:47:08,730
60 v w. Now, you could always say 60%, it
would pretty much be the same thing. But I'm
4029
05:47:08,730 --> 05:47:12,260
going to go ahead and use v w here just to
4030
05:47:12,260 --> 05:47:17,560
actually, you know what, we have V w here
already, so I'm going to go ahead and add
4031
05:47:17,560 --> 05:47:18,930
percentage, there we go. Now, of course, you
could use whichever unit you want, they're
4032
05:47:18,930 --> 05:47:20,170
gonna mean pretty much the same thing. Obviously,
apart from the different viewports, and things
4033
05:47:20,170 --> 05:47:27,830
like that, but they're pretty much the same
for our purposes. So you can use whichever
4034
05:47:27,830 --> 05:47:33,150
one you want. So there we go, we've changed
it. Now if we go ahead and resize of most,
4035
05:47:33,150 --> 05:47:39,260
you can actually go ahead and see that the
width is going to be pretty much the same,
4036
05:47:39,260 --> 05:47:43,640
well, the height stays constant. So one thing
I want to talk about is a really cool feature
4037
05:47:43,640 --> 05:47:50,100
that we can use in Chrome. And you can see
that's a little bit weird there. But we'll
4038
05:47:50,100 --> 05:47:57,960
worry about it, we'll worry about that later,
is a really cool feature that allows you to
4039
05:47:57,960 --> 05:48:01,952
actually change the viewport of your Chrome
window without actually having to use different
4040
05:48:01,952 --> 05:48:07,080
devices. So if you go ahead and click on the
icon, just right click anywhere on the page,
4041
05:48:07,080 --> 05:48:09,910
click on Inspect, and it's going to bring
you here to this page. And you can actually
4042
05:48:09,910 --> 05:48:14,782
select any device you want from the drop down
menu and see how it would look on that on
4043
05:48:14,782 --> 05:48:18,702
that device. So I can pretty much do whatever
I want here. If I wanted to select an iPad,
4044
05:48:18,702 --> 05:48:23,410
even an iPad Pro, you can actually see what
it would look like on the device. So this
4045
05:48:23,410 --> 05:48:28,210
is a really useful feature that you can use
to make sure that your website works everywhere,
4046
05:48:28,210 --> 05:48:41,582
instead of having to go and upload it somewhere
and then view it on all those different devices.
4047
05:48:41,582 --> 05:48:46,452
You can also set select this responsive design,
which I really liked, because then you can
4048
05:48:46,452 --> 05:48:54,310
change the size however you want. Just like
that you can see, and it will work perfectly.
4049
05:48:54,310 --> 05:48:57,710
So yeah, that's great. And you know, if maybe
if you don't want to use these devices from
4050
05:48:57,710 --> 05:49:02,952
this drop down menu, you can actually go through
and change the size here, which is really
4051
05:49:02,952 --> 05:49:08,872
useful. So I'm going to go ahead and close
this off now. And you can see that our website
4052
05:49:08,872 --> 05:49:13,180
is looking good. Obviously, our image here,
it looks quite weird. But like I said, it's
4053
05:49:13,180 --> 05:49:16,602
all about experimentation, you're supposed
to go through and see what works. And obviously,
4054
05:49:16,602 --> 05:49:21,400
you don't have to use an absolute value. It's
not set in stone, but you're supposed to go
4055
05:49:21,400 --> 05:49:29,342
through and see what works for you. And from
there, you can set the value. So this is just
4056
05:49:29,342 --> 05:49:33,442
kind of a little experimental thing to teach
you how to use these features. But like I
4057
05:49:33,442 --> 05:49:38,720
said, this website's all about what this course
is all about practicing and getting experienced
4058
05:49:38,720 --> 05:49:46,210
with this. So you can go through, check out
the project files and play around with these
4059
05:49:46,210 --> 05:49:51,960
values yourself, really get a feel for how
this works. So that's pretty much it for content
4060
05:49:51,960 --> 05:49:55,872
resizing, it's very easy, there's only two
properties you need to know. And pretty much
4061
05:49:55,872 --> 05:50:00,932
the rest of the box model is also quite easy.
But it's good that we learn it step by step
4062
05:50:00,932 --> 05:50:06,502
so that we master every stage and by the end
of it, we'll really know how to master the
4063
05:50:06,502 --> 05:50:10,060
layout and really manipulate our page in the
best possible way. Alright, let's move on.
4064
05:50:10,060 --> 05:50:18,220
actually, you know what, we have V w here
already, so I'm going to go ahead and add
4065
05:50:18,220 --> 05:50:25,043
percentage, there we go. Now, of course, you
could use whichever unit you want, they're
4066
05:50:25,043 --> 05:50:29,282
gonna mean pretty much the same thing. Obviously,
apart from the different viewports, and things
4067
05:50:29,282 --> 05:50:32,452
like that, but they're pretty much the same
for our purposes. So you can use whichever
4068
05:50:32,452 --> 05:50:38,150
one you want. So there we go, we've changed
it. Now if we go ahead and resize of most,
4069
05:50:38,150 --> 05:50:43,372
you can actually go ahead and see that the
width is going to be pretty much the same,
4070
05:50:43,372 --> 05:50:44,942
well, the height stays constant. So one thing
I want to talk about is a really cool feature
4071
05:50:44,942 --> 05:50:48,782
that we can use in Chrome. And you can see
that's a little bit weird there. But we'll
4072
05:50:48,782 --> 05:50:53,010
worry about it, we'll worry about that later,
is a really cool feature that allows you to
4073
05:50:53,010 --> 05:51:00,002
actually change the viewport of your Chrome
window without actually having to use different
4074
05:51:00,002 --> 05:51:05,020
devices. So if you go ahead and click on the
icon, just right click anywhere on the page,
4075
05:51:05,020 --> 05:51:10,452
click on Inspect, and it's going to bring
you here to this page. And you can actually
4076
05:51:10,452 --> 05:51:15,550
select any device you want from the drop down
menu and see how it would look on that on
4077
05:51:15,550 --> 05:51:20,292
that device. So I can pretty much do whatever
I want here. If I wanted to select an iPad,
4078
05:51:20,292 --> 05:51:26,930
even an iPad Pro, you can actually see what
it would look like on the device. So this
4079
05:51:26,930 --> 05:51:32,770
is a really useful feature that you can use
to make sure that your website works everywhere,
4080
05:51:32,770 --> 05:51:38,242
instead of having to go and upload it somewhere
and then view it on all those different devices.
4081
05:51:38,242 --> 05:51:43,050
You can also set select this responsive design,
which I really liked, because then you can
4082
05:51:43,050 --> 05:51:47,272
change the size however you want. Just like
that you can see, and it will work perfectly.
4083
05:51:47,272 --> 05:51:52,760
So yeah, that's great. And you know, if maybe
if you don't want to use these devices from
4084
05:51:52,760 --> 05:51:56,672
this drop down menu, you can actually go through
and change the size here, which is really
4085
05:51:56,672 --> 05:52:01,300
useful. So I'm going to go ahead and close
this off now. And you can see that our website
4086
05:52:01,300 --> 05:52:05,740
is looking good. Obviously, our image here,
it looks quite weird. But like I said, it's
4087
05:52:05,740 --> 05:52:07,990
all about experimentation, you're supposed
to go through and see what works. And obviously,
4088
05:52:07,990 --> 05:52:14,310
you don't have to use an absolute value. It's
not set in stone, but you're supposed to go
4089
05:52:14,310 --> 05:52:22,050
through and see what works for you. And from
there, you can set the value. So this is just
4090
05:52:22,050 --> 05:52:28,792
kind of a little experimental thing to teach
you how to use these features. But like I
4091
05:52:28,792 --> 05:52:33,772
said, this website's all about what this course
is all about practicing and getting experienced
4092
05:52:33,772 --> 05:52:39,282
with this. So you can go through, check out
the project files and play around with these
4093
05:52:39,282 --> 05:52:45,760
values yourself, really get a feel for how
this works. So that's pretty much it for content
4094
05:52:45,760 --> 05:52:52,430
resizing, it's very easy, there's only two
properties you need to know. And pretty much
4095
05:52:52,430 --> 05:52:58,192
the rest of the box model is also quite easy.
But it's good that we learn it step by step
4096
05:52:58,192 --> 05:53:05,800
so that we master every stage and by the end
of it, we'll really know how to master the
4097
05:53:05,800 --> 05:53:10,282
layout and really manipulate our page in the
best possible way. Alright, let's move on.
4098
05:53:10,282 --> 05:53:15,650
So in this video, we're going to be focusing
on one of the parts of the box model, which
4099
05:53:15,650 --> 05:53:21,042
are mortars. So in the previous video, I talked
a little bit about some of the different layers
4100
05:53:21,042 --> 05:53:27,612
of the box model and how they work. But in
this video, we're actually going to be focusing
4101
05:53:27,612 --> 05:53:34,420
on manipulating one of those layers, which
is the border. And although it's not the really
4102
05:53:34,420 --> 05:53:41,390
the main part of the whole box model idea,
it's still a pretty useful skill to know and
4103
05:53:41,390 --> 05:53:47,750
it really helps you understand how the box
model comes together. Alright, let's get started.
4104
05:53:47,750 --> 05:53:52,170
So for the next few videos, we're mainly going
to be working with the images simply because
4105
05:53:52,170 --> 05:53:56,560
they're just easier to manipulate and set
the layout over something working with something
4106
05:53:56,560 --> 05:54:02,102
like that. text or titles, things like that.
So we're going to be working with our circular
4107
05:54:02,102 --> 05:54:07,590
gray here that we created in a previous video,
as well as this custom image. So let's get
4108
05:54:07,590 --> 05:54:11,622
started. So now there are many different styles
that you can use to style the borders. But
4109
05:54:11,622 --> 05:54:15,942
we're going to be using the main shorthand
that allows us to style everything all at
4110
05:54:15,942 --> 05:54:19,852
once. So the property is similar to our background
property here, all you need to type is border,
4111
05:54:19,852 --> 05:54:24,810
whoops, you do on the image. So I'm going
to go here on our radial gradients. And I'm
4112
05:54:24,810 --> 05:54:31,980
going to start adding our border. So let's
go ahead and get started. So what I'm going
4113
05:54:31,980 --> 05:54:36,520
to do is just type border. And remember, every
single element has a box around it has this
4114
05:54:36,520 --> 05:54:40,202
box model or invisible box. So it doesn't
matter what you choose, you can always style
4115
05:54:40,202 --> 05:54:45,412
these elements, it might look weird on some
elements like this text here, but you can
4116
05:54:45,412 --> 05:54:51,310
do it with everything. So there are three
main parts to this element here. First is
4117
05:54:51,310 --> 05:54:57,920
going to be the size. So we'll talk about
that in a second, then you're going to have
4118
05:54:57,920 --> 05:55:03,160
the style, which is probably the main part.
And then finally, you're going to have the
4119
05:55:03,160 --> 05:55:06,050
color. So now that we have this, we can go
ahead and start talking about this. So size
4120
05:55:06,050 --> 05:55:07,592
is pretty similar to you know, changing the
size of an image, for example, yeah, it can
4121
05:55:07,592 --> 05:55:10,262
be in pixels percent or em, it doesn't matter,
I'm going to go with pixels for now. Now,
4122
05:55:10,262 --> 05:55:13,770
the usual range for a border is somewhere
between, you know, one and three or four pixels,
4123
05:55:13,770 --> 05:55:18,320
we can go much thicker than that, depending
on what you need. So I'm going to go ahead
4124
05:55:18,320 --> 05:55:23,300
and show you want to pixels looked like. So
remember separated by a space. Now we're going
4125
05:55:23,300 --> 05:55:28,460
to go over the style. So there are many different
styles you can use on your borders. But there's
4126
05:55:28,460 --> 05:55:34,080
three main ones that we're going to talk about,
or sorry, four main ones, we're going to talk
4127
05:55:34,080 --> 05:55:38,172
about dotted, dashed, solid and double. Now
normally, you're going to see solid, that's
4128
05:55:38,172 --> 05:55:44,880
pretty much the most common one, I'll show
you the other versions of this in just a second.
4129
05:55:44,880 --> 05:55:50,490
So I'm going to go ahead and type solid, and
now come to the color. So as we learned refer
4130
05:55:50,490 --> 05:55:54,760
before this can be a named color, this can
be an RGB code, or even a hex code, I'm going
4131
05:55:54,760 --> 05:55:59,442
to go ahead and just choose a darkish blue,
I think that will fit in really well with
4132
05:55:59,442 --> 05:56:03,820
the page. And in fact, you know what, let's
not, let's not use the color picker, let's
4133
05:56:03,820 --> 05:56:08,810
just use our RGB color skills. And take the
color of the background, which is here. So
4134
05:56:08,810 --> 05:56:16,362
we're going to take those four. And I'm going
to go back to our image here and paste it
4135
05:56:16,362 --> 05:56:22,042
in. And now what I'm going to do is just darken
everything. And if you remember, the darker
4136
05:56:22,042 --> 05:56:24,840
it gets the higher oak sorry, the lower all
of these values get. So I'm just going to
4137
05:56:24,840 --> 05:56:29,100
lower them all by about 50. So here, I'm just
going to go 154. Now, again, this doesn't
4138
05:56:29,100 --> 05:56:33,410
have to be exact, or anything you can, you
can put really, whatever you want here, but
4139
05:56:33,410 --> 05:56:37,692
I'm just trying to darken everything, I'm
just gonna make this 200. Let's go ahead and
4140
05:56:37,692 --> 05:56:42,202
refresh the page and see how our border looks.
Now. Let's scroll down. So there's the problem,
4141
05:56:42,202 --> 05:56:48,762
we actually forgot a semicolon here on the
end of the background. So that's one thing
4142
05:56:48,762 --> 05:56:52,810
you need to keep in mind. There we go. Now
it's working. And you can see and I did actually
4143
05:56:52,810 --> 05:56:55,970
change the color there just to test it out.
And you can see, there we go, we have our
4144
05:56:55,970 --> 05:56:56,970
background. So obviously, it's pretty obvious
here with our bright red color there. But
4145
05:56:56,970 --> 05:57:00,160
what I'm actually going to do is go ahead
and just play around with some of these and
4146
05:57:00,160 --> 05:57:06,420
see if we can change the features. So first
thing I'm going to do is go ahead and change
4147
05:57:06,420 --> 05:57:13,412
the height. So I'm going to go ahead and set
it as 10 pixels. For example, you can see
4148
05:57:13,412 --> 05:57:19,840
that they open up the height sorry, the size,
you can see that that gets a lot thicker,
4149
05:57:19,840 --> 05:57:26,612
so you can change it depending on how you
want your border to look like. So now let's
4150
05:57:26,612 --> 05:57:33,060
go ahead and change the style. So let's go
ahead and try out some of these other styles.
4151
05:57:33,060 --> 05:57:38,750
So first, I'm going to try dotted. So you
can see now we have a dotted border. Now let's
4152
05:57:38,750 --> 05:57:40,192
go ahead and try dashed.
4153
05:57:40,192 --> 05:57:45,880
So in this video, we're going to be focusing
on one of the parts of the box model, which
4154
05:57:45,880 --> 05:57:52,952
are mortars. So in the previous video, I talked
a little bit about some of the different layers
4155
05:57:52,952 --> 05:58:00,480
of the box model and how they work. But in
this video, we're actually going to be focusing
4156
05:58:00,480 --> 05:58:08,050
on manipulating one of those layers, which
is the border. And although it's not the really
4157
05:58:08,050 --> 05:58:15,230
the main part of the whole box model idea,
it's still a pretty useful skill to know and
4158
05:58:15,230 --> 05:58:20,130
it really helps you understand how the box
model comes together. Alright, let's get started.
4159
05:58:20,130 --> 05:58:24,880
So for the next few videos, we're mainly going
to be working with the images simply because
4160
05:58:24,880 --> 05:58:31,432
they're just easier to manipulate and set
the layout over something working with something
4161
05:58:31,432 --> 05:58:36,542
like that. text or titles, things like that.
So we're going to be working with our circular
4162
05:58:36,542 --> 05:58:42,012
gray here that we created in a previous video,
as well as this custom image. So let's get
4163
05:58:42,012 --> 05:58:46,070
started. So now there are many different styles
that you can use to style the borders. But
4164
05:58:46,070 --> 05:58:50,630
we're going to be using the main shorthand
that allows us to style everything all at
4165
05:58:50,630 --> 05:58:58,710
once. So the property is similar to our background
property here, all you need to type is border,
4166
05:58:58,710 --> 05:59:04,290
whoops, you do on the image. So I'm going
to go here on our radial gradients. And I'm
4167
05:59:04,290 --> 05:59:10,420
going to start adding our border. So let's
go ahead and get started. So what I'm going
4168
05:59:10,420 --> 05:59:13,952
to do is just type border. And remember, every
single element has a box around it has this
4169
05:59:13,952 --> 05:59:19,862
box model or invisible box. So it doesn't
matter what you choose, you can always style
4170
05:59:19,862 --> 05:59:25,272
these elements, it might look weird on some
elements like this text here, but you can
4171
05:59:25,272 --> 05:59:28,140
do it with everything. So there are three
main parts to this element here. First is
4172
05:59:28,140 --> 05:59:31,460
going to be the size. So we'll talk about
that in a second, then you're going to have
4173
05:59:31,460 --> 05:59:34,520
the style, which is probably the main part.
And then finally, you're going to have the
4174
05:59:34,520 --> 05:59:40,730
color. So now that we have this, we can go
ahead and start talking about this. So size
4175
05:59:40,730 --> 05:59:44,470
is pretty similar to you know, changing the
size of an image, for example, yeah, it can
4176
05:59:44,470 --> 05:59:48,490
be in pixels percent or em, it doesn't matter,
I'm going to go with pixels for now. Now,
4177
05:59:48,490 --> 05:59:51,810
the usual range for a border is somewhere
between, you know, one and three or four pixels,
4178
05:59:51,810 --> 05:59:55,332
we can go much thicker than that, depending
on what you need. So I'm going to go ahead
4179
05:59:55,332 --> 05:59:59,430
and show you want to pixels looked like. So
remember separated by a space. Now we're going
4180
05:59:59,430 --> 06:00:04,782
to go over the style. So there are many different
styles you can use on your borders. But there's
4181
06:00:04,782 --> 06:00:09,442
three main ones that we're going to talk about,
or sorry, four main ones, we're going to talk
4182
06:00:09,442 --> 06:00:13,210
about dotted, dashed, solid and double. Now
normally, you're going to see solid, that's
4183
06:00:13,210 --> 06:00:18,380
pretty much the most common one, I'll show
you the other versions of this in just a second.
4184
06:00:18,380 --> 06:00:24,532
So I'm going to go ahead and type solid, and
now come to the color. So as we learned refer
4185
06:00:24,532 --> 06:00:31,640
before this can be a named color, this can
be an RGB code, or even a hex code, I'm going
4186
06:00:31,640 --> 06:00:37,010
to go ahead and just choose a darkish blue,
I think that will fit in really well with
4187
06:00:37,010 --> 06:00:42,590
the page. And in fact, you know what, let's
not, let's not use the color picker, let's
4188
06:00:42,590 --> 06:00:46,365
just use our RGB color skills. And take the
color of the background, which is here. So
4189
06:00:46,365 --> 06:00:58,542
we're going to take those four. And I'm going
to go back to our image here and paste it
4190
06:00:58,542 --> 06:01:03,442
in. And now what I'm going to do is just darken
everything. And if you remember, the darker
4191
06:01:03,442 --> 06:01:08,000
it gets the higher oak sorry, the lower all
of these values get. So I'm just going to
4192
06:01:08,000 --> 06:01:13,202
lower them all by about 50. So here, I'm just
going to go 154. Now, again, this doesn't
4193
06:01:13,202 --> 06:01:18,112
have to be exact, or anything you can, you
can put really, whatever you want here, but
4194
06:01:18,112 --> 06:01:20,872
I'm just trying to darken everything, I'm
just gonna make this 200. Let's go ahead and
4195
06:01:20,872 --> 06:01:29,390
refresh the page and see how our border looks.
Now. Let's scroll down. So there's the problem,
4196
06:01:29,390 --> 06:01:33,362
we actually forgot a semicolon here on the
end of the background. So that's one thing
4197
06:01:33,362 --> 06:01:39,060
you need to keep in mind. There we go. Now
it's working. And you can see and I did actually
4198
06:01:39,060 --> 06:01:45,560
change the color there just to test it out.
And you can see, there we go, we have our
4199
06:01:45,560 --> 06:01:50,000
background. So obviously, it's pretty obvious
here with our bright red color there. But
4200
06:01:50,000 --> 06:01:57,350
what I'm actually going to do is go ahead
and just play around with some of these and
4201
06:01:57,350 --> 06:02:09,452
see if we can change the features. So first
thing I'm going to do is go ahead and change
4202
06:02:09,452 --> 06:02:16,872
the height. So I'm going to go ahead and set
it as 10 pixels. For example, you can see
4203
06:02:16,872 --> 06:02:20,872
that they open up the height sorry, the size,
you can see that that gets a lot thicker,
4204
06:02:20,872 --> 06:02:25,862
so you can change it depending on how you
want your border to look like. So now let's
4205
06:02:25,862 --> 06:02:29,432
go ahead and change the style. So let's go
ahead and try out some of these other styles.
4206
06:02:29,432 --> 06:02:37,390
So first, I'm going to try dotted. So you
can see now we have a dotted border. Now let's
4207
06:02:37,390 --> 06:02:38,770
go ahead and try dashed.
4208
06:02:38,770 --> 06:02:43,380
And you're kind of getting the idea of how
this works. Let's see doubled, I think or
4209
06:02:43,380 --> 06:02:49,292
double actually, I think that's probably the
best other than solid. Yeah, you can see that
4210
06:02:49,292 --> 06:02:55,510
that looks pretty nice. Here, we have that
double border. It's pretty useful in styling,
4211
06:02:55,510 --> 06:03:02,670
but it's not really used very commonly. So
the last thing I want to go ahead and change
4212
06:03:02,670 --> 06:03:10,262
is the color. So I'm going to go ahead and
just take a color from the color picker, I
4213
06:03:10,262 --> 06:03:15,042
don't really feel like going through the whole
RGB process again, let's go ahead and just
4214
06:03:15,042 --> 06:03:16,630
take this color, it's quite dark. Let's go
ahead and refresh our page and see what it
4215
06:03:16,630 --> 06:03:21,460
looks like. And now you can see the color
has changed. So you can see the borders are
4216
06:03:21,460 --> 06:03:27,202
not only useful for just changing the style
of this of an image or a box or any box in
4217
06:03:27,202 --> 06:03:31,702
that for that matter. They're also useful
for showing how the box model works. So I'm
4218
06:03:31,702 --> 06:03:37,000
going to go ahead and change this back to
solid so you can get a better view. So if
4219
06:03:37,000 --> 06:03:43,032
you remember in the last video we talked about
the different layers of the wall model, and
4220
06:03:43,032 --> 06:03:49,300
we remembered that the padding was used to
separate or create spacing between the content
4221
06:03:49,300 --> 06:04:01,352
and the border. In this case, you can see
that the border and the content are directly
4222
06:04:01,352 --> 06:04:07,600
touching, which means there is pretty much
no padding at all, because there's no space
4223
06:04:07,600 --> 06:04:13,410
in between them. On top of that, you can see
that this border is also touching also elements
4224
06:04:13,410 --> 06:04:19,900
on the page or other elements on the page.
So like, for example, this table, there's
4225
06:04:19,900 --> 06:04:26,942
a little bit of space between the header and
the image. But that's due to other margins.
4226
06:04:26,942 --> 06:04:31,410
We'll talk about that when we get later in
this section. And so you can see that this
4227
06:04:31,410 --> 06:04:35,980
doesn't have much margin either. So you can
start to see here how this whole box model
4228
06:04:35,980 --> 06:04:39,550
comes together and how you can see what's
going on. So yeah, that's a pretty useful
4229
06:04:39,550 --> 06:04:44,192
way to kind of look at the box model and see
how everything comes together. In the next
4230
06:04:44,192 --> 06:04:48,380
few videos, we're going to be looking at the
other layers of the box model. And then we're
4231
06:04:48,380 --> 06:04:53,162
going to bring it all together and start really
changing up this the way this website looks.
4232
06:04:53,162 --> 06:04:54,692
Alright, let's move on.
4233
06:04:54,692 --> 06:05:01,202
And you're kind of getting the idea of how
this works. Let's see doubled, I think or
4234
06:05:01,202 --> 06:05:07,332
double actually, I think that's probably the
best other than solid. Yeah, you can see that
4235
06:05:07,332 --> 06:05:13,072
that looks pretty nice. Here, we have that
double border. It's pretty useful in styling,
4236
06:05:13,072 --> 06:05:20,442
but it's not really used very commonly. So
the last thing I want to go ahead and change
4237
06:05:20,442 --> 06:05:25,300
is the color. So I'm going to go ahead and
just take a color from the color picker, I
4238
06:05:25,300 --> 06:05:31,692
don't really feel like going through the whole
RGB process again, let's go ahead and just
4239
06:05:31,692 --> 06:05:42,730
take this color, it's quite dark. Let's go
ahead and refresh our page and see what it
4240
06:05:42,730 --> 06:05:47,750
looks like. And now you can see the color
has changed. So you can see the borders are
4241
06:05:47,750 --> 06:05:53,741
not only useful for just changing the style
of this of an image or a box or any box in
4242
06:05:53,741 --> 06:05:59,980
that for that matter. They're also useful
for showing how the box model works. So I'm
4243
06:05:59,980 --> 06:06:05,442
going to go ahead and change this back to
solid so you can get a better view. So if
4244
06:06:05,442 --> 06:06:10,900
you remember in the last video we talked about
the different layers of the wall model, and
4245
06:06:10,900 --> 06:06:15,560
we remembered that the padding was used to
separate or create spacing between the content
4246
06:06:15,560 --> 06:06:18,592
and the border. In this case, you can see
that the border and the content are directly
4247
06:06:18,592 --> 06:06:21,692
touching, which means there is pretty much
no padding at all, because there's no space
4248
06:06:21,692 --> 06:06:26,032
in between them. On top of that, you can see
that this border is also touching also elements
4249
06:06:26,032 --> 06:06:31,390
on the page or other elements on the page.
So like, for example, this table, there's
4250
06:06:31,390 --> 06:06:36,422
a little bit of space between the header and
the image. But that's due to other margins.
4251
06:06:36,422 --> 06:06:40,470
We'll talk about that when we get later in
this section. And so you can see that this
4252
06:06:40,470 --> 06:06:43,970
doesn't have much margin either. So you can
start to see here how this whole box model
4253
06:06:43,970 --> 06:06:52,002
comes together and how you can see what's
going on. So yeah, that's a pretty useful
4254
06:06:52,002 --> 06:07:01,432
way to kind of look at the box model and see
how everything comes together. In the next
4255
06:07:01,432 --> 06:07:08,262
few videos, we're going to be looking at the
other layers of the box model. And then we're
4256
06:07:08,262 --> 06:07:13,000
going to bring it all together and start really
changing up this the way this website looks.
4257
06:07:13,000 --> 06:07:14,702
Alright, let's move on.
4258
06:07:14,702 --> 06:07:19,500
So in this video, we're going to be moving
on to the next two main layers of our box
4259
06:07:19,500 --> 06:07:23,542
model. And in this video, we're going to be
talking about margin and padding. So you kind
4260
06:07:23,542 --> 06:07:26,792
of already have an idea of what these two
are, we've talked about them. In the first
4261
06:07:26,792 --> 06:07:31,500
video, we've talked about what they do, we
haven't actually talked about how to manipulate
4262
06:07:31,500 --> 06:07:39,320
them. So in this video, what I'm going to
be doing, what I'm going to be doing is going
4263
06:07:39,320 --> 06:07:43,282
through and working with these two properties
to actually manipulate our layout. And that's
4264
06:07:43,282 --> 06:07:46,570
when the real power of the box model shows.
So let's go ahead and get started. The first
4265
06:07:46,570 --> 06:07:49,672
thing I want to do is go ahead and choose
the right thing to manipulate. And in this
4266
06:07:49,672 --> 06:07:53,920
case, the best thing to work with is an image
right here, because it's very easy to see
4267
06:07:53,920 --> 06:08:00,710
and see the changes when you when you do these
margin padding changes. And it's also very
4268
06:08:00,710 --> 06:08:07,752
useful to have a border here, which I added,
you can really see the difference between
4269
06:08:07,752 --> 06:08:12,782
margin and padding and see which one is responsible
for what. So let's get started. Now similar
4270
06:08:12,782 --> 06:08:18,532
to the rest of the properties, the naming
is pretty straightforward. In this case, we're
4271
06:08:18,532 --> 06:08:22,952
going to go ahead and use the shorthand margin
property. But I'm also going to be showing
4272
06:08:22,952 --> 06:08:25,890
you a few other ways, which I didn't show
you with the border. Because these are a little
4273
06:08:25,890 --> 06:08:30,032
bit easier. And they're kind of hard to understand
if you just use the shorthand property, so
4274
06:08:30,032 --> 06:08:35,112
I'm going to be just building it from the
ground up. So the first property I'm going
4275
06:08:35,112 --> 06:08:42,820
to look at is, of course, the shorthand margin
property, and how to add margin and padding
4276
06:08:42,820 --> 06:08:49,100
to all sides at the same time. So in case
you didn't know, this is called top, this
4277
06:08:49,100 --> 06:08:53,220
is called bottom, this is left and this is
right. But I'm sure you know that especially
4278
06:08:53,220 --> 06:08:55,760
with working with multiple backgrounds, things
like that. And pretty much the same throughout
4279
06:08:55,760 --> 06:08:59,160
all of CSS. So let's get started. So the first
thing I'm going to do is go ahead and find
4280
06:08:59,160 --> 06:09:06,900
my image. And then I'm going to choose which
box model layer I want to manipulate. I'm
4281
06:09:06,900 --> 06:09:14,702
going to go ahead and work with padding first,
because it's a little bit easier to understand.
4282
06:09:14,702 --> 06:09:19,202
And we're going to go and work with margin.
So we're just going to type out cutting here.
4283
06:09:19,202 --> 06:09:26,070
And now what we're going to do is go and start
adding whatever we want. So remember, if you
4284
06:09:26,070 --> 06:09:30,782
add just one value, it's going to add it the
same value to all sides. So I'm going to say
4285
06:09:30,782 --> 06:09:38,730
for example, right now 20 pixels. Now if I
go ahead and refresh the page, you can see
4286
06:09:38,730 --> 06:09:44,890
that there is 20 pixels of space in between
all sides of our image. So you can see 20
4287
06:09:44,890 --> 06:09:52,220
pixels on the left on the right on the top
and on the bottom. So you can see what's going
4288
06:09:52,220 --> 06:09:56,400
on here with our padding free increase this
value, for example, it's going to it's going
4289
06:09:56,400 --> 06:10:00,992
to almost double and now we have 40 pixels
on each side. So that's just a little bit
4290
06:10:00,992 --> 06:10:05,560
of information about padding, you can see
the spacing between the content, and the border
4291
06:10:05,560 --> 06:10:14,960
is getting a lot bigger. Now let's go ahead
and change this to margin and see what happens.
4292
06:10:14,960 --> 06:10:18,412
So I'm actually just going to completely remove
this and refresh the page. So now let's go
4293
06:10:18,412 --> 06:10:26,070
ahead and add our 40 pixel margin, we'll just
say for now, so you can really see the difference.
4294
06:10:26,070 --> 06:10:33,910
So now you can see that the content or the
space between the content and the border is
4295
06:10:33,910 --> 06:10:40,352
still the same. There's no spacing at all.
But you can see that everything around it
4296
06:10:40,352 --> 06:10:45,880
has kind of been pushed down. And remember,
it's adding margin to all sides, there's 40
4297
06:10:45,880 --> 06:10:50,730
pixels between the border and the left side
of the page, the border and the top side,
4298
06:10:50,730 --> 06:10:53,210
the border on the right and the border and
the bottom. So you can see that margin is
4299
06:10:53,210 --> 06:10:58,960
moving the image itself around the page, whereas
the padding is just adding space inside the
4300
06:10:58,960 --> 06:11:05,890
image. So now let's go ahead and talk about
some of the more specific properties in case
4301
06:11:05,890 --> 06:11:11,772
you wanted to maybe style specific sides.
So I'm going to go ahead and change this back
4302
06:11:11,772 --> 06:11:13,792
to padding, just like this. And now we can
go ahead and see our differences a lot more
4303
06:11:13,792 --> 06:11:21,112
clear. So what you can actually do is add
a dash and then the name of the side to it.
4304
06:11:21,112 --> 06:11:22,112
To actually specify which side you want the
padding to be added to. So let's just say
4305
06:11:22,112 --> 06:11:30,831
I wanted to add it to the right side. Now
if I refresh the page, you can see that all
4306
06:11:30,831 --> 06:11:33,320
of this still stays the same. But on the right
side, there is 40 pixels of padding. You can
4307
06:11:33,320 --> 06:11:40,240
do this with as many as you want. So you can
go padding top, for example. And I want 100
4308
06:11:40,240 --> 06:11:44,622
pixels on the top, and let's just say on the
bottom. And remember, always with the dash,
4309
06:11:44,622 --> 06:11:49,682
I just want only five pixels. Now if we go
ahead and refresh the page, you can see it
4310
06:11:49,682 --> 06:11:55,272
looks quite unbalanced, but you have 100 pixels
on the top, we have 40 pixels on the right
4311
06:11:55,272 --> 06:11:59,832
and five on the bottom. Now obviously, this
gets a little bit tedious after a while, after
4312
06:11:59,832 --> 06:12:03,140
you keep you know doing padding right top
bottom left, top right, top right, bottom
4313
06:12:03,140 --> 06:12:06,640
left, and it gets quite irritating after a
while. So what I'm going to do is show you
4314
06:12:06,640 --> 06:12:11,990
a really cool shorthand that you can use to
style them all at the same time. So we're
4315
06:12:11,990 --> 06:12:13,740
going to go back to using our shorthand property.
4316
06:12:13,740 --> 06:12:18,820
So in this video, we're going to be moving
on to the next two main layers of our box
4317
06:12:18,820 --> 06:12:23,272
model. And in this video, we're going to be
talking about margin and padding. So you kind
4318
06:12:23,272 --> 06:12:28,710
of already have an idea of what these two
are, we've talked about them. In the first
4319
06:12:28,710 --> 06:12:33,500
video, we've talked about what they do, we
haven't actually talked about how to manipulate
4320
06:12:33,500 --> 06:12:39,672
them. So in this video, what I'm going to
be doing, what I'm going to be doing is going
4321
06:12:39,672 --> 06:12:43,282
through and working with these two properties
to actually manipulate our layout. And that's
4322
06:12:43,282 --> 06:12:46,520
when the real power of the box model shows.
So let's go ahead and get started. The first
4323
06:12:46,520 --> 06:12:50,582
thing I want to do is go ahead and choose
the right thing to manipulate. And in this
4324
06:12:50,582 --> 06:12:56,912
case, the best thing to work with is an image
right here, because it's very easy to see
4325
06:12:56,912 --> 06:13:02,330
and see the changes when you when you do these
margin padding changes. And it's also very
4326
06:13:02,330 --> 06:13:05,090
useful to have a border here, which I added,
you can really see the difference between
4327
06:13:05,090 --> 06:13:11,292
margin and padding and see which one is responsible
for what. So let's get started. Now similar
4328
06:13:11,292 --> 06:13:15,850
to the rest of the properties, the naming
is pretty straightforward. In this case, we're
4329
06:13:15,850 --> 06:13:19,730
going to go ahead and use the shorthand margin
property. But I'm also going to be showing
4330
06:13:19,730 --> 06:13:24,930
you a few other ways, which I didn't show
you with the border. Because these are a little
4331
06:13:24,930 --> 06:13:29,260
bit easier. And they're kind of hard to understand
if you just use the shorthand property, so
4332
06:13:29,260 --> 06:13:33,992
I'm going to be just building it from the
ground up. So the first property I'm going
4333
06:13:33,992 --> 06:13:38,720
to look at is, of course, the shorthand margin
property, and how to add margin and padding
4334
06:13:38,720 --> 06:13:41,630
to all sides at the same time. So in case
you didn't know, this is called top, this
4335
06:13:41,630 --> 06:13:45,740
is called bottom, this is left and this is
right. But I'm sure you know that especially
4336
06:13:45,740 --> 06:13:53,952
with working with multiple backgrounds, things
like that. And pretty much the same throughout
4337
06:13:53,952 --> 06:14:01,310
all of CSS. So let's get started. So the first
thing I'm going to do is go ahead and find
4338
06:14:01,310 --> 06:14:05,730
my image. And then I'm going to choose which
box model layer I want to manipulate. I'm
4339
06:14:05,730 --> 06:14:09,730
going to go ahead and work with padding first,
because it's a little bit easier to understand.
4340
06:14:09,730 --> 06:14:15,810
And we're going to go and work with margin.
So we're just going to type out cutting here.
4341
06:14:15,810 --> 06:14:21,612
And now what we're going to do is go and start
adding whatever we want. So remember, if you
4342
06:14:21,612 --> 06:14:34,510
add just one value, it's going to add it the
same value to all sides. So I'm going to say
4343
06:14:34,510 --> 06:14:44,170
for example, right now 20 pixels. Now if I
go ahead and refresh the page, you can see
4344
06:14:44,170 --> 06:14:49,150
that there is 20 pixels of space in between
all sides of our image. So you can see 20
4345
06:14:49,150 --> 06:14:56,510
pixels on the left on the right on the top
and on the bottom. So you can see what's going
4346
06:14:56,510 --> 06:15:04,380
on here with our padding free increase this
value, for example, it's going to it's going
4347
06:15:04,380 --> 06:15:10,190
to almost double and now we have 40 pixels
on each side. So that's just a little bit
4348
06:15:10,190 --> 06:15:13,710
of information about padding, you can see
the spacing between the content, and the border
4349
06:15:13,710 --> 06:15:18,910
is getting a lot bigger. Now let's go ahead
and change this to margin and see what happens.
4350
06:15:18,910 --> 06:15:23,740
So I'm actually just going to completely remove
this and refresh the page. So now let's go
4351
06:15:23,740 --> 06:15:28,750
ahead and add our 40 pixel margin, we'll just
say for now, so you can really see the difference.
4352
06:15:28,750 --> 06:15:35,692
So now you can see that the content or the
space between the content and the border is
4353
06:15:35,692 --> 06:15:40,452
still the same. There's no spacing at all.
But you can see that everything around it
4354
06:15:40,452 --> 06:15:45,512
has kind of been pushed down. And remember,
it's adding margin to all sides, there's 40
4355
06:15:45,512 --> 06:15:52,112
pixels between the border and the left side
of the page, the border and the top side,
4356
06:15:52,112 --> 06:15:57,550
the border on the right and the border and
the bottom. So you can see that margin is
4357
06:15:57,550 --> 06:16:02,422
moving the image itself around the page, whereas
the padding is just adding space inside the
4358
06:16:02,422 --> 06:16:06,292
image. So now let's go ahead and talk about
some of the more specific properties in case
4359
06:16:06,292 --> 06:16:08,672
you wanted to maybe style specific sides.
So I'm going to go ahead and change this back
4360
06:16:08,672 --> 06:16:12,182
to padding, just like this. And now we can
go ahead and see our differences a lot more
4361
06:16:12,182 --> 06:16:15,680
clear. So what you can actually do is add
a dash and then the name of the side to it.
4362
06:16:15,680 --> 06:16:19,760
To actually specify which side you want the
padding to be added to. So let's just say
4363
06:16:19,760 --> 06:16:23,650
I wanted to add it to the right side. Now
if I refresh the page, you can see that all
4364
06:16:23,650 --> 06:16:26,720
of this still stays the same. But on the right
side, there is 40 pixels of padding. You can
4365
06:16:26,720 --> 06:16:30,570
do this with as many as you want. So you can
go padding top, for example. And I want 100
4366
06:16:30,570 --> 06:16:32,510
pixels on the top, and let's just say on the
bottom. And remember, always with the dash,
4367
06:16:32,510 --> 06:16:35,240
I just want only five pixels. Now if we go
ahead and refresh the page, you can see it
4368
06:16:35,240 --> 06:16:37,140
looks quite unbalanced, but you have 100 pixels
on the top, we have 40 pixels on the right
4369
06:16:37,140 --> 06:16:38,920
and five on the bottom. Now obviously, this
gets a little bit tedious after a while, after
4370
06:16:38,920 --> 06:16:39,920
you keep you know doing padding right top
bottom left, top right, top right, bottom
4371
06:16:39,920 --> 06:16:41,872
left, and it gets quite irritating after a
while. So what I'm going to do is show you
4372
06:16:41,872 --> 06:16:43,952
a really cool shorthand that you can use to
style them all at the same time. So we're
4373
06:16:43,952 --> 06:16:46,830
going to go back to using our shorthand property.
4374
06:16:46,830 --> 06:16:49,310
And now we're going to go ahead and add four
values separated by spaces, but it's a little
4375
06:16:49,310 --> 06:16:50,310
bit confusing at first, okay, so just bear
with me. Now, what I'm going to do is for
4376
06:16:50,310 --> 06:16:53,292
the left, I don't want anything. So let's
just start from the start from the top. So
4377
06:16:53,292 --> 06:16:54,292
on the top, I want 100 pixels, like that.
On the right, I want 40 pixels. On the left,
4378
06:16:54,292 --> 06:16:55,292
I don't want anything, so I'm just going to
say zero. Now, you could say zero pixels.
4379
06:16:55,292 --> 06:16:56,692
But in this case, we don't want anything at
all. So it doesn't really matter which one
4380
06:16:56,692 --> 06:16:59,282
you choose, I just prefer to put a zero there.
And then of course, on the right, or sorry,
4381
06:16:59,282 --> 06:17:00,680
on the bottom, we want five pixels. Now let's
go ahead and refresh and see what happens.
4382
06:17:00,680 --> 06:17:05,680
It stays pretty much it looks must have confused,
confused, something over there. So 100. On
4383
06:17:05,680 --> 06:17:08,792
the top, we have 40 on the right, and on the
bottom of the so there's the problem. On the
4384
06:17:08,792 --> 06:17:14,060
bottom, we want five pixels, and on the left,
we want zero. So you can see it gets quite
4385
06:17:14,060 --> 06:17:18,282
confusing after some time. So you can see
that now it's exactly the same. So here's
4386
06:17:18,282 --> 06:17:22,920
what you have to kind of remember, the first
one is the top, the second is the right, then
4387
06:17:22,920 --> 06:17:28,782
the bottom and left. So an easy way to remember
this is by looking at the pieces of the border,
4388
06:17:28,782 --> 06:17:33,692
if you draw a diagonal line straight in half,
you style the top on the right first, and
4389
06:17:33,692 --> 06:17:37,210
then the bottom on the left. So just keep
that in mind and you'll be fine. So if you
4390
06:17:37,210 --> 06:17:39,310
if you ever forget, you can always go and
check online, there's a lot of references
4391
06:17:39,310 --> 06:17:41,032
talking about these different values here.
And I'm actually just going to go ahead and
4392
06:17:41,032 --> 06:17:45,692
change it to margin for a second. So you can
see what's going on. Now you can see if I
4393
06:17:45,692 --> 06:17:48,990
change the margin, actually, it stays in the
same position. But instead of adding internal
4394
06:17:48,990 --> 06:17:53,310
space, it's adding external space. So that's
just one thing to keep in mind. But like I
4395
06:17:53,310 --> 06:17:56,532
said, if you want to go ahead and review this,
you can always find some resources online,
4396
06:17:56,532 --> 06:17:58,112
there's a lot going on there. Now let's talk
about shortening this into actually only two
4397
06:17:58,112 --> 06:18:00,772
sections, because let's just say on the top
and bottom, you want a certain margin, but
4398
06:18:00,772 --> 06:18:02,230
then on the left hand, right you want another
this is a pretty common thing that you you're
4399
06:18:02,230 --> 06:18:03,230
going to want to do in CSS. So I'm going to
show you how to do that, all you have to do
4400
06:18:03,230 --> 06:18:04,230
is go ahead and shorten it to two values,
I'm actually going to go ahead Yeah, I'll
4401
06:18:04,230 --> 06:18:05,230
go with margin. The first two values are going
to be for the top and bottom at the same time.
4402
06:18:05,230 --> 06:18:06,230
So I'm going to go ahead and add 80 pixels
of padding, Oh, whoops, 80 pixels. There we
4403
06:18:06,230 --> 06:18:07,230
go. And now for ourselves whoops, now for
our second value, it's going to be our left
4404
06:18:07,230 --> 06:18:08,230
and right values at the same time. So I'm
going to go ahead and add 40 pixels doesn't
4405
06:18:08,230 --> 06:18:09,230
matter the order, because this is always going
to be for the top and bottom, this is always
4406
06:18:09,230 --> 06:18:10,230
going to be 40, left and right. So just make
sure that they are equal. So let's go ahead
4407
06:18:10,230 --> 06:18:11,230
and refresh. And now you can see the left
and right have kind of stayed a little bit
4408
06:18:11,230 --> 06:18:12,230
shorter. Whereas the top and bottom are very
the margin is very big. As you can see here,
4409
06:18:12,230 --> 06:18:13,230
the top and bottom is double the left and
right. So that's a nice shorthand that you
4410
06:18:13,230 --> 06:18:14,230
can use to style to different or Well, two
different sides. So for example, now, if you
4411
06:18:14,230 --> 06:18:15,230
split, if you can just take this part and
this part style, the style and at the same
4412
06:18:15,230 --> 06:18:16,230
time, and then you take the left and right
and do the same thing with them. So I know
4413
06:18:16,230 --> 06:18:17,230
that's a lot to take in. And there's a lot
of different ways. But just remember, if you
4414
06:18:17,230 --> 06:18:18,230
ever get confused, you can either use the
internet, or just use margin dash and then
4415
06:18:18,230 --> 06:18:19,230
the position. But other than that, all you
need to know for now is the concept. You just
4416
06:18:19,230 --> 06:18:20,230
need to know how margin and padding work and
how you can actually manipulate them what
4417
06:18:20,230 --> 06:18:21,230
they do. I mean, what do you do when you say
the margin left is 10 pixels. So just make
4418
06:18:21,230 --> 06:18:22,230
sure that you know that, you know when you
add a certain space to a position, you're
4419
06:18:22,230 --> 06:18:23,230
basically changing the spacing between something
and another thing based on what whichever
4420
06:18:23,230 --> 06:18:24,230
layer you chose. So for example, if you chose
padding, you're going to be changing the spacing
4421
06:18:24,230 --> 06:18:25,230
between the content and the border. So that's
pretty much it for margin and padding. Now
4422
06:18:25,230 --> 06:18:26,230
we're going to get a lot more experience with
this as we go through the course and style
4423
06:18:26,230 --> 06:18:27,230
more things. But for now, just make sure you
know how to use the shorthand properties,
4424
06:18:27,230 --> 06:18:28,230
you know how to use all these different shortcuts.
Now you don't need to memorize them, you just
4425
06:18:28,230 --> 06:18:29,230
need to know kind of how they work. Obviously,
memorizing them is good. But if you, if you
4426
06:18:29,230 --> 06:18:30,230
forget them, don't worry too much about that.
Just make sure you know how to use these properly.
4427
06:18:30,230 --> 06:18:31,230
And that's pretty much it. Let's move on.
4428
06:18:31,230 --> 06:18:32,230
And now we're going to go ahead and add four
values separated by spaces, but it's a little
4429
06:18:32,230 --> 06:18:33,230
bit confusing at first, okay, so just bear
with me. Now, what I'm going to do is for
4430
06:18:33,230 --> 06:18:34,230
the left, I don't want anything. So let's
just start from the start from the top. So
4431
06:18:34,230 --> 06:18:35,230
on the top, I want 100 pixels, like that.
On the right, I want 40 pixels. On the left,
4432
06:18:35,230 --> 06:18:36,230
I don't want anything, so I'm just going to
say zero. Now, you could say zero pixels.
4433
06:18:36,230 --> 06:18:37,230
But in this case, we don't want anything at
all. So it doesn't really matter which one
4434
06:18:37,230 --> 06:18:38,230
you choose, I just prefer to put a zero there.
And then of course, on the right, or sorry,
4435
06:18:38,230 --> 06:18:39,230
on the bottom, we want five pixels. Now let's
go ahead and refresh and see what happens.
4436
06:18:39,230 --> 06:18:40,230
It stays pretty much it looks must have confused,
confused, something over there. So 100. On
4437
06:18:40,230 --> 06:18:41,230
the top, we have 40 on the right, and on the
bottom of the so there's the problem. On the
4438
06:18:41,230 --> 06:18:42,230
bottom, we want five pixels, and on the left,
we want zero. So you can see it gets quite
4439
06:18:42,230 --> 06:18:43,230
confusing after some time. So you can see
that now it's exactly the same. So here's
4440
06:18:43,230 --> 06:18:44,230
what you have to kind of remember, the first
one is the top, the second is the right, then
4441
06:18:44,230 --> 06:18:45,230
the bottom and left. So an easy way to remember
this is by looking at the pieces of the border,
4442
06:18:45,230 --> 06:18:46,230
if you draw a diagonal line straight in half,
you style the top on the right first, and
4443
06:18:46,230 --> 06:18:47,230
then the bottom on the left. So just keep
that in mind and you'll be fine. So if you
4444
06:18:47,230 --> 06:18:48,230
if you ever forget, you can always go and
check online, there's a lot of references
4445
06:18:48,230 --> 06:18:49,230
talking about these different values here.
And I'm actually just going to go ahead and
4446
06:18:49,230 --> 06:18:50,230
change it to margin for a second. So you can
see what's going on. Now you can see if I
4447
06:18:50,230 --> 06:18:51,230
change the margin, actually, it stays in the
same position. But instead of adding internal
4448
06:18:51,230 --> 06:18:52,230
space, it's adding external space. So that's
just one thing to keep in mind. But like I
4449
06:18:52,230 --> 06:18:53,230
said, if you want to go ahead and review this,
you can always find some resources online,
4450
06:18:53,230 --> 06:18:54,230
there's a lot going on there. Now let's talk
about shortening this into actually only two
4451
06:18:54,230 --> 06:18:55,230
sections, because let's just say on the top
and bottom, you want a certain margin, but
4452
06:18:55,230 --> 06:18:56,230
then on the left hand, right you want another
this is a pretty common thing that you you're
4453
06:18:56,230 --> 06:18:57,230
going to want to do in CSS. So I'm going to
show you how to do that, all you have to do
4454
06:18:57,230 --> 06:18:58,230
is go ahead and shorten it to two values,
I'm actually going to go ahead Yeah, I'll
4455
06:18:58,230 --> 06:18:59,230
go with margin. The first two values are going
to be for the top and bottom at the same time.
4456
06:18:59,230 --> 06:19:00,230
So I'm going to go ahead and add 80 pixels
of padding, Oh, whoops, 80 pixels. There we
4457
06:19:00,230 --> 06:19:01,230
go. And now for ourselves whoops, now for
our second value, it's going to be our left
4458
06:19:01,230 --> 06:19:02,230
and right values at the same time. So I'm
going to go ahead and add 40 pixels doesn't
4459
06:19:02,230 --> 06:19:03,230
matter the order, because this is always going
to be for the top and bottom, this is always
4460
06:19:03,230 --> 06:19:04,230
going to be 40, left and right. So just make
sure that they are equal. So let's go ahead
4461
06:19:04,230 --> 06:19:05,230
and refresh. And now you can see the left
and right have kind of stayed a little bit
4462
06:19:05,230 --> 06:19:06,230
shorter. Whereas the top and bottom are very
the margin is very big. As you can see here,
4463
06:19:06,230 --> 06:19:07,230
the top and bottom is double the left and
right. So that's a nice shorthand that you
4464
06:19:07,230 --> 06:19:08,230
can use to style to different or Well, two
different sides. So for example, now, if you
4465
06:19:08,230 --> 06:19:09,230
split, if you can just take this part and
this part style, the style and at the same
4466
06:19:09,230 --> 06:19:10,230
time, and then you take the left and right
and do the same thing with them. So I know
4467
06:19:10,230 --> 06:19:11,230
that's a lot to take in. And there's a lot
of different ways. But just remember, if you
4468
06:19:11,230 --> 06:19:12,230
ever get confused, you can either use the
internet, or just use margin dash and then
4469
06:19:12,230 --> 06:19:13,230
the position. But other than that, all you
need to know for now is the concept. You just
4470
06:19:13,230 --> 06:19:14,230
need to know how margin and padding work and
how you can actually manipulate them what
4471
06:19:14,230 --> 06:19:15,230
they do. I mean, what do you do when you say
the margin left is 10 pixels. So just make
4472
06:19:15,230 --> 06:19:16,230
sure that you know that, you know when you
add a certain space to a position, you're
4473
06:19:16,230 --> 06:19:17,230
basically changing the spacing between something
and another thing based on what whichever
4474
06:19:17,230 --> 06:19:18,230
layer you chose. So for example, if you chose
padding, you're going to be changing the spacing
4475
06:19:18,230 --> 06:19:19,230
between the content and the border. So that's
pretty much it for margin and padding. Now
4476
06:19:19,230 --> 06:19:20,230
we're going to get a lot more experience with
this as we go through the course and style
4477
06:19:20,230 --> 06:19:21,230
more things. But for now, just make sure you
know how to use the shorthand properties,
4478
06:19:21,230 --> 06:19:22,230
you know how to use all these different shortcuts.
Now you don't need to memorize them, you just
4479
06:19:22,230 --> 06:19:23,230
need to know kind of how they work. Obviously,
memorizing them is good. But if you, if you
4480
06:19:23,230 --> 06:19:24,230
forget them, don't worry too much about that.
Just make sure you know how to use these properly.
4481
06:19:24,230 --> 06:19:25,230
And that's pretty much it. Let's move on.
4482
06:19:25,230 --> 06:19:26,230
So this is a pretty important video, because
we're talking about a concept that is going
4483
06:19:26,230 --> 06:19:27,230
to be used constantly in the next few sections.
And it's a very, very important part of CSS,
4484
06:19:27,230 --> 06:19:28,230
and kind of defines the way that you look
at documents. So the two properties that we're
4485
06:19:28,230 --> 06:19:29,230
going to be looking at are float, which is
the less important one and display, which
4486
06:19:29,230 --> 06:19:30,230
is the very important properties that we need
to learn. So let's cover float first, because
4487
06:19:30,230 --> 06:19:31,230
it's an easier thing to approach. But before
we start for both of these elements, you need
4488
06:19:31,230 --> 06:19:32,230
to understand the concept of inline and block
level elements. So first of all elements have
4489
06:19:32,230 --> 06:19:33,230
a certain display type, which we're going
to be manipulating in the next property. This
4490
06:19:33,230 --> 06:19:34,230
display type pretty much defines the behavior
of the elements. So there are two main display
4491
06:19:34,230 --> 06:19:35,230
types block and inline. So pretty much if
we look at our HTML document, here we go through
4492
06:19:35,230 --> 06:19:36,230
and you can see all of these tags, creating
these tags create a sort of a sort of display
4493
06:19:36,230 --> 06:19:37,230
behavior for the content inside them. So the
block level element, what it basically does
4494
06:19:37,230 --> 06:19:38,230
is move moves everything onto its own section,
its own while block. So an example of one
4495
06:19:38,230 --> 06:19:39,230
of these elements would be a p tag, you can
see that if this was an inline element would
4496
06:19:39,230 --> 06:19:40,230
be flowing with the rest of the things. But
you can see here, despite the margin, this
4497
06:19:40,230 --> 06:19:41,230
is moved on to its own section, it's not playing
or moving after the image, it's moved on to
4498
06:19:41,230 --> 06:19:42,230
its own section, and everything after it comes
after Well, the block. On the other hand,
4499
06:19:42,230 --> 06:19:43,230
an inline element is something that won't
really move anything onto its own section,
4500
06:19:43,230 --> 06:19:44,230
it's going to keep it keep it intact, it's
not going to move it or change it in any way,
4501
06:19:44,230 --> 06:19:45,230
it's just going to leave it how it naturally
occurs on the page. So an example, a very
4502
06:19:45,230 --> 06:19:46,230
good example of one of these would be a span
tag, because what a span tag pretty much does
4503
06:19:46,230 --> 06:19:47,230
is it's used to contain some piece of content
in an inline style. So for example, this italics
4504
06:19:47,230 --> 06:19:48,230
class would be a perfect representation of
an inline tag, what we're trying to do is
4505
06:19:48,230 --> 06:19:49,230
I telesign, some text. And if the span was
a block level element, this text here, this
4506
06:19:49,230 --> 06:19:50,230
italic size, text would be moved on to its
own section, so everything preceding it would
4507
06:19:50,230 --> 06:19:51,230
come before it. And then there would be a
new line with the text. And then after it
4508
06:19:51,230 --> 06:19:52,230
would come the rest of the text. So you can
see there that the inline and block level
4509
06:19:52,230 --> 06:19:53,230
tags really make a difference depending on
what you want to use it for. So what we're
4510
06:19:53,230 --> 06:19:54,230
going to be doing in this video is going through
and learning how to change the display type
4511
06:19:54,230 --> 06:19:55,230
of these different elements. But first, let's
talk about float. So again, these tags come
4512
06:19:55,230 --> 06:19:56,230
with a natural display type and how they are
placed on the page is how they naturally occur.
4513
06:19:56,230 --> 06:19:57,230
But there's actually a way to change the way
that they look. And this is done using float.
4514
06:19:57,230 --> 06:19:58,230
So if you just listen to the name there, what
element pretty much does is change how the
4515
06:19:58,230 --> 06:19:59,230
element will float on the page. So I'll go
ahead and do do some examples here. For example,
4516
06:19:59,230 --> 06:20:00,230
let's just take this gradient here, this div.
So I'm going to go and look for it the service
4517
06:20:00,230 --> 06:20:01,230
image, I'm going to say set the float and
I'm going to say it float to the right and
4518
06:20:01,230 --> 06:20:02,230
watch what happens. You can see that now what
happens is pretty much this just flows over
4519
06:20:02,230 --> 06:20:03,230
to the right side of the page. And it also
changes all the content after it. So you can
4520
06:20:03,230 --> 06:20:04,230
see that this content here has now been pushed
up. So this kind of shows how a little bit
4521
06:20:04,230 --> 06:20:05,230
of how flow works. And this doesn't just have
to be with images, we can do it with text
4522
06:20:05,230 --> 06:20:06,230
as well. So if I go through and choose something
like this element over here, this some link
4523
06:20:06,230 --> 06:20:07,230
here, so I'm going to go ahead on this link.
And I'm going to say it float to the right.
4524
06:20:07,230 --> 06:20:08,230
Now let's go ahead and refresh the page. And
you can see that that kind of flows over to
4525
06:20:08,230 --> 06:20:09,230
the right and everything before it is now
kind of pushed up where it was. So you can
4526
06:20:09,230 --> 06:20:10,230
think of this as kind of a kind of a Tetris
puzzle block. When you're moving something
4527
06:20:10,230 --> 06:20:11,230
over, everything is going to be pushed up
or moved around as well. So to fit the page
4528
06:20:11,230 --> 06:20:12,230
so you can kind of think of it in that way.
Now obviously, once you start getting some
4529
06:20:12,230 --> 06:20:13,230
really a lot of experience with float, you
can kind of predict where everything is going
4530
06:20:13,230 --> 06:20:14,230
to move on the page. But floats are really
useful for laying out documents. Especially
4531
06:20:14,230 --> 06:20:15,230
if you want to kind of Have position images
next to text or move things around in a way
4532
06:20:15,230 --> 06:20:16,230
that looks more like a proper document. So
I'm going to remove that float. And I'm just
4533
06:20:16,230 --> 06:20:17,230
going to do it with our image over here, which
with our image, our about us image. So I'm
4534
06:20:17,230 --> 06:20:18,230
going to go ahead and say it floats over to
the right.
4535
06:20:18,230 --> 06:20:19,230
So this is a pretty important video, because
we're talking about a concept that is going
4536
06:20:19,230 --> 06:20:20,230
to be used constantly in the next few sections.
And it's a very, very important part of CSS,
4537
06:20:20,230 --> 06:20:21,230
and kind of defines the way that you look
at documents. So the two properties that we're
4538
06:20:21,230 --> 06:20:22,230
going to be looking at are float, which is
the less important one and display, which
4539
06:20:22,230 --> 06:20:23,230
is the very important properties that we need
to learn. So let's cover float first, because
4540
06:20:23,230 --> 06:20:24,230
it's an easier thing to approach. But before
we start for both of these elements, you need
4541
06:20:24,230 --> 06:20:25,230
to understand the concept of inline and block
level elements. So first of all elements have
4542
06:20:25,230 --> 06:20:26,230
a certain display type, which we're going
to be manipulating in the next property. This
4543
06:20:26,230 --> 06:20:27,230
display type pretty much defines the behavior
of the elements. So there are two main display
4544
06:20:27,230 --> 06:20:28,230
types block and inline. So pretty much if
we look at our HTML document, here we go through
4545
06:20:28,230 --> 06:20:29,230
and you can see all of these tags, creating
these tags create a sort of a sort of display
4546
06:20:29,230 --> 06:20:30,230
behavior for the content inside them. So the
block level element, what it basically does
4547
06:20:30,230 --> 06:20:31,230
is move moves everything onto its own section,
its own while block. So an example of one
4548
06:20:31,230 --> 06:20:32,230
of these elements would be a p tag, you can
see that if this was an inline element would
4549
06:20:32,230 --> 06:20:33,230
be flowing with the rest of the things. But
you can see here, despite the margin, this
4550
06:20:33,230 --> 06:20:34,230
is moved on to its own section, it's not playing
or moving after the image, it's moved on to
4551
06:20:34,230 --> 06:20:35,230
its own section, and everything after it comes
after Well, the block. On the other hand,
4552
06:20:35,230 --> 06:20:36,230
an inline element is something that won't
really move anything onto its own section,
4553
06:20:36,230 --> 06:20:37,230
it's going to keep it keep it intact, it's
not going to move it or change it in any way,
4554
06:20:37,230 --> 06:20:38,230
it's just going to leave it how it naturally
occurs on the page. So an example, a very
4555
06:20:38,230 --> 06:20:39,230
good example of one of these would be a span
tag, because what a span tag pretty much does
4556
06:20:39,230 --> 06:20:40,230
is it's used to contain some piece of content
in an inline style. So for example, this italics
4557
06:20:40,230 --> 06:20:41,230
class would be a perfect representation of
an inline tag, what we're trying to do is
4558
06:20:41,230 --> 06:20:42,230
I telesign, some text. And if the span was
a block level element, this text here, this
4559
06:20:42,230 --> 06:20:43,230
italic size, text would be moved on to its
own section, so everything preceding it would
4560
06:20:43,230 --> 06:20:44,230
come before it. And then there would be a
new line with the text. And then after it
4561
06:20:44,230 --> 06:20:45,230
would come the rest of the text. So you can
see there that the inline and block level
4562
06:20:45,230 --> 06:20:46,230
tags really make a difference depending on
what you want to use it for. So what we're
4563
06:20:46,230 --> 06:20:47,230
going to be doing in this video is going through
and learning how to change the display type
4564
06:20:47,230 --> 06:20:48,230
of these different elements. But first, let's
talk about float. So again, these tags come
4565
06:20:48,230 --> 06:20:49,230
with a natural display type and how they are
placed on the page is how they naturally occur.
4566
06:20:49,230 --> 06:20:50,230
But there's actually a way to change the way
that they look. And this is done using float.
4567
06:20:50,230 --> 06:20:51,230
So if you just listen to the name there, what
element pretty much does is change how the
4568
06:20:51,230 --> 06:20:52,230
element will float on the page. So I'll go
ahead and do do some examples here. For example,
4569
06:20:52,230 --> 06:20:53,230
let's just take this gradient here, this div.
So I'm going to go and look for it the service
4570
06:20:53,230 --> 06:20:54,230
image, I'm going to say set the float and
I'm going to say it float to the right and
4571
06:20:54,230 --> 06:20:55,230
watch what happens. You can see that now what
happens is pretty much this just flows over
4572
06:20:55,230 --> 06:20:56,230
to the right side of the page. And it also
changes all the content after it. So you can
4573
06:20:56,230 --> 06:20:57,230
see that this content here has now been pushed
up. So this kind of shows how a little bit
4574
06:20:57,230 --> 06:20:58,230
of how flow works. And this doesn't just have
to be with images, we can do it with text
4575
06:20:58,230 --> 06:20:59,230
as well. So if I go through and choose something
like this element over here, this some link
4576
06:20:59,230 --> 06:21:00,230
here, so I'm going to go ahead on this link.
And I'm going to say it float to the right.
4577
06:21:00,230 --> 06:21:01,230
Now let's go ahead and refresh the page. And
you can see that that kind of flows over to
4578
06:21:01,230 --> 06:21:02,230
the right and everything before it is now
kind of pushed up where it was. So you can
4579
06:21:02,230 --> 06:21:03,230
think of this as kind of a kind of a Tetris
puzzle block. When you're moving something
4580
06:21:03,230 --> 06:21:04,230
over, everything is going to be pushed up
or moved around as well. So to fit the page
4581
06:21:04,230 --> 06:21:05,230
so you can kind of think of it in that way.
Now obviously, once you start getting some
4582
06:21:05,230 --> 06:21:06,230
really a lot of experience with float, you
can kind of predict where everything is going
4583
06:21:06,230 --> 06:21:07,230
to move on the page. But floats are really
useful for laying out documents. Especially
4584
06:21:07,230 --> 06:21:08,230
if you want to kind of Have position images
next to text or move things around in a way
4585
06:21:08,230 --> 06:21:09,230
that looks more like a proper document. So
I'm going to remove that float. And I'm just
4586
06:21:09,230 --> 06:21:10,230
going to do it with our image over here, which
with our image, our about us image. So I'm
4587
06:21:10,230 --> 06:21:11,230
going to go ahead and say it floats over to
the right.
4588
06:21:11,230 --> 06:21:12,230
See that. So now you can see that it floats
over to the right. And now everything before
4589
06:21:12,230 --> 06:21:13,230
it has kind of been pushed up onto this section
here. So there we go. Now it's working, and
4590
06:21:13,230 --> 06:21:14,230
everything is looking great. Now let's look
at the next property, which is display. So
4591
06:21:14,230 --> 06:21:15,230
display is pretty much a way of changing the
display property of an element that it naturally
4592
06:21:15,230 --> 06:21:16,230
comes with. So of course, we know things like
a div or a paragraph tag come as a block level
4593
06:21:16,230 --> 06:21:17,230
element, whereas something like a span or
a bolding tag would come as an inline element.
4594
06:21:17,230 --> 06:21:18,230
So what we're going to be doing is going through
and changing these properties. Now, I didn't
4595
06:21:18,230 --> 06:21:19,230
actually cover the properties of float, which
I'm going to go over in just a second. But
4596
06:21:19,230 --> 06:21:20,230
what I'm going to talk about is the different
properties of display. So of course, you have
4597
06:21:20,230 --> 06:21:21,230
the standard inline and block, which is pretty
obvious, but then you have a few others. So
4598
06:21:21,230 --> 06:21:22,230
the one that I'm going to be covering here
is none now. So what the display none property
4599
06:21:22,230 --> 06:21:23,230
does is pretty much just completely, almost
remove the element from the page. Now it doesn't
4600
06:21:23,230 --> 06:21:24,230
actually remove it. But what happens is the
entire that invisible box that contains everything
4601
06:21:24,230 --> 06:21:25,230
just suddenly disappears, you can't see it
anymore, it doesn't take up any space. It's
4602
06:21:25,230 --> 06:21:26,230
just completely gone from the page. So I'm
going to show you what that looks like right
4603
06:21:26,230 --> 06:21:27,230
now. Let's go ahead. And for example, let's
just say that this table is kind of annoying,
4604
06:21:27,230 --> 06:21:28,230
we don't really want it here. So what I'm
going to do over here in my table is given
4605
06:21:28,230 --> 06:21:29,230
a class of site table. Now I'm going to go
ahead and select it here, dot site dash table,
4606
06:21:29,230 --> 06:21:30,230
and I'm going to say display is none. Now
watch what happens, you can see that that
4607
06:21:30,230 --> 06:21:31,230
table completely disappears. And it doesn't
even take up the space anymore. It's not like
4608
06:21:31,230 --> 06:21:32,230
the table. It's just invisible or not, not
what not visible, but it's completely gone.
4609
06:21:32,230 --> 06:21:33,230
Now, this is very, very commonly used once
you start using JavaScript. And would you
4610
06:21:33,230 --> 06:21:34,230
start making your site's interactive to maybe
create web games or hide something, maybe
4611
06:21:34,230 --> 06:21:35,230
create some sort of hidden token, it can be
used for all sorts of things. So this is a
4612
06:21:35,230 --> 06:21:36,230
very useful display property. So I'm going
to go ahead and remove that. Now the next
4613
06:21:36,230 --> 06:21:37,230
one I want to talk about, I'm actually going
to, I'll just keep it there, if we decide
4614
06:21:37,230 --> 06:21:38,230
to use it later. The next one I'm going to
talk about is inline block. So we know that
4615
06:21:38,230 --> 06:21:39,230
we have two different display types, inline,
and block. But there's actually a combination
4616
06:21:39,230 --> 06:21:40,230
of the two, which is a little bit hard to
understand. But once we start using it, you
4617
06:21:40,230 --> 06:21:41,230
can see how useful it is. So inline block
is a little bit Well, like I said, it's a
4618
06:21:41,230 --> 06:21:42,230
little bit hard to understand. But pretty
much what it does is take features from both
4619
06:21:42,230 --> 06:21:43,230
inline and block level elements and combines
them together. So we know that inline elements
4620
06:21:43,230 --> 06:21:44,230
do not move anything onto their own line,
we know that they stay in their place, they
4621
06:21:44,230 --> 06:21:45,230
don't touch anything or move anything around.
Whereas block level elements, move them onto
4622
06:21:45,230 --> 06:21:46,230
the new line. Now, what happens is that in
light, or this inline block element takes
4623
06:21:46,230 --> 06:21:47,230
that new sticks that sort of new line feature
and removes it completely, it does not move
4624
06:21:47,230 --> 06:21:48,230
anything onto its own new line. But what the
block level elements do is they actually create
4625
06:21:48,230 --> 06:21:49,230
some spacing around the element once it's
moved on to its new block. So the inline block
4626
06:21:49,230 --> 06:21:50,230
element then takes this and puts it into itself.
So the inline block element pretty much keeps
4627
06:21:50,230 --> 06:21:51,230
everything in the same line, but creates that
block level spacing that can be found in other
4628
06:21:51,230 --> 06:21:52,230
block level elements. So let's go through
and actually demonstrate how this works. I'm
4629
06:21:52,230 --> 06:21:53,230
going to go back to my table and add our inline
block display property here, inline block.
4630
06:21:53,230 --> 06:21:54,230
See that. So now you can see that it floats
over to the right. And now everything before
4631
06:21:54,230 --> 06:21:55,230
it has kind of been pushed up onto this section
here. So there we go. Now it's working, and
4632
06:21:55,230 --> 06:21:56,230
everything is looking great. Now let's look
at the next property, which is display. So
4633
06:21:56,230 --> 06:21:57,230
display is pretty much a way of changing the
display property of an element that it naturally
4634
06:21:57,230 --> 06:21:58,230
comes with. So of course, we know things like
a div or a paragraph tag come as a block level
4635
06:21:58,230 --> 06:21:59,230
element, whereas something like a span or
a bolding tag would come as an inline element.
4636
06:21:59,230 --> 06:22:00,230
So what we're going to be doing is going through
and changing these properties. Now, I didn't
4637
06:22:00,230 --> 06:22:01,230
actually cover the properties of float, which
I'm going to go over in just a second. But
4638
06:22:01,230 --> 06:22:02,230
what I'm going to talk about is the different
properties of display. So of course, you have
4639
06:22:02,230 --> 06:22:03,230
the standard inline and block, which is pretty
obvious, but then you have a few others. So
4640
06:22:03,230 --> 06:22:04,230
the one that I'm going to be covering here
is none now. So what the display none property
4641
06:22:04,230 --> 06:22:05,230
does is pretty much just completely, almost
remove the element from the page. Now it doesn't
4642
06:22:05,230 --> 06:22:06,230
actually remove it. But what happens is the
entire that invisible box that contains everything
4643
06:22:06,230 --> 06:22:07,230
just suddenly disappears, you can't see it
anymore, it doesn't take up any space. It's
4644
06:22:07,230 --> 06:22:08,230
just completely gone from the page. So I'm
going to show you what that looks like right
4645
06:22:08,230 --> 06:22:09,230
now. Let's go ahead. And for example, let's
just say that this table is kind of annoying,
4646
06:22:09,230 --> 06:22:10,230
we don't really want it here. So what I'm
going to do over here in my table is given
4647
06:22:10,230 --> 06:22:11,230
a class of site table. Now I'm going to go
ahead and select it here, dot site dash table,
4648
06:22:11,230 --> 06:22:12,230
and I'm going to say display is none. Now
watch what happens, you can see that that
4649
06:22:12,230 --> 06:22:13,230
table completely disappears. And it doesn't
even take up the space anymore. It's not like
4650
06:22:13,230 --> 06:22:14,230
the table. It's just invisible or not, not
what not visible, but it's completely gone.
4651
06:22:14,230 --> 06:22:15,230
Now, this is very, very commonly used once
you start using JavaScript. And would you
4652
06:22:15,230 --> 06:22:16,230
start making your site's interactive to maybe
create web games or hide something, maybe
4653
06:22:16,230 --> 06:22:17,230
create some sort of hidden token, it can be
used for all sorts of things. So this is a
4654
06:22:17,230 --> 06:22:18,230
very useful display property. So I'm going
to go ahead and remove that. Now the next
4655
06:22:18,230 --> 06:22:19,230
one I want to talk about, I'm actually going
to, I'll just keep it there, if we decide
4656
06:22:19,230 --> 06:22:20,230
to use it later. The next one I'm going to
talk about is inline block. So we know that
4657
06:22:20,230 --> 06:22:21,230
we have two different display types, inline,
and block. But there's actually a combination
4658
06:22:21,230 --> 06:22:22,230
of the two, which is a little bit hard to
understand. But once we start using it, you
4659
06:22:22,230 --> 06:22:23,230
can see how useful it is. So inline block
is a little bit Well, like I said, it's a
4660
06:22:23,230 --> 06:22:24,230
little bit hard to understand. But pretty
much what it does is take features from both
4661
06:22:24,230 --> 06:22:25,230
inline and block level elements and combines
them together. So we know that inline elements
4662
06:22:25,230 --> 06:22:26,230
do not move anything onto their own line,
we know that they stay in their place, they
4663
06:22:26,230 --> 06:22:27,230
don't touch anything or move anything around.
Whereas block level elements, move them onto
4664
06:22:27,230 --> 06:22:28,230
the new line. Now, what happens is that in
light, or this inline block element takes
4665
06:22:28,230 --> 06:22:29,230
that new sticks that sort of new line feature
and removes it completely, it does not move
4666
06:22:29,230 --> 06:22:30,230
anything onto its own new line. But what the
block level elements do is they actually create
4667
06:22:30,230 --> 06:22:31,230
some spacing around the element once it's
moved on to its new block. So the inline block
4668
06:22:31,230 --> 06:22:32,230
element then takes this and puts it into itself.
So the inline block element pretty much keeps
4669
06:22:32,230 --> 06:22:33,230
everything in the same line, but creates that
block level spacing that can be found in other
4670
06:22:33,230 --> 06:22:34,230
block level elements. So let's go through
and actually demonstrate how this works. I'm
4671
06:22:34,230 --> 06:22:35,230
going to go back to my table and add our inline
block display property here, inline block.
4672
06:22:35,230 --> 06:22:36,230
Now I'm going to go ahead and refresh the
page and see what happens. So you can see
4673
06:22:36,230 --> 06:22:37,230
that it's kind of kept on the same line. But
it's given that sort of spacing or well block
4674
06:22:37,230 --> 06:22:38,230
level spacing that you can't really find with
a normal inline element. If I actually go
4675
06:22:38,230 --> 06:22:39,230
ahead and change this to inline here, you'll
see this very apparent, you can see that that
4676
06:22:39,230 --> 06:22:40,230
click here to Google text has now moved around.
It's a little bit of a weird box here. So
4677
06:22:40,230 --> 06:22:41,230
you can see the difference between an inline
element and an inline block element. So there
4678
06:22:41,230 --> 06:22:42,230
you go. inline block is a very useful display
property. You can use it a lot in your website
4679
06:22:42,230 --> 06:22:43,230
to maybe layout grids, and all sorts of things
like that. And we're actually going to be
4680
06:22:43,230 --> 06:22:44,230
using some very special display properties
later in this course called flex and grid,
4681
06:22:44,230 --> 06:22:45,230
which are really going to help us create these
beautiful grids and layouts that can transform
4682
06:22:45,230 --> 06:22:46,230
our website. Everywhere. So that's pretty
much it for display. Now let's go on to talk
4683
06:22:46,230 --> 06:22:47,230
about some of the other float properties,
because I kind of wanted to save it for last.
4684
06:22:47,230 --> 06:22:48,230
So we already know that there are two main
float properties, which are left and right.
4685
06:22:48,230 --> 06:22:49,230
But there's actually a few more that we can
use that are sort of different. And they're
4686
06:22:49,230 --> 06:22:50,230
not very conventional, but they're still apparent.
And they can well change the way that while
4687
06:22:50,230 --> 06:22:51,230
a palette, an element floats on the page.
So the first one is the most interesting one
4688
06:22:51,230 --> 06:22:52,230
is the one that is, well, the only real floating
element, which is called inherit. So you can
4689
06:22:52,230 --> 06:22:53,230
see here that we have Child Elements and parent
elements. Now, what's really interesting is,
4690
06:22:53,230 --> 06:22:54,230
what can happen is if we have, let's say,
a div with an h2 and an image in it, what
4691
06:22:54,230 --> 06:22:55,230
we can do is pretty much set the divs float
as right. And we can set the one of the child
4692
06:22:55,230 --> 06:22:56,230
elements such as the h2, we can set its float
as inherit, what's going to happen is it's
4693
06:22:56,230 --> 06:22:57,230
going to take the float property of the parent
element. Now, you're probably asking why this
4694
06:22:57,230 --> 06:22:58,230
would be useful at hoc at all? Well, pretty
much, what you can do is you can actually
4695
06:22:58,230 --> 06:22:59,230
lay out multiple elements without having to
specify their float as long as their children
4696
06:22:59,230 --> 06:23:00,230
and parents. So for example, if you have an
element that's maybe four or five levels deep,
4697
06:23:00,230 --> 06:23:01,230
and you don't want to specify the float every
time, you can just use an inherit element
4698
06:23:01,230 --> 06:23:02,230
to move everything to the right side, with
only specifying the float once to the last
4699
06:23:02,230 --> 06:23:03,230
value I want to talk about is the is the non
value. So this is kind of the default value
4700
06:23:03,230 --> 06:23:04,230
that you're going to see if you don't specify
anything. And it's pretty much just going
4701
06:23:04,230 --> 06:23:05,230
to keep the item in its place. It's not going
to change its float or display, and it's pretty
4702
06:23:05,230 --> 06:23:06,230
much not going to move it around at all. It's
not the same as display none, though, it doesn't
4703
06:23:06,230 --> 06:23:07,230
really remove anything, what float none pretty
much does, it's just leaves it where it naturally
4704
06:23:07,230 --> 06:23:08,230
occurs in the text. So for example, if you
have a block level, div tag, and you've set
4705
06:23:08,230 --> 06:23:09,230
its float to none, then it's just going to
appear as a block level elements is not going
4706
06:23:09,230 --> 06:23:10,230
to move around or do anything similar. So
there you go. That's pretty much it for floats,
4707
06:23:10,230 --> 06:23:11,230
and displays. We're going to be working with
these a lot throughout the rest of this course.
4708
06:23:11,230 --> 06:23:12,230
And they're very important property. So I
recommend you get some practice with them,
4709
06:23:12,230 --> 06:23:13,230
and start using them. So you can see all of
the different ways that you can use the display
4710
06:23:13,230 --> 06:23:14,230
and flow properties in your website. Now,
apart from the box model, and a few other
4711
06:23:14,230 --> 06:23:15,230
ways displays and floats are a very common
way or at least a word of manipulating your
4712
06:23:15,230 --> 06:23:16,230
website and making it look really good. So
without it, the website is just kind of everywhere,
4713
06:23:16,230 --> 06:23:17,230
all the elements are scattered around. But
if you want to really make the website, look
4714
06:23:17,230 --> 06:23:18,230
how you want it to look, you need to use this
in combination with a few other features that
4715
06:23:18,230 --> 06:23:19,230
we are going to learn in the future in order
to make your website look great. Alright,
4716
06:23:19,230 --> 06:23:20,230
let's move on.
4717
06:23:20,230 --> 06:23:21,230
Now I'm going to go ahead and refresh the
page and see what happens. So you can see
4718
06:23:21,230 --> 06:23:22,230
that it's kind of kept on the same line. But
it's given that sort of spacing or well block
4719
06:23:22,230 --> 06:23:23,230
level spacing that you can't really find with
a normal inline element. If I actually go
4720
06:23:23,230 --> 06:23:24,230
ahead and change this to inline here, you'll
see this very apparent, you can see that that
4721
06:23:24,230 --> 06:23:25,230
click here to Google text has now moved around.
It's a little bit of a weird box here. So
4722
06:23:25,230 --> 06:23:26,230
you can see the difference between an inline
element and an inline block element. So there
4723
06:23:26,230 --> 06:23:27,230
you go. inline block is a very useful display
property. You can use it a lot in your website
4724
06:23:27,230 --> 06:23:28,230
to maybe layout grids, and all sorts of things
like that. And we're actually going to be
4725
06:23:28,230 --> 06:23:29,230
using some very special display properties
later in this course called flex and grid,
4726
06:23:29,230 --> 06:23:30,230
which are really going to help us create these
beautiful grids and layouts that can transform
4727
06:23:30,230 --> 06:23:31,230
our website. Everywhere. So that's pretty
much it for display. Now let's go on to talk
4728
06:23:31,230 --> 06:23:32,230
about some of the other float properties,
because I kind of wanted to save it for last.
4729
06:23:32,230 --> 06:23:33,230
So we already know that there are two main
float properties, which are left and right.
4730
06:23:33,230 --> 06:23:34,230
But there's actually a few more that we can
use that are sort of different. And they're
4731
06:23:34,230 --> 06:23:35,230
not very conventional, but they're still apparent.
And they can well change the way that while
4732
06:23:35,230 --> 06:23:36,230
a palette, an element floats on the page.
So the first one is the most interesting one
4733
06:23:36,230 --> 06:23:37,230
is the one that is, well, the only real floating
element, which is called inherit. So you can
4734
06:23:37,230 --> 06:23:38,230
see here that we have Child Elements and parent
elements. Now, what's really interesting is,
4735
06:23:38,230 --> 06:23:39,230
what can happen is if we have, let's say,
a div with an h2 and an image in it, what
4736
06:23:39,230 --> 06:23:40,230
we can do is pretty much set the divs float
as right. And we can set the one of the child
4737
06:23:40,230 --> 06:23:41,230
elements such as the h2, we can set its float
as inherit, what's going to happen is it's
4738
06:23:41,230 --> 06:23:42,230
going to take the float property of the parent
element. Now, you're probably asking why this
4739
06:23:42,230 --> 06:23:43,230
would be useful at hoc at all? Well, pretty
much, what you can do is you can actually
4740
06:23:43,230 --> 06:23:44,230
lay out multiple elements without having to
specify their float as long as their children
4741
06:23:44,230 --> 06:23:45,230
and parents. So for example, if you have an
element that's maybe four or five levels deep,
4742
06:23:45,230 --> 06:23:46,230
and you don't want to specify the float every
time, you can just use an inherit element
4743
06:23:46,230 --> 06:23:47,230
to move everything to the right side, with
only specifying the float once to the last
4744
06:23:47,230 --> 06:23:48,230
value I want to talk about is the is the non
value. So this is kind of the default value
4745
06:23:48,230 --> 06:23:49,230
that you're going to see if you don't specify
anything. And it's pretty much just going
4746
06:23:49,230 --> 06:23:50,230
to keep the item in its place. It's not going
to change its float or display, and it's pretty
4747
06:23:50,230 --> 06:23:51,230
much not going to move it around at all. It's
not the same as display none, though, it doesn't
4748
06:23:51,230 --> 06:23:52,230
really remove anything, what float none pretty
much does, it's just leaves it where it naturally
4749
06:23:52,230 --> 06:23:53,230
occurs in the text. So for example, if you
have a block level, div tag, and you've set
4750
06:23:53,230 --> 06:23:54,230
its float to none, then it's just going to
appear as a block level elements is not going
4751
06:23:54,230 --> 06:23:55,230
to move around or do anything similar. So
there you go. That's pretty much it for floats,
4752
06:23:55,230 --> 06:23:56,230
and displays. We're going to be working with
these a lot throughout the rest of this course.
4753
06:23:56,230 --> 06:23:57,230
And they're very important property. So I
recommend you get some practice with them,
4754
06:23:57,230 --> 06:23:58,230
and start using them. So you can see all of
the different ways that you can use the display
4755
06:23:58,230 --> 06:23:59,230
and flow properties in your website. Now,
apart from the box model, and a few other
4756
06:23:59,230 --> 06:24:00,230
ways displays and floats are a very common
way or at least a word of manipulating your
4757
06:24:00,230 --> 06:24:01,230
website and making it look really good. So
without it, the website is just kind of everywhere,
4758
06:24:01,230 --> 06:24:02,230
all the elements are scattered around. But
if you want to really make the website, look
4759
06:24:02,230 --> 06:24:03,230
how you want it to look, you need to use this
in combination with a few other features that
4760
06:24:03,230 --> 06:24:04,230
we are going to learn in the future in order
to make your website look great. Alright,
4761
06:24:04,230 --> 06:24:05,230
let's move on.
4762
06:24:05,230 --> 06:24:06,230
So today we're going to get started with a
new topic in CSS. And this is a very exciting
4763
06:24:06,230 --> 06:24:07,230
one, because we're going to start learning
more about very advanced layout techniques.
4764
06:24:07,230 --> 06:24:08,230
So in the past, we've learned about two pretty
basic layout to learn about floats and displays
4765
06:24:08,230 --> 06:24:09,230
and the box model, but they're not really
enough to create the best websites possible.
4766
06:24:09,230 --> 06:24:10,230
To do that, we're going to need some extra
advanced techniques, which is what we're going
4767
06:24:10,230 --> 06:24:11,230
to be covering in the next three sections.
In this first section, we're going to be looking
4768
06:24:11,230 --> 06:24:12,230
at CSS Flexbox. Now we're going to give a
quick or I'm going to give a quick introduction
4769
06:24:12,230 --> 06:24:13,230
to it. In this video, we'll be talking a little
bit about what it is, how it works, and how
4770
06:24:13,230 --> 06:24:14,230
you can apply it and what you can do with
it. But for now, we're just going to go ahead
4771
06:24:14,230 --> 06:24:15,230
and get started with it. So first of all,
what actually is Flexbox. So if you don't
4772
06:24:15,230 --> 06:24:16,230
know already, Flexbox stands for flexible
box. And similar to the box model. It's a
4773
06:24:16,230 --> 06:24:17,230
concept in CSS, or a feature that allows you
to create and arrange items or elements very
4774
06:24:17,230 --> 06:24:18,230
easily. So it's a great alternative to using
something like the box model or floats or
4775
06:24:18,230 --> 06:24:19,230
displays if you want to create very responsive
websites or lay out your items in a way that
4776
06:24:19,230 --> 06:24:20,230
makes it look great. So this is an alternative
to using those traditional techniques that
4777
06:24:20,230 --> 06:24:21,230
were using earlier versions of CSS. So the
Flexbox or the main Flexbox is split into
4778
06:24:21,230 --> 06:24:22,230
two different components. You have the container
and the flex items. So the container is the
4779
06:24:22,230 --> 06:24:23,230
parent element, it's what is going to become
the container for all of the items now. Usually
4780
06:24:23,230 --> 06:24:24,230
what you would do is use this on a div or
some other form of container element. And
4781
06:24:24,230 --> 06:24:25,230
then use some special properties which we're
going to be covering in the next video to
4782
06:24:25,230 --> 06:24:26,230
create the flex container. But then the next
part is the flex items. So this can be pretty
4783
06:24:26,230 --> 06:24:27,230
much anything you want images, links, spans
whatever you want, you can add them as flex
4784
06:24:27,230 --> 06:24:28,230
items and this is what makes up the flex box.
Now What you can do with these two components
4785
06:24:28,230 --> 06:24:29,230
is actually use different properties to manipulate
them and create really nice layout like this
4786
06:24:29,230 --> 06:24:30,230
one that we have here. And that's what we're
actually going to be covering in the next
4787
06:24:30,230 --> 06:24:31,230
few videos is learning how to manipulate the
container as well as the items inside. So
4788
06:24:31,230 --> 06:24:32,230
what can you actually do with Flexbox? Well,
you know that you can create these nice responsive
4789
06:24:32,230 --> 06:24:33,230
grids, but what would you actually use them
for? Well, although it might not be apparent,
4790
06:24:33,230 --> 06:24:34,230
pretty much all pages these days use some
form of CSS layout, whether it be the box
4791
06:24:34,230 --> 06:24:35,230
model, or Flexbox, or CSS Grid, which we're
going to be covering in the next section,
4792
06:24:35,230 --> 06:24:36,230
there are so many ways that it can be used.
Flexbox is mainly used to layout a website
4793
06:24:36,230 --> 06:24:37,230
or create different components. So for example,
the top of the page is going to contain your
4794
06:24:37,230 --> 06:24:38,230
sidebar, that's one flex item. And then you
have the right side of your page, which takes
4795
06:24:38,230 --> 06:24:39,230
up maybe 30% of the page. And that's your
or Yeah, so the top is your menu, for example.
4796
06:24:39,230 --> 06:24:40,230
And then the side on the right is your sidebar,
and you have the rest is content and you have
4797
06:24:40,230 --> 06:24:41,230
little widgets everywhere. And you can start
to see how this all connects together, you
4798
06:24:41,230 --> 06:24:42,230
can create really good looking websites by
creating one huge flex container, and then
4799
06:24:42,230 --> 06:24:43,230
creating a bunch of separate items, putting
all of your different things in those items.
4800
06:24:43,230 --> 06:24:44,230
So it's pretty much just a way to layout your
website. Now in the past, we've used floats
4801
06:24:44,230 --> 06:24:45,230
to move images around. And we've used also
margin and padding to push things up and down.
4802
06:24:45,230 --> 06:24:46,230
But that's not a really efficient way, it's
more of a kind of hack to move things around.
4803
06:24:46,230 --> 06:24:47,230
And using something like Flexbox pretty much
lets you do all of this naturally. Alright,
4804
06:24:47,230 --> 06:24:48,230
so there we go. That's a little introduction
to Flexbox. And how it works. Now what we're
4805
06:24:48,230 --> 06:24:49,230
going to do is go ahead and go onto our machine
and start creating some flex containers. Alright,
4806
06:24:49,230 --> 06:24:50,230
let's move on.
4807
06:24:50,230 --> 06:24:51,230
So today we're going to get started with a
new topic in CSS. And this is a very exciting
4808
06:24:51,230 --> 06:24:52,230
one, because we're going to start learning
more about very advanced layout techniques.
4809
06:24:52,230 --> 06:24:53,230
So in the past, we've learned about two pretty
basic layout to learn about floats and displays
4810
06:24:53,230 --> 06:24:54,230
and the box model, but they're not really
enough to create the best websites possible.
4811
06:24:54,230 --> 06:24:55,230
To do that, we're going to need some extra
advanced techniques, which is what we're going
4812
06:24:55,230 --> 06:24:56,230
to be covering in the next three sections.
In this first section, we're going to be looking
4813
06:24:56,230 --> 06:24:57,230
at CSS Flexbox. Now we're going to give a
quick or I'm going to give a quick introduction
4814
06:24:57,230 --> 06:24:58,230
to it. In this video, we'll be talking a little
bit about what it is, how it works, and how
4815
06:24:58,230 --> 06:24:59,230
you can apply it and what you can do with
it. But for now, we're just going to go ahead
4816
06:24:59,230 --> 06:25:00,230
and get started with it. So first of all,
what actually is Flexbox. So if you don't
4817
06:25:00,230 --> 06:25:01,230
know already, Flexbox stands for flexible
box. And similar to the box model. It's a
4818
06:25:01,230 --> 06:25:02,230
concept in CSS, or a feature that allows you
to create and arrange items or elements very
4819
06:25:02,230 --> 06:25:03,230
easily. So it's a great alternative to using
something like the box model or floats or
4820
06:25:03,230 --> 06:25:04,230
displays if you want to create very responsive
websites or lay out your items in a way that
4821
06:25:04,230 --> 06:25:05,230
makes it look great. So this is an alternative
to using those traditional techniques that
4822
06:25:05,230 --> 06:25:06,230
were using earlier versions of CSS. So the
Flexbox or the main Flexbox is split into
4823
06:25:06,230 --> 06:25:07,230
two different components. You have the container
and the flex items. So the container is the
4824
06:25:07,230 --> 06:25:08,230
parent element, it's what is going to become
the container for all of the items now. Usually
4825
06:25:08,230 --> 06:25:09,230
what you would do is use this on a div or
some other form of container element. And
4826
06:25:09,230 --> 06:25:10,230
then use some special properties which we're
going to be covering in the next video to
4827
06:25:10,230 --> 06:25:11,230
create the flex container. But then the next
part is the flex items. So this can be pretty
4828
06:25:11,230 --> 06:25:12,230
much anything you want images, links, spans
whatever you want, you can add them as flex
4829
06:25:12,230 --> 06:25:13,230
items and this is what makes up the flex box.
Now What you can do with these two components
4830
06:25:13,230 --> 06:25:14,230
is actually use different properties to manipulate
them and create really nice layout like this
4831
06:25:14,230 --> 06:25:15,230
one that we have here. And that's what we're
actually going to be covering in the next
4832
06:25:15,230 --> 06:25:16,230
few videos is learning how to manipulate the
container as well as the items inside. So
4833
06:25:16,230 --> 06:25:17,230
what can you actually do with Flexbox? Well,
you know that you can create these nice responsive
4834
06:25:17,230 --> 06:25:18,230
grids, but what would you actually use them
for? Well, although it might not be apparent,
4835
06:25:18,230 --> 06:25:19,230
pretty much all pages these days use some
form of CSS layout, whether it be the box
4836
06:25:19,230 --> 06:25:20,230
model, or Flexbox, or CSS Grid, which we're
going to be covering in the next section,
4837
06:25:20,230 --> 06:25:21,230
there are so many ways that it can be used.
Flexbox is mainly used to layout a website
4838
06:25:21,230 --> 06:25:22,230
or create different components. So for example,
the top of the page is going to contain your
4839
06:25:22,230 --> 06:25:23,230
sidebar, that's one flex item. And then you
have the right side of your page, which takes
4840
06:25:23,230 --> 06:25:24,230
up maybe 30% of the page. And that's your
or Yeah, so the top is your menu, for example.
4841
06:25:24,230 --> 06:25:25,230
And then the side on the right is your sidebar,
and you have the rest is content and you have
4842
06:25:25,230 --> 06:25:26,230
little widgets everywhere. And you can start
to see how this all connects together, you
4843
06:25:26,230 --> 06:25:27,230
can create really good looking websites by
creating one huge flex container, and then
4844
06:25:27,230 --> 06:25:28,230
creating a bunch of separate items, putting
all of your different things in those items.
4845
06:25:28,230 --> 06:25:29,230
So it's pretty much just a way to layout your
website. Now in the past, we've used floats
4846
06:25:29,230 --> 06:25:30,230
to move images around. And we've used also
margin and padding to push things up and down.
4847
06:25:30,230 --> 06:25:31,230
But that's not a really efficient way, it's
more of a kind of hack to move things around.
4848
06:25:31,230 --> 06:25:32,230
And using something like Flexbox pretty much
lets you do all of this naturally. Alright,
4849
06:25:32,230 --> 06:25:33,230
so there we go. That's a little introduction
to Flexbox. And how it works. Now what we're
4850
06:25:33,230 --> 06:25:34,230
going to do is go ahead and go onto our machine
and start creating some flex containers. Alright,
4851
06:25:34,230 --> 06:25:35,230
let's move on.
4852
06:25:35,230 --> 06:25:36,230
So in this video, we're going to be going
ahead and creating our first flex container
4853
06:25:36,230 --> 06:25:37,230
or Flexbox. Now, I already have some apparatus
set up here so that we can get started straight
4854
06:25:37,230 --> 06:25:38,230
away without having to go and do anything
with any of the styling. And this is the best
4855
06:25:38,230 --> 06:25:39,230
way to really see how Flexbox works. Because
without it, you know, it's just kind of look,
4856
06:25:39,230 --> 06:25:40,230
it's gonna look kind of weird, all the invisible
backgrounds and things. So I think this is
4857
06:25:40,230 --> 06:25:41,230
the best way to really see demonstrate how
Flexbox works. Alright, let's get started.
4858
06:25:41,230 --> 06:25:42,230
So well, it's actually quite easy to set up
a flex container, the hard part is creating
4859
06:25:42,230 --> 06:25:43,230
how you want, but it uses the display property
just like any other item on this page. So
4860
06:25:43,230 --> 06:25:44,230
when we set the display to block or inline,
block or inline, we do all of that. But we
4861
06:25:44,230 --> 06:25:45,230
can actually set it to flex. And what that's
going to do is create our flex container.
4862
06:25:45,230 --> 06:25:46,230
So all we have to do is go ahead and find
our parent element, the container that we
4863
06:25:46,230 --> 06:25:47,230
want, and I already have the class set up
here. If you want to go ahead and do this
4864
06:25:47,230 --> 06:25:48,230
on your own, you can, like I said, if maybe
if you want to copy these styles, for example,
4865
06:25:48,230 --> 06:25:49,230
you can go ahead and check out the project
files. But like I said, you can just go ahead
4866
06:25:49,230 --> 06:25:50,230
and create your own setup so that you can
start working with it. So first of all, we're
4867
06:25:50,230 --> 06:25:51,230
going to go ahead and find our parent element.
So in this case, these are going to be our
4868
06:25:51,230 --> 06:25:52,230
items in the future. And then this div is
our main element. So I'm going to go over
4869
06:25:52,230 --> 06:25:53,230
here. And I will go into go ahead and give
it the display property of flex. Now, instead
4870
06:25:53,230 --> 06:25:54,230
of doing something like block or inline block,
instead, we set it to flex. And what this
4871
06:25:54,230 --> 06:25:55,230
is going to do is create our flex container.
Now watch what happens. You can see now that
4872
06:25:55,230 --> 06:25:56,230
instead of having it just in a row, all of
these items have been spaced out accordingly.
4873
06:25:56,230 --> 06:25:57,230
Now all of the default values of all of the
flex properties have now been set up now that
4874
06:25:57,230 --> 06:25:58,230
our display mode has been activated. Now in
the next few videos, we're actually going
4875
06:25:58,230 --> 06:25:59,230
to be going through and manipulating these
properties. For example, changing the order,
4876
06:25:59,230 --> 06:26:00,230
we're going to change the size and width of
these. And we're going to go ahead and justify
4877
06:26:00,230 --> 06:26:01,230
and align the content. But that's for a future
video. For now, all you need to know is that
4878
06:26:01,230 --> 06:26:02,230
by setting the display property to flex on
a parent container, it's going to set up all
4879
06:26:02,230 --> 06:26:03,230
the default values of the flex properties
and create the flex container that we want
4880
06:26:03,230 --> 06:26:04,230
to work with in the next few videos. Alright,
let's move on.
4881
06:26:04,230 --> 06:26:05,230
So in this video, we're going to be going
ahead and creating our first flex container
4882
06:26:05,230 --> 06:26:06,230
or Flexbox. Now, I already have some apparatus
set up here so that we can get started straight
4883
06:26:06,230 --> 06:26:07,230
away without having to go and do anything
with any of the styling. And this is the best
4884
06:26:07,230 --> 06:26:08,230
way to really see how Flexbox works. Because
without it, you know, it's just kind of look,
4885
06:26:08,230 --> 06:26:09,230
it's gonna look kind of weird, all the invisible
backgrounds and things. So I think this is
4886
06:26:09,230 --> 06:26:10,230
the best way to really see demonstrate how
Flexbox works. Alright, let's get started.
4887
06:26:10,230 --> 06:26:11,230
So well, it's actually quite easy to set up
a flex container, the hard part is creating
4888
06:26:11,230 --> 06:26:12,230
how you want, but it uses the display property
just like any other item on this page. So
4889
06:26:12,230 --> 06:26:13,230
when we set the display to block or inline,
block or inline, we do all of that. But we
4890
06:26:13,230 --> 06:26:14,230
can actually set it to flex. And what that's
going to do is create our flex container.
4891
06:26:14,230 --> 06:26:15,230
So all we have to do is go ahead and find
our parent element, the container that we
4892
06:26:15,230 --> 06:26:16,230
want, and I already have the class set up
here. If you want to go ahead and do this
4893
06:26:16,230 --> 06:26:17,230
on your own, you can, like I said, if maybe
if you want to copy these styles, for example,
4894
06:26:17,230 --> 06:26:18,230
you can go ahead and check out the project
files. But like I said, you can just go ahead
4895
06:26:18,230 --> 06:26:19,230
and create your own setup so that you can
start working with it. So first of all, we're
4896
06:26:19,230 --> 06:26:20,230
going to go ahead and find our parent element.
So in this case, these are going to be our
4897
06:26:20,230 --> 06:26:21,230
items in the future. And then this div is
our main element. So I'm going to go over
4898
06:26:21,230 --> 06:26:22,230
here. And I will go into go ahead and give
it the display property of flex. Now, instead
4899
06:26:22,230 --> 06:26:23,230
of doing something like block or inline block,
instead, we set it to flex. And what this
4900
06:26:23,230 --> 06:26:24,230
is going to do is create our flex container.
Now watch what happens. You can see now that
4901
06:26:24,230 --> 06:26:25,230
instead of having it just in a row, all of
these items have been spaced out accordingly.
4902
06:26:25,230 --> 06:26:26,230
Now all of the default values of all of the
flex properties have now been set up now that
4903
06:26:26,230 --> 06:26:27,230
our display mode has been activated. Now in
the next few videos, we're actually going
4904
06:26:27,230 --> 06:26:28,230
to be going through and manipulating these
properties. For example, changing the order,
4905
06:26:28,230 --> 06:26:29,230
we're going to change the size and width of
these. And we're going to go ahead and justify
4906
06:26:29,230 --> 06:26:30,230
and align the content. But that's for a future
video. For now, all you need to know is that
4907
06:26:30,230 --> 06:26:31,230
by setting the display property to flex on
a parent container, it's going to set up all
4908
06:26:31,230 --> 06:26:32,230
the default values of the flex properties
and create the flex container that we want
4909
06:26:32,230 --> 06:26:33,230
to work with in the next few videos. Alright,
let's move on.
4910
06:26:33,230 --> 06:26:34,230
So in this video, we're going to be covering
two of the properties of our flex container,
4911
06:26:34,230 --> 06:26:35,230
direction and wrap. So right now we have everything
set up. We have five flex items here labeled
4912
06:26:35,230 --> 06:26:36,230
A to E, and then we also have our container.
But now we're going to go through and start
4913
06:26:36,230 --> 06:26:37,230
manipulating it. So the first thing I want
to talk about is flex direction. So pretty
4914
06:26:37,230 --> 06:26:38,230
much right now it's laid out in a row here,
but what we can actually do is specify the
4915
06:26:38,230 --> 06:26:39,230
direction that we want our items to go in.
We can also reverse the order using a special
4916
06:26:39,230 --> 06:26:40,230
suffix. Let's get started. So the property
that we're going to use is flex direction,
4917
06:26:40,230 --> 06:26:41,230
flex dash direction. And you add this to the
container to the flex container. So here we're
4918
06:26:41,230 --> 06:26:42,230
going to specify either row or column row
is the default value, and it's going to be
4919
06:26:42,230 --> 06:26:43,230
going in a direction to the right side of
the container. We also have column, which
4920
06:26:43,230 --> 06:26:44,230
is what we kind of saw before. And you can
see it's a little bit better spaced out. And
4921
06:26:44,230 --> 06:26:45,230
you can see it goes A to E, except it goes
in a column. Now, that's pretty easy to understand.
4922
06:26:45,230 --> 06:26:46,230
But we can also go reverse. So instead of
A to E, it goes eat a, all we have to do is
4923
06:26:46,230 --> 06:26:47,230
add dash reverse to column a row, and it's
going to flip the direction that our item
4924
06:26:47,230 --> 06:26:48,230
is going in. Let's refresh. And now you can
see it's going in reverse. We can also do
4925
06:26:48,230 --> 06:26:49,230
the same thing with row or pretty much any
other value for this property here. You can
4926
06:26:49,230 --> 06:26:50,230
see now it goes E to a, and it also goes in
the opposite way to the left side of the page
4927
06:26:50,230 --> 06:26:51,230
instead of to the right side. So that's it
for flex direction, it's very easy to understand,
4928
06:26:51,230 --> 06:26:52,230
I'm just going to go ahead and set it back
to wrote the default. The next item I want
4929
06:26:52,230 --> 06:26:53,230
to talk about is flex wrap. So this is a little
bit more complicated to understand. But once
4930
06:26:53,230 --> 06:26:54,230
we start using it, it gets quite easy. Pretty
much when you wrap an item, it's going to
4931
06:26:54,230 --> 06:26:55,230
move it to a new row or column to avoid the
exceeding the maximum length. So for example,
4932
06:26:55,230 --> 06:26:56,230
if we had more than the specified amount of
items here, so if we had a, b, c, d, e, and
4933
06:26:56,230 --> 06:26:57,230
then F, G, H, I and all the ways to K or L,
we don't want it to keep going on forever.
4934
06:26:57,230 --> 06:26:58,230
So what we want to do is once it gets to a
certain length, rump length, wrap it around
4935
06:26:58,230 --> 06:26:59,230
and move it to a new line. So I'm actually
going to go ahead and do that here. I'm going
4936
06:26:59,230 --> 06:27:00,230
to go ahead and copy all of these items, pretty
much double it. And then I'm going to say
4937
06:27:00,230 --> 06:27:01,230
f, g, h, i and j. And now let's go ahead and
refresh the page and see how this looks. You
4938
06:27:01,230 --> 06:27:02,230
can see we have now abcdefg H I J. And of
course it's not going past the page yet, but
4939
06:27:02,230 --> 06:27:03,230
we can actually wrap this around and see how
it looks. So all we have to do is add the
4940
06:27:03,230 --> 06:27:04,230
flex dash wrap property. And now we can either
specify we can specify one of two values,
4941
06:27:04,230 --> 06:27:05,230
wrap and no rap. So I'm going to go ahead
and say rap. Now if we go ahead and refresh
4942
06:27:05,230 --> 06:27:06,230
the page, you can see that instead of kind
of squeezing in the space or changing the
4943
06:27:06,230 --> 06:27:07,230
spacing, it just moves this to a new row,
we can also go ahead and use rock reverse,
4944
06:27:07,230 --> 06:27:08,230
which pretty much revolves, it does the exact
same thing, but it reverses the order. So
4945
06:27:08,230 --> 06:27:09,230
now if we go ahead and refresh, you can see
that this whole thing is kind of flipped.
4946
06:27:09,230 --> 06:27:10,230
Now normally, you won't see rapper verse used.
So I would just go ahead and learn how to
4947
06:27:10,230 --> 06:27:11,230
use rap and no rap. Now, of course, if you're
going to go ahead and use no rap, it's usually
4948
06:27:11,230 --> 06:27:12,230
because of some inherited value, because again,
no rap is the default value that's used, so
4949
06:27:12,230 --> 06:27:13,230
you won't really see it commonly in CSS. Let's
go ahead and set the property back to wrap.
4950
06:27:13,230 --> 06:27:14,230
So those are the two main properties that
we're going to cover in this video is wrap
4951
06:27:14,230 --> 06:27:15,230
and flex direction. Now, of course, these
are two very basic properties, but they're
4952
06:27:15,230 --> 06:27:16,230
still very useful. And you can really see
how this can be used commonly inside our website
4953
06:27:16,230 --> 06:27:17,230
and inside web development as a whole. Alright,
so that's pretty much it for these two properties.
4954
06:27:17,230 --> 06:27:18,230
Let's move on to some of the other properties
that we can use on our flex container in CSS.
4955
06:27:18,230 --> 06:27:19,230
So in this video, we're going to be covering
two of the properties of our flex container,
4956
06:27:19,230 --> 06:27:20,230
direction and wrap. So right now we have everything
set up. We have five flex items here labeled
4957
06:27:20,230 --> 06:27:21,230
A to E, and then we also have our container.
But now we're going to go through and start
4958
06:27:21,230 --> 06:27:22,230
manipulating it. So the first thing I want
to talk about is flex direction. So pretty
4959
06:27:22,230 --> 06:27:23,230
much right now it's laid out in a row here,
but what we can actually do is specify the
4960
06:27:23,230 --> 06:27:24,230
direction that we want our items to go in.
We can also reverse the order using a special
4961
06:27:24,230 --> 06:27:25,230
suffix. Let's get started. So the property
that we're going to use is flex direction,
4962
06:27:25,230 --> 06:27:26,230
flex dash direction. And you add this to the
container to the flex container. So here we're
4963
06:27:26,230 --> 06:27:27,230
going to specify either row or column row
is the default value, and it's going to be
4964
06:27:27,230 --> 06:27:28,230
going in a direction to the right side of
the container. We also have column, which
4965
06:27:28,230 --> 06:27:29,230
is what we kind of saw before. And you can
see it's a little bit better spaced out. And
4966
06:27:29,230 --> 06:27:30,230
you can see it goes A to E, except it goes
in a column. Now, that's pretty easy to understand.
4967
06:27:30,230 --> 06:27:31,230
But we can also go reverse. So instead of
A to E, it goes eat a, all we have to do is
4968
06:27:31,230 --> 06:27:32,230
add dash reverse to column a row, and it's
going to flip the direction that our item
4969
06:27:32,230 --> 06:27:33,230
is going in. Let's refresh. And now you can
see it's going in reverse. We can also do
4970
06:27:33,230 --> 06:27:34,230
the same thing with row or pretty much any
other value for this property here. You can
4971
06:27:34,230 --> 06:27:35,230
see now it goes E to a, and it also goes in
the opposite way to the left side of the page
4972
06:27:35,230 --> 06:27:36,230
instead of to the right side. So that's it
for flex direction, it's very easy to understand,
4973
06:27:36,230 --> 06:27:37,230
I'm just going to go ahead and set it back
to wrote the default. The next item I want
4974
06:27:37,230 --> 06:27:38,230
to talk about is flex wrap. So this is a little
bit more complicated to understand. But once
4975
06:27:38,230 --> 06:27:39,230
we start using it, it gets quite easy. Pretty
much when you wrap an item, it's going to
4976
06:27:39,230 --> 06:27:40,230
move it to a new row or column to avoid the
exceeding the maximum length. So for example,
4977
06:27:40,230 --> 06:27:41,230
if we had more than the specified amount of
items here, so if we had a, b, c, d, e, and
4978
06:27:41,230 --> 06:27:42,230
then F, G, H, I and all the ways to K or L,
we don't want it to keep going on forever.
4979
06:27:42,230 --> 06:27:43,230
So what we want to do is once it gets to a
certain length, rump length, wrap it around
4980
06:27:43,230 --> 06:27:44,230
and move it to a new line. So I'm actually
going to go ahead and do that here. I'm going
4981
06:27:44,230 --> 06:27:45,230
to go ahead and copy all of these items, pretty
much double it. And then I'm going to say
4982
06:27:45,230 --> 06:27:46,230
f, g, h, i and j. And now let's go ahead and
refresh the page and see how this looks. You
4983
06:27:46,230 --> 06:27:47,230
can see we have now abcdefg H I J. And of
course it's not going past the page yet, but
4984
06:27:47,230 --> 06:27:48,230
we can actually wrap this around and see how
it looks. So all we have to do is add the
4985
06:27:48,230 --> 06:27:49,230
flex dash wrap property. And now we can either
specify we can specify one of two values,
4986
06:27:49,230 --> 06:27:50,230
wrap and no rap. So I'm going to go ahead
and say rap. Now if we go ahead and refresh
4987
06:27:50,230 --> 06:27:51,230
the page, you can see that instead of kind
of squeezing in the space or changing the
4988
06:27:51,230 --> 06:27:52,230
spacing, it just moves this to a new row,
we can also go ahead and use rock reverse,
4989
06:27:52,230 --> 06:27:53,230
which pretty much revolves, it does the exact
same thing, but it reverses the order. So
4990
06:27:53,230 --> 06:27:54,230
now if we go ahead and refresh, you can see
that this whole thing is kind of flipped.
4991
06:27:54,230 --> 06:27:55,230
Now normally, you won't see rapper verse used.
So I would just go ahead and learn how to
4992
06:27:55,230 --> 06:27:56,230
use rap and no rap. Now, of course, if you're
going to go ahead and use no rap, it's usually
4993
06:27:56,230 --> 06:27:57,230
because of some inherited value, because again,
no rap is the default value that's used, so
4994
06:27:57,230 --> 06:27:58,230
you won't really see it commonly in CSS. Let's
go ahead and set the property back to wrap.
4995
06:27:58,230 --> 06:27:59,230
So those are the two main properties that
we're going to cover in this video is wrap
4996
06:27:59,230 --> 06:28:00,230
and flex direction. Now, of course, these
are two very basic properties, but they're
4997
06:28:00,230 --> 06:28:01,230
still very useful. And you can really see
how this can be used commonly inside our website
4998
06:28:01,230 --> 06:28:02,230
and inside web development as a whole. Alright,
so that's pretty much it for these two properties.
4999
06:28:02,230 --> 06:28:03,230
Let's move on to some of the other properties
that we can use on our flex container in CSS.
5000
06:28:03,230 --> 06:28:04,230
So in this video, we're going to be talking
about two very important elements or what
5001
06:28:04,230 --> 06:28:05,230
properties that can be used to justify and
align flex items inside of container. So we're
5002
06:28:05,230 --> 06:28:06,230
going to be talking about two main properties,
one of them is going to be responsible for
5003
06:28:06,230 --> 06:28:07,230
the horizontal alignment, and the other for
the vertical alignment. So let's talk about
5004
06:28:07,230 --> 06:28:08,230
them. The first one which is for horizontal
alignment is called justify content. Now,
5005
06:28:08,230 --> 06:28:09,230
both of these ello, both of these properties
actually contained three main values which
5006
06:28:09,230 --> 06:28:10,230
are shared between the two of them. And then
each of them can take two special values,
5007
06:28:10,230 --> 06:28:11,230
which actually align them in a pretty different
way than you would expect. So let's talk about
5008
06:28:11,230 --> 06:28:12,230
justify content. Now first of all, you'll
notice that these are a little bit stretched
5009
06:28:12,230 --> 06:28:13,230
out, don't worry about that for now, that's
just because of the added height to the container
5010
06:28:13,230 --> 06:28:14,230
will talk about that in just a second. But
let's get started. So the first three properties
5011
06:28:14,230 --> 06:28:15,230
that are pretty common are flex start, flex
end, and center. So flex start is going to
5012
06:28:15,230 --> 06:28:16,230
be where the container starts, which in this
case is on the left. On the other hand, the
5013
06:28:16,230 --> 06:28:17,230
end is going to be the opposite. So on in
this container, it's on the right and then
5014
06:28:17,230 --> 06:28:18,230
center positions in the middle. So what I'm
going to do here is just set it as center
5015
06:28:18,230 --> 06:28:19,230
for now. And you can see that now all of our
eyes limbs have been centered in the middle
5016
06:28:19,230 --> 06:28:20,230
here. If I said something like flex end, and
remember, it does contain a dash in there,
5017
06:28:20,230 --> 06:28:21,230
it's going to move everything to the end of
the container here. So those are the three
5018
06:28:21,230 --> 06:28:22,230
main values. Let's talk about the two special
ones now. Now, pretty much these ones are
5019
06:28:22,230 --> 06:28:23,230
going to be messing a little bit with the
spacing between these, but they are still
5020
06:28:23,230 --> 06:28:24,230
related to alignment, because it's changing
the spacing in a way that does actually align
5021
06:28:24,230 --> 06:28:25,230
our elements here. So the two main values
are space around and space between. So let's
5022
06:28:25,230 --> 06:28:26,230
talk about space between first, what happens
is that space, the spacing between the flex
5023
06:28:26,230 --> 06:28:27,230
items is created so that it's all equal. And
it creates equal divisions to move everything
5024
06:28:27,230 --> 06:28:28,230
on well, equally divided from each other on
the same row. On the other hand, space around
5025
06:28:28,230 --> 06:28:29,230
actually creates spacing on all sides of the
item. So instead of just creating them between,
5026
06:28:29,230 --> 06:28:30,230
it's going to create them between some of
the flex items and the edges. So though, that's
5027
06:28:30,230 --> 06:28:31,230
the main difference between the two, and it
depends on what you really want. So for example,
5028
06:28:31,230 --> 06:28:32,230
if you want a centered kind of item or a centered
Flexbox, what you would do is use the space
5029
06:28:32,230 --> 06:28:33,230
around property. Whereas if you wanted something
to be stretched out, you would use the space
5030
06:28:33,230 --> 06:28:34,230
between property.
5031
06:28:34,230 --> 06:28:35,230
So in this video, we're going to be talking
about two very important elements or what
5032
06:28:35,230 --> 06:28:36,230
properties that can be used to justify and
align flex items inside of container. So we're
5033
06:28:36,230 --> 06:28:37,230
going to be talking about two main properties,
one of them is going to be responsible for
5034
06:28:37,230 --> 06:28:38,230
the horizontal alignment, and the other for
the vertical alignment. So let's talk about
5035
06:28:38,230 --> 06:28:39,230
them. The first one which is for horizontal
alignment is called justify content. Now,
5036
06:28:39,230 --> 06:28:40,230
both of these ello, both of these properties
actually contained three main values which
5037
06:28:40,230 --> 06:28:41,230
are shared between the two of them. And then
each of them can take two special values,
5038
06:28:41,230 --> 06:28:42,230
which actually align them in a pretty different
way than you would expect. So let's talk about
5039
06:28:42,230 --> 06:28:43,230
justify content. Now first of all, you'll
notice that these are a little bit stretched
5040
06:28:43,230 --> 06:28:44,230
out, don't worry about that for now, that's
just because of the added height to the container
5041
06:28:44,230 --> 06:28:45,230
will talk about that in just a second. But
let's get started. So the first three properties
5042
06:28:45,230 --> 06:28:46,230
that are pretty common are flex start, flex
end, and center. So flex start is going to
5043
06:28:46,230 --> 06:28:47,230
be where the container starts, which in this
case is on the left. On the other hand, the
5044
06:28:47,230 --> 06:28:48,230
end is going to be the opposite. So on in
this container, it's on the right and then
5045
06:28:48,230 --> 06:28:49,230
center positions in the middle. So what I'm
going to do here is just set it as center
5046
06:28:49,230 --> 06:28:50,230
for now. And you can see that now all of our
eyes limbs have been centered in the middle
5047
06:28:50,230 --> 06:28:51,230
here. If I said something like flex end, and
remember, it does contain a dash in there,
5048
06:28:51,230 --> 06:28:52,230
it's going to move everything to the end of
the container here. So those are the three
5049
06:28:52,230 --> 06:28:53,230
main values. Let's talk about the two special
ones now. Now, pretty much these ones are
5050
06:28:53,230 --> 06:28:54,230
going to be messing a little bit with the
spacing between these, but they are still
5051
06:28:54,230 --> 06:28:55,230
related to alignment, because it's changing
the spacing in a way that does actually align
5052
06:28:55,230 --> 06:28:56,230
our elements here. So the two main values
are space around and space between. So let's
5053
06:28:56,230 --> 06:28:57,230
talk about space between first, what happens
is that space, the spacing between the flex
5054
06:28:57,230 --> 06:28:58,230
items is created so that it's all equal. And
it creates equal divisions to move everything
5055
06:28:58,230 --> 06:28:59,230
on well, equally divided from each other on
the same row. On the other hand, space around
5056
06:28:59,230 --> 06:29:00,230
actually creates spacing on all sides of the
item. So instead of just creating them between,
5057
06:29:00,230 --> 06:29:01,230
it's going to create them between some of
the flex items and the edges. So though, that's
5058
06:29:01,230 --> 06:29:02,230
the main difference between the two, and it
depends on what you really want. So for example,
5059
06:29:02,230 --> 06:29:03,230
if you want a centered kind of item or a centered
Flexbox, what you would do is use the space
5060
06:29:03,230 --> 06:29:04,230
around property. Whereas if you wanted something
to be stretched out, you would use the space
5061
06:29:04,230 --> 06:29:05,230
between property.
5062
06:29:05,230 --> 06:29:06,230
So there we go. Those are some of the little
items or values that you can use under justify
5063
06:29:06,230 --> 06:29:07,230
content property. Now let's move on to align
items. So this is the property that aligns
5064
06:29:07,230 --> 06:29:08,230
it vertically. Now by default, it's set to
stretch, which is what we can see here. So
5065
06:29:08,230 --> 06:29:09,230
it just stretches all the way across down
to the bottom of the container, we can actually
5066
06:29:09,230 --> 06:29:10,230
change this. So let's go ahead and add this
property align items. Now what we're going
5067
06:29:10,230 --> 06:29:11,230
to do is change it to center. So just like
before, we have three main values, flex, start
5068
06:29:11,230 --> 06:29:12,230
flex, and and center, you can see that immediately.
Now all of these items are still spaced in
5069
06:29:12,230 --> 06:29:13,230
between, but they have been moved to the center
here. So you can see here that on the Align
5070
06:29:13,230 --> 06:29:14,230
items, this has been arranged vertically,
it this is the start at the top and the and
5071
06:29:14,230 --> 06:29:15,230
the bottom and the flex end is well at the
bottom of the container, justify content says
5072
06:29:15,230 --> 06:29:16,230
the flex start is on the left side, and the
flex end is on the right. So there we go,
5073
06:29:16,230 --> 06:29:17,230
you can see what this is what this looks like
right here is when we align the items, it
5074
06:29:17,230 --> 06:29:18,230
centers it in between the top and the bottom.
So let's go ahead and just see what the other
5075
06:29:18,230 --> 06:29:19,230
values look like. So for example, flex start.
So for, let's just say you want to keep the
5076
06:29:19,230 --> 06:29:20,230
height of these items the same, you don't
want to stretch them, this is what you would
5077
06:29:20,230 --> 06:29:21,230
do, you could also set it to flex and if you
wanted something to appear at the end of the
5078
06:29:21,230 --> 06:29:22,230
page. And yeah, that's pretty much it for
those three main values. Now let's talk about
5079
06:29:22,230 --> 06:29:23,230
the two special values. So these are a little
bit different because they don't follow some
5080
06:29:23,230 --> 06:29:24,230
general convention. But the two values are
baseline and stretch. Now we've already covered
5081
06:29:24,230 --> 06:29:25,230
stretch a little bit in the beginning of this
in which we could set stretch as our default
5082
06:29:25,230 --> 06:29:26,230
value. And all that does is just align it
all the way through from top to bottom. But
5083
06:29:26,230 --> 06:29:27,230
baseline is a little bit different. Now unfortunately,
we can't really see the effect, apparent right
5084
06:29:27,230 --> 06:29:28,230
here. But pretty much what happens is that
all of these items, no matter their size,
5085
06:29:28,230 --> 06:29:29,230
are aligned to a baseline. Now if I actually
go and add some inline styles to override
5086
06:29:29,230 --> 06:29:30,230
some of these, so for example B, I'm going
to let's just say I'm going to make the line
5087
06:29:30,230 --> 06:29:31,230
height, which is a property we haven't actually
learned yet, what we're going to do is just
5088
06:29:31,230 --> 06:29:32,230
set the line height to whoops, real problem
there, I'm going to set this to 100 pixels,
5089
06:29:32,230 --> 06:29:33,230
like that. And now what I'm going to do is
go ahead and refresh the page and see what
5090
06:29:33,230 --> 06:29:34,230
happens, you can see that this is a little
bit higher, but they're all aligned on the
5091
06:29:34,230 --> 06:29:35,230
same line, you can see that the fonts here
have been changed a little bit not really
5092
06:29:35,230 --> 06:29:36,230
not really apparent here. But you can see
the heights are different, but they're still
5093
06:29:36,230 --> 06:29:37,230
all in the same line. So that's what baseline
actually does it just no matter the size,
5094
06:29:37,230 --> 06:29:38,230
or the font text or anything, it's all going
to keep them or it's going to keep them all
5095
06:29:38,230 --> 06:29:39,230
on the same baseline. And that's what it does.
Alright, so I'm going to go ahead and remove
5096
06:29:39,230 --> 06:29:40,230
this inline style, since we don't need it.
And those are pretty much the two main alignment
5097
06:29:40,230 --> 06:29:41,230
properties. Now if you wanted to align something
to the center of a Flexbox, what you would
5098
06:29:41,230 --> 06:29:42,230
do is just set justify content and jaw and
align items, both of them to the center. And
5099
06:29:42,230 --> 06:29:43,230
what that's gonna do is just align everything
to the center of the flex box. So that's what
5100
06:29:43,230 --> 06:29:44,230
I've just done here is I've set both of them
to center so that way on top, it's centered
5101
06:29:44,230 --> 06:29:45,230
between the top and the bottom as well as
the left and the right. Alright, let's move
5102
06:29:45,230 --> 06:29:46,230
on.
5103
06:29:46,230 --> 06:29:47,230
So there we go. Those are some of the little
items or values that you can use under justify
5104
06:29:47,230 --> 06:29:48,230
content property. Now let's move on to align
items. So this is the property that aligns
5105
06:29:48,230 --> 06:29:49,230
it vertically. Now by default, it's set to
stretch, which is what we can see here. So
5106
06:29:49,230 --> 06:29:50,230
it just stretches all the way across down
to the bottom of the container, we can actually
5107
06:29:50,230 --> 06:29:51,230
change this. So let's go ahead and add this
property align items. Now what we're going
5108
06:29:51,230 --> 06:29:52,230
to do is change it to center. So just like
before, we have three main values, flex, start
5109
06:29:52,230 --> 06:29:53,230
flex, and and center, you can see that immediately.
Now all of these items are still spaced in
5110
06:29:53,230 --> 06:29:54,230
between, but they have been moved to the center
here. So you can see here that on the Align
5111
06:29:54,230 --> 06:29:55,230
items, this has been arranged vertically,
it this is the start at the top and the and
5112
06:29:55,230 --> 06:29:56,230
the bottom and the flex end is well at the
bottom of the container, justify content says
5113
06:29:56,230 --> 06:29:57,230
the flex start is on the left side, and the
flex end is on the right. So there we go,
5114
06:29:57,230 --> 06:29:58,230
you can see what this is what this looks like
right here is when we align the items, it
5115
06:29:58,230 --> 06:29:59,230
centers it in between the top and the bottom.
So let's go ahead and just see what the other
5116
06:29:59,230 --> 06:30:00,230
values look like. So for example, flex start.
So for, let's just say you want to keep the
5117
06:30:00,230 --> 06:30:01,230
height of these items the same, you don't
want to stretch them, this is what you would
5118
06:30:01,230 --> 06:30:02,230
do, you could also set it to flex and if you
wanted something to appear at the end of the
5119
06:30:02,230 --> 06:30:03,230
page. And yeah, that's pretty much it for
those three main values. Now let's talk about
5120
06:30:03,230 --> 06:30:04,230
the two special values. So these are a little
bit different because they don't follow some
5121
06:30:04,230 --> 06:30:05,230
general convention. But the two values are
baseline and stretch. Now we've already covered
5122
06:30:05,230 --> 06:30:06,230
stretch a little bit in the beginning of this
in which we could set stretch as our default
5123
06:30:06,230 --> 06:30:07,230
value. And all that does is just align it
all the way through from top to bottom. But
5124
06:30:07,230 --> 06:30:08,230
baseline is a little bit different. Now unfortunately,
we can't really see the effect, apparent right
5125
06:30:08,230 --> 06:30:09,230
here. But pretty much what happens is that
all of these items, no matter their size,
5126
06:30:09,230 --> 06:30:10,230
are aligned to a baseline. Now if I actually
go and add some inline styles to override
5127
06:30:10,230 --> 06:30:11,230
some of these, so for example B, I'm going
to let's just say I'm going to make the line
5128
06:30:11,230 --> 06:30:12,230
height, which is a property we haven't actually
learned yet, what we're going to do is just
5129
06:30:12,230 --> 06:30:13,230
set the line height to whoops, real problem
there, I'm going to set this to 100 pixels,
5130
06:30:13,230 --> 06:30:14,230
like that. And now what I'm going to do is
go ahead and refresh the page and see what
5131
06:30:14,230 --> 06:30:15,230
happens, you can see that this is a little
bit higher, but they're all aligned on the
5132
06:30:15,230 --> 06:30:16,230
same line, you can see that the fonts here
have been changed a little bit not really
5133
06:30:16,230 --> 06:30:17,230
not really apparent here. But you can see
the heights are different, but they're still
5134
06:30:17,230 --> 06:30:18,230
all in the same line. So that's what baseline
actually does it just no matter the size,
5135
06:30:18,230 --> 06:30:19,230
or the font text or anything, it's all going
to keep them or it's going to keep them all
5136
06:30:19,230 --> 06:30:20,230
on the same baseline. And that's what it does.
Alright, so I'm going to go ahead and remove
5137
06:30:20,230 --> 06:30:21,230
this inline style, since we don't need it.
And those are pretty much the two main alignment
5138
06:30:21,230 --> 06:30:22,230
properties. Now if you wanted to align something
to the center of a Flexbox, what you would
5139
06:30:22,230 --> 06:30:23,230
do is just set justify content and jaw and
align items, both of them to the center. And
5140
06:30:23,230 --> 06:30:24,230
what that's gonna do is just align everything
to the center of the flex box. So that's what
5141
06:30:24,230 --> 06:30:25,230
I've just done here is I've set both of them
to center so that way on top, it's centered
5142
06:30:25,230 --> 06:30:26,230
between the top and the bottom as well as
the left and the right. Alright, let's move
5143
06:30:26,230 --> 06:30:27,230
on.
5144
06:30:27,230 --> 06:30:28,230
So for the first part of this section, we've
been talking about a lot of the properties
5145
06:30:28,230 --> 06:30:29,230
that we can use for the actual flex container.
So you can see that we've covered five here,
5146
06:30:29,230 --> 06:30:30,230
the display type, which is to create the container,
the direction wrap, and our content alignment
5147
06:30:30,230 --> 06:30:31,230
properties. But we haven't actually talked
anything about the items themselves, because
5148
06:30:31,230 --> 06:30:32,230
we've just been looking at the container.
So that's what we're going to be doing over
5149
06:30:32,230 --> 06:30:33,230
the next few videos is looking at some of
the properties that we can use on our items
5150
06:30:33,230 --> 06:30:34,230
themselves to change how they look. And that's
when the real power of Flexbox comes in, and
5151
06:30:34,230 --> 06:30:35,230
really shows how it can be used. So the first
item that we're going to be covering or property
5152
06:30:35,230 --> 06:30:36,230
in this case is flex item order. Now, instead
of adding this directly to the container,
5153
06:30:36,230 --> 06:30:37,230
we can actually go through and add this to
the flex items themselves. So I'm going to
5154
06:30:37,230 --> 06:30:38,230
hold Ctrl or Command if you're on Mac, and
go ahead and add our style property to all
5155
06:30:38,230 --> 06:30:39,230
five of these flex items, because what we're
going to actually have to do is add this property
5156
06:30:39,230 --> 06:30:40,230
to all of our items, seems like a new line
was created there. Let's get started. So pretty
5157
06:30:40,230 --> 06:30:41,230
much what we're going to be doing is using
a property to change the positioning or order
5158
06:30:41,230 --> 06:30:42,230
in this case of our flex items. So I'm going
to go ahead and create that multiple cursor
5159
06:30:42,230 --> 06:30:43,230
feature again. And the property we're going
to use is order. Now what we can do is go
5160
06:30:43,230 --> 06:30:44,230
ahead and start specifying our order. So pretty
much what we're going to do is go through
5161
06:30:44,230 --> 06:30:45,230
and change what this looks like and how this
looks like in our place here. So what we're
5162
06:30:45,230 --> 06:30:46,230
going to do is go and specify our values.
And then we're instead of having it from A
5163
06:30:46,230 --> 06:30:47,230
to E, we're actually going to go through and
add something to make these properties look
5164
06:30:47,230 --> 06:30:48,230
in a different way instead of having to actually
move all of these around. So instead of moving
5165
06:30:48,230 --> 06:30:49,230
the divs around, and you know changing all
of them, we're actually going to go through
5166
06:30:49,230 --> 06:30:50,230
and specify some numbers. So let's get started.
So what we're going to use for this is numbers.
5167
06:30:50,230 --> 06:30:51,230
Now, this ranges from one all the way up to
as many numbers or as many items as you have,
5168
06:30:51,230 --> 06:30:52,230
and the default value is zero. And this is
just going to keep it in its position. But
5169
06:30:52,230 --> 06:30:53,230
we can actually specify the number to see
where it lands. So let's just say that I want
5170
06:30:53,230 --> 06:30:54,230
D first, what I'm going to do is go ahead
and under my order property, add a one, just
5171
06:30:54,230 --> 06:30:55,230
like that. Now I'm going to go ahead and add
E, so I'm going to set my order to two. Now
5172
06:30:55,230 --> 06:30:56,230
if you've worked with computers before, you
might think that it starts with zero, but
5173
06:30:56,230 --> 06:30:57,230
in this case, zero is our default value. So
we're not actually going to be using that.
5174
06:30:57,230 --> 06:30:58,230
So I have D then E. Now let's say I would
be next. So I'm going to put it under the
5175
06:30:58,230 --> 06:30:59,230
third position. Now for C or actually a, I'm
going to put as the fourth position, and C
5176
06:30:59,230 --> 06:31:00,230
is the last. So let's see if this holds up
here, we refresh the page d V AC. So you can
5177
06:31:00,230 --> 06:31:01,230
see that we can actually change the order
of these flex items directly from our CSS
5178
06:31:01,230 --> 06:31:02,230
instead of having to go through and move them
around. Now you might know you might be wondering
5179
06:31:02,230 --> 06:31:03,230
why this could be useful at all. Now, although
might not be apparent here because we haven't
5180
06:31:03,230 --> 06:31:04,230
actually gotten, we're using the JavaScript.
Once you start making your website interactive,
5181
06:31:04,230 --> 06:31:05,230
this becomes a very useful features. Because
you can't just go through and program something
5182
06:31:05,230 --> 06:31:06,230
to move the divs around in your HTML document
without using some sort of file reading. Instead,
5183
06:31:06,230 --> 06:31:07,230
it's much easier to just add a style to it,
where you can change the order, maybe even
5184
06:31:07,230 --> 06:31:08,230
randomly. So you can see how this would work.
And although like I said, although it's may
5185
06:31:08,230 --> 06:31:09,230
not be useful in this case, it will definitely
be useful once you start learning about JavaScript
5186
06:31:09,230 --> 06:31:10,230
and start making your websites interactive.
So that's a little bit about flex order. Now
5187
06:31:10,230 --> 06:31:11,230
just one thing, you don't actually have to
use it with an inline style tag. But it would
5188
06:31:11,230 --> 06:31:12,230
be much easier considering that if without
it, you'd have to go and add an individual
5189
06:31:12,230 --> 06:31:13,230
class to every single item. Now, of course,
it's much easier to just go ahead and add
5190
06:31:13,230 --> 06:31:14,230
a style tag to each of these. But if you want
to use it with a class method, maybe you already
5191
06:31:14,230 --> 06:31:15,230
have an existing class, you can go ahead and
do that. There's nothing wrong with that.
5192
06:31:15,230 --> 06:31:16,230
I'm just using this because it's a lot more
convenient and easy to use. Alright, so that's
5193
06:31:16,230 --> 06:31:17,230
pretty much it about flex order. It's quite
easy to learn once you know how to find the
5194
06:31:17,230 --> 06:31:18,230
positions of items and how you know how to
order them in the right way. As long as you
5195
06:31:18,230 --> 06:31:19,230
know the number of items you have, it's very
easy to position them just the way you like
5196
06:31:19,230 --> 06:31:20,230
it. Alright, let's move on.
5197
06:31:20,230 --> 06:31:21,230
So for the first part of this section, we've
been talking about a lot of the properties
5198
06:31:21,230 --> 06:31:22,230
that we can use for the actual flex container.
So you can see that we've covered five here,
5199
06:31:22,230 --> 06:31:23,230
the display type, which is to create the container,
the direction wrap, and our content alignment
5200
06:31:23,230 --> 06:31:24,230
properties. But we haven't actually talked
anything about the items themselves, because
5201
06:31:24,230 --> 06:31:25,230
we've just been looking at the container.
So that's what we're going to be doing over
5202
06:31:25,230 --> 06:31:26,230
the next few videos is looking at some of
the properties that we can use on our items
5203
06:31:26,230 --> 06:31:27,230
themselves to change how they look. And that's
when the real power of Flexbox comes in, and
5204
06:31:27,230 --> 06:31:28,230
really shows how it can be used. So the first
item that we're going to be covering or property
5205
06:31:28,230 --> 06:31:29,230
in this case is flex item order. Now, instead
of adding this directly to the container,
5206
06:31:29,230 --> 06:31:30,230
we can actually go through and add this to
the flex items themselves. So I'm going to
5207
06:31:30,230 --> 06:31:31,230
hold Ctrl or Command if you're on Mac, and
go ahead and add our style property to all
5208
06:31:31,230 --> 06:31:32,230
five of these flex items, because what we're
going to actually have to do is add this property
5209
06:31:32,230 --> 06:31:33,230
to all of our items, seems like a new line
was created there. Let's get started. So pretty
5210
06:31:33,230 --> 06:31:34,230
much what we're going to be doing is using
a property to change the positioning or order
5211
06:31:34,230 --> 06:31:35,230
in this case of our flex items. So I'm going
to go ahead and create that multiple cursor
5212
06:31:35,230 --> 06:31:36,230
feature again. And the property we're going
to use is order. Now what we can do is go
5213
06:31:36,230 --> 06:31:37,230
ahead and start specifying our order. So pretty
much what we're going to do is go through
5214
06:31:37,230 --> 06:31:38,230
and change what this looks like and how this
looks like in our place here. So what we're
5215
06:31:38,230 --> 06:31:39,230
going to do is go and specify our values.
And then we're instead of having it from A
5216
06:31:39,230 --> 06:31:40,230
to E, we're actually going to go through and
add something to make these properties look
5217
06:31:40,230 --> 06:31:41,230
in a different way instead of having to actually
move all of these around. So instead of moving
5218
06:31:41,230 --> 06:31:42,230
the divs around, and you know changing all
of them, we're actually going to go through
5219
06:31:42,230 --> 06:31:43,230
and specify some numbers. So let's get started.
So what we're going to use for this is numbers.
5220
06:31:43,230 --> 06:31:44,230
Now, this ranges from one all the way up to
as many numbers or as many items as you have,
5221
06:31:44,230 --> 06:31:45,230
and the default value is zero. And this is
just going to keep it in its position. But
5222
06:31:45,230 --> 06:31:46,230
we can actually specify the number to see
where it lands. So let's just say that I want
5223
06:31:46,230 --> 06:31:47,230
D first, what I'm going to do is go ahead
and under my order property, add a one, just
5224
06:31:47,230 --> 06:31:48,230
like that. Now I'm going to go ahead and add
E, so I'm going to set my order to two. Now
5225
06:31:48,230 --> 06:31:49,230
if you've worked with computers before, you
might think that it starts with zero, but
5226
06:31:49,230 --> 06:31:50,230
in this case, zero is our default value. So
we're not actually going to be using that.
5227
06:31:50,230 --> 06:31:51,230
So I have D then E. Now let's say I would
be next. So I'm going to put it under the
5228
06:31:51,230 --> 06:31:52,230
third position. Now for C or actually a, I'm
going to put as the fourth position, and C
5229
06:31:52,230 --> 06:31:53,230
is the last. So let's see if this holds up
here, we refresh the page d V AC. So you can
5230
06:31:53,230 --> 06:31:54,230
see that we can actually change the order
of these flex items directly from our CSS
5231
06:31:54,230 --> 06:31:55,230
instead of having to go through and move them
around. Now you might know you might be wondering
5232
06:31:55,230 --> 06:31:56,230
why this could be useful at all. Now, although
might not be apparent here because we haven't
5233
06:31:56,230 --> 06:31:57,230
actually gotten, we're using the JavaScript.
Once you start making your website interactive,
5234
06:31:57,230 --> 06:31:58,230
this becomes a very useful features. Because
you can't just go through and program something
5235
06:31:58,230 --> 06:31:59,230
to move the divs around in your HTML document
without using some sort of file reading. Instead,
5236
06:31:59,230 --> 06:32:00,230
it's much easier to just add a style to it,
where you can change the order, maybe even
5237
06:32:00,230 --> 06:32:01,230
randomly. So you can see how this would work.
And although like I said, although it's may
5238
06:32:01,230 --> 06:32:02,230
not be useful in this case, it will definitely
be useful once you start learning about JavaScript
5239
06:32:02,230 --> 06:32:03,230
and start making your websites interactive.
So that's a little bit about flex order. Now
5240
06:32:03,230 --> 06:32:04,230
just one thing, you don't actually have to
use it with an inline style tag. But it would
5241
06:32:04,230 --> 06:32:05,230
be much easier considering that if without
it, you'd have to go and add an individual
5242
06:32:05,230 --> 06:32:06,230
class to every single item. Now, of course,
it's much easier to just go ahead and add
5243
06:32:06,230 --> 06:32:07,230
a style tag to each of these. But if you want
to use it with a class method, maybe you already
5244
06:32:07,230 --> 06:32:08,230
have an existing class, you can go ahead and
do that. There's nothing wrong with that.
5245
06:32:08,230 --> 06:32:09,230
I'm just using this because it's a lot more
convenient and easy to use. Alright, so that's
5246
06:32:09,230 --> 06:32:10,230
pretty much it about flex order. It's quite
easy to learn once you know how to find the
5247
06:32:10,230 --> 06:32:11,230
positions of items and how you know how to
order them in the right way. As long as you
5248
06:32:11,230 --> 06:32:12,230
know the number of items you have, it's very
easy to position them just the way you like
5249
06:32:12,230 --> 06:32:13,230
it. Alright, let's move on.
5250
06:32:13,230 --> 06:32:14,230
So in this video, we're going to be talking
about three very important properties that
5251
06:32:14,230 --> 06:32:15,230
come with Flexbox which are flex grow, flex,
shrink and flex basis. Now, although it might
5252
06:32:15,230 --> 06:32:16,230
not seem like it, these actually are completely
responsible for the responsive power of Flexbox.
5253
06:32:16,230 --> 06:32:17,230
And it's what really makes it what it is today
and why it's used so commonly over things
5254
06:32:17,230 --> 06:32:18,230
like floats and display types. So first of
all, if we look at it, now, it might seem
5255
06:32:18,230 --> 06:32:19,230
that flex grow and shrink, just specify the
width and height. And although they sort of
5256
06:32:19,230 --> 06:32:20,230
do, they are very different when it comes
to the core concept and how it's decided.
5257
06:32:20,230 --> 06:32:21,230
So the first thing we need to do is talk about
the flex basis property, because from there,
5258
06:32:21,230 --> 06:32:22,230
we're going to define everything else. Now,
we all know that we have five items here,
5259
06:32:22,230 --> 06:32:23,230
and they take up a certain amount of space
each. But you can see that there's all of
5260
06:32:23,230 --> 06:32:24,230
this extra room here on the side. So what
actually happens is these properties work
5261
06:32:24,230 --> 06:32:25,230
to define how the extra space or this remaining
excess space is divided up between them. And
5262
06:32:25,230 --> 06:32:26,230
from there, we can actually specify the width
based on the you know, browser width, and
5263
06:32:26,230 --> 06:32:27,230
it's all responsive. So it's all decided completely
based on the browser and on the properties
5264
06:32:27,230 --> 06:32:28,230
that you define. So the first thing I'm going
to do is go ahead and actually add this property
5265
06:32:28,230 --> 06:32:29,230
to all of them. And I'm gonna explain why
in just a second. And why we need to do that.
5266
06:32:29,230 --> 06:32:30,230
So what I'm going to do is first download,
I'm going to go ahead and add the flex grow
5267
06:32:30,230 --> 06:32:31,230
property, and the flex shrink property. Now
we're not going to use all these in one go,
5268
06:32:31,230 --> 06:32:32,230
we're just going to do this gradually, and
then our flex basis. Okay, so let's talk about
5269
06:32:32,230 --> 06:32:33,230
flex basis. First, what this does is it pretty
much defines the minimum width of an item
5270
06:32:33,230 --> 06:32:34,230
or a flex item. So this can be any value doesn't
just have to it doesn't have to be a specific
5271
06:32:34,230 --> 06:32:35,230
number or unit. So for example, I'm going
to go ahead and set this as maybe 100 pixels
5272
06:32:35,230 --> 06:32:36,230
for each one as its minimum width, we go ahead
and refresh the page. And now you can see
5273
06:32:36,230 --> 06:32:37,230
it's a lot wider. But you can see that there's
still this extra space. So this is where our
5274
06:32:37,230 --> 06:32:38,230
flex grow property comes in. Now what happens
is, if I actually go ahead and go to all of
5275
06:32:38,230 --> 06:32:39,230
them, and set them all as one, what this is
pretty much going to say is every flex item
5276
06:32:39,230 --> 06:32:40,230
is going to get the same amount of extra space.
So you can see that this gets if all of them
5277
06:32:40,230 --> 06:32:41,230
are one, they all get the same amount. Let's
go ahead and see that when we refresh the
5278
06:32:41,230 --> 06:32:42,230
page, you can see now there's only a little
bit of margin, which is normal. But all of
5279
06:32:42,230 --> 06:32:43,230
them are divided up equally. Now that we've
set them as one. But what happens if we go
5280
06:32:43,230 --> 06:32:44,230
ahead and actually change this value? Let's
go ahead and for example, set our fifth item
5281
06:32:44,230 --> 06:32:45,230
as to maybe. So now you can see that, although
it's not much bigger, it is a little bit bigger.
5282
06:32:45,230 --> 06:32:46,230
So what this is pretty, I'm gonna go ahead
and set it to actually something a little
5283
06:32:46,230 --> 06:32:47,230
bit bigger, so it's more obvious. So you can
see now this is a lot bigger than the other
5284
06:32:47,230 --> 06:32:48,230
items. So pretty much what this is saying
is our fifth item, this container item is
5285
06:32:48,230 --> 06:32:49,230
going to get five times as much excess space
as the rest of the items here. So one thing
5286
06:32:49,230 --> 06:32:50,230
you need to know about flex grow is that you
need to add this property to every single
5287
06:32:50,230 --> 06:32:51,230
one of them and make sure that they have a
defined value. If they don't, if you want
5288
06:32:51,230 --> 06:32:52,230
them just to give them a default space, give
them a value of one. And this is because what
5289
06:32:52,230 --> 06:32:53,230
happens is when you don't give them any value.
If you give this flex grow property to anything,
5290
06:32:53,230 --> 06:32:54,230
it's going to eat up all that extra space.
Let's go ahead and demonstrate this. Now,
5291
06:32:54,230 --> 06:32:55,230
I'm going to go ahead and erase all of this,
all of these flex grow properties just temporarily.
5292
06:32:55,230 --> 06:32:56,230
And then I'm going to leave it on this one.
Now I'm going to set it to one. Now you might
5293
06:32:56,230 --> 06:32:57,230
expect this is to be just a little bit bigger.
But let's see what actually happens. If we
5294
06:32:57,230 --> 06:32:58,230
go ahead and refresh the page, you can see
that this is actually bigger than when we
5295
06:32:58,230 --> 06:32:59,230
set this to flex this flex grow property to
five. So what's going on here, pretty much
5296
06:32:59,230 --> 06:33:00,230
what's happening is the default value for
our flex grow property is actually zero, which
5297
06:33:00,230 --> 06:33:01,230
means it's going to remain the same width,
and it's not going to take up any excess space.
5298
06:33:01,230 --> 06:33:02,230
So pretty much what's happening is when we
set this to one, everything else is not taking
5299
06:33:02,230 --> 06:33:03,230
any excess space, leaving it all to that one
value. So all of that extra space is taken
5300
06:33:03,230 --> 06:33:04,230
up by this block here. And you can see that
and it's proved proven because there is still
5301
06:33:04,230 --> 06:33:05,230
no excess space here, since it's all taken
up out by this property. So what I would recommend
5302
06:33:05,230 --> 06:33:06,230
is before we learn the flex
5303
06:33:06,230 --> 06:33:07,230
So in this video, we're going to be talking
about three very important properties that
5304
06:33:07,230 --> 06:33:08,230
come with Flexbox which are flex grow, flex,
shrink and flex basis. Now, although it might
5305
06:33:08,230 --> 06:33:09,230
not seem like it, these actually are completely
responsible for the responsive power of Flexbox.
5306
06:33:09,230 --> 06:33:10,230
And it's what really makes it what it is today
and why it's used so commonly over things
5307
06:33:10,230 --> 06:33:11,230
like floats and display types. So first of
all, if we look at it, now, it might seem
5308
06:33:11,230 --> 06:33:12,230
that flex grow and shrink, just specify the
width and height. And although they sort of
5309
06:33:12,230 --> 06:33:13,230
do, they are very different when it comes
to the core concept and how it's decided.
5310
06:33:13,230 --> 06:33:14,230
So the first thing we need to do is talk about
the flex basis property, because from there,
5311
06:33:14,230 --> 06:33:15,230
we're going to define everything else. Now,
we all know that we have five items here,
5312
06:33:15,230 --> 06:33:16,230
and they take up a certain amount of space
each. But you can see that there's all of
5313
06:33:16,230 --> 06:33:17,230
this extra room here on the side. So what
actually happens is these properties work
5314
06:33:17,230 --> 06:33:18,230
to define how the extra space or this remaining
excess space is divided up between them. And
5315
06:33:18,230 --> 06:33:19,230
from there, we can actually specify the width
based on the you know, browser width, and
5316
06:33:19,230 --> 06:33:20,230
it's all responsive. So it's all decided completely
based on the browser and on the properties
5317
06:33:20,230 --> 06:33:21,230
that you define. So the first thing I'm going
to do is go ahead and actually add this property
5318
06:33:21,230 --> 06:33:22,230
to all of them. And I'm gonna explain why
in just a second. And why we need to do that.
5319
06:33:22,230 --> 06:33:23,230
So what I'm going to do is first download,
I'm going to go ahead and add the flex grow
5320
06:33:23,230 --> 06:33:24,230
property, and the flex shrink property. Now
we're not going to use all these in one go,
5321
06:33:24,230 --> 06:33:25,230
we're just going to do this gradually, and
then our flex basis. Okay, so let's talk about
5322
06:33:25,230 --> 06:33:26,230
flex basis. First, what this does is it pretty
much defines the minimum width of an item
5323
06:33:26,230 --> 06:33:27,230
or a flex item. So this can be any value doesn't
just have to it doesn't have to be a specific
5324
06:33:27,230 --> 06:33:28,230
number or unit. So for example, I'm going
to go ahead and set this as maybe 100 pixels
5325
06:33:28,230 --> 06:33:29,230
for each one as its minimum width, we go ahead
and refresh the page. And now you can see
5326
06:33:29,230 --> 06:33:30,230
it's a lot wider. But you can see that there's
still this extra space. So this is where our
5327
06:33:30,230 --> 06:33:31,230
flex grow property comes in. Now what happens
is, if I actually go ahead and go to all of
5328
06:33:31,230 --> 06:33:32,230
them, and set them all as one, what this is
pretty much going to say is every flex item
5329
06:33:32,230 --> 06:33:33,230
is going to get the same amount of extra space.
So you can see that this gets if all of them
5330
06:33:33,230 --> 06:33:34,230
are one, they all get the same amount. Let's
go ahead and see that when we refresh the
5331
06:33:34,230 --> 06:33:35,230
page, you can see now there's only a little
bit of margin, which is normal. But all of
5332
06:33:35,230 --> 06:33:36,230
them are divided up equally. Now that we've
set them as one. But what happens if we go
5333
06:33:36,230 --> 06:33:37,230
ahead and actually change this value? Let's
go ahead and for example, set our fifth item
5334
06:33:37,230 --> 06:33:38,230
as to maybe. So now you can see that, although
it's not much bigger, it is a little bit bigger.
5335
06:33:38,230 --> 06:33:39,230
So what this is pretty, I'm gonna go ahead
and set it to actually something a little
5336
06:33:39,230 --> 06:33:40,230
bit bigger, so it's more obvious. So you can
see now this is a lot bigger than the other
5337
06:33:40,230 --> 06:33:41,230
items. So pretty much what this is saying
is our fifth item, this container item is
5338
06:33:41,230 --> 06:33:42,230
going to get five times as much excess space
as the rest of the items here. So one thing
5339
06:33:42,230 --> 06:33:43,230
you need to know about flex grow is that you
need to add this property to every single
5340
06:33:43,230 --> 06:33:44,230
one of them and make sure that they have a
defined value. If they don't, if you want
5341
06:33:44,230 --> 06:33:45,230
them just to give them a default space, give
them a value of one. And this is because what
5342
06:33:45,230 --> 06:33:46,230
happens is when you don't give them any value.
If you give this flex grow property to anything,
5343
06:33:46,230 --> 06:33:47,230
it's going to eat up all that extra space.
Let's go ahead and demonstrate this. Now,
5344
06:33:47,230 --> 06:33:48,230
I'm going to go ahead and erase all of this,
all of these flex grow properties just temporarily.
5345
06:33:48,230 --> 06:33:49,230
And then I'm going to leave it on this one.
Now I'm going to set it to one. Now you might
5346
06:33:49,230 --> 06:33:50,230
expect this is to be just a little bit bigger.
But let's see what actually happens. If we
5347
06:33:50,230 --> 06:33:51,230
go ahead and refresh the page, you can see
that this is actually bigger than when we
5348
06:33:51,230 --> 06:33:52,230
set this to flex this flex grow property to
five. So what's going on here, pretty much
5349
06:33:52,230 --> 06:33:53,230
what's happening is the default value for
our flex grow property is actually zero, which
5350
06:33:53,230 --> 06:33:54,230
means it's going to remain the same width,
and it's not going to take up any excess space.
5351
06:33:54,230 --> 06:33:55,230
So pretty much what's happening is when we
set this to one, everything else is not taking
5352
06:33:55,230 --> 06:33:56,230
any excess space, leaving it all to that one
value. So all of that extra space is taken
5353
06:33:56,230 --> 06:33:57,230
up by this block here. And you can see that
and it's proved proven because there is still
5354
06:33:57,230 --> 06:33:58,230
no excess space here, since it's all taken
up out by this property. So what I would recommend
5355
06:33:58,230 --> 06:33:59,230
is before we learn the flex
5356
06:33:59,230 --> 06:34:00,230
property in the next video, just go ahead
and add this flex grow property to every single
5357
06:34:00,230 --> 06:34:01,230
item or container if you plan to use it. So
now if we go ahead and refresh the page, you
5358
06:34:01,230 --> 06:34:02,230
can see that that's working great now what's
the advantage of
5359
06:34:02,230 --> 06:34:03,230
property in the next video, just go ahead
and add this flex grow property to every single
5360
06:34:03,230 --> 06:34:04,230
item or container if you plan to use it. So
now if we go ahead and refresh the page, you
5361
06:34:04,230 --> 06:34:05,230
can see that that's working great now what's
the advantage of
5362
06:34:05,230 --> 06:34:06,230
Using this, before we move on to our next
property, if I actually resize this window,
5363
06:34:06,230 --> 06:34:07,230
right here, I'm just gonna resize it, you
can see that when it grows, it still takes
5364
06:34:07,230 --> 06:34:08,230
up the same proportions of excess space. Now
we'll talk about getting smaller in just a
5365
06:34:08,230 --> 06:34:09,230
little bit. But you can see here that it does
actually take up the same proportion. And
5366
06:34:09,230 --> 06:34:10,230
that's where the really responsive power of
Flexbox comes in, is when you're resizing
5367
06:34:10,230 --> 06:34:11,230
your windows and browsers and there's all
of the different devices, this actually stays
5368
06:34:11,230 --> 06:34:12,230
the same. So let's move on to our next property.
Now flex shrink. So we know that the basis
5369
06:34:12,230 --> 06:34:13,230
for the minimum width is 100 pixels, that's
the minimum it can go. But when we actually
5370
06:34:13,230 --> 06:34:14,230
shrink this down, and all of these get smaller,
I'm actually going to go ahead and move the
5371
06:34:14,230 --> 06:34:15,230
flex wrap property from here because it's,
it's some little intrusive here. And although
5372
06:34:15,230 --> 06:34:16,230
it's not good for this, it's not good for
this example, we'll go ahead and use it later.
5373
06:34:16,230 --> 06:34:17,230
So when we go ahead and actually shrink this
window, you can see that that proportion is
5374
06:34:17,230 --> 06:34:18,230
actually lost. So what's going on here, pretty
much when you go below the minimum width,
5375
06:34:18,230 --> 06:34:19,230
whether it's defined on our flex basis, or
the minimum width of the of the, of the container
5376
06:34:19,230 --> 06:34:20,230
item itself, what's happening is that proportion
is completely removed, and you go to the default
5377
06:34:20,230 --> 06:34:21,230
value of flex shrink. So flex shrink is similar
to flex grow, except what happens is it defines
5378
06:34:21,230 --> 06:34:22,230
the rate of shrinkage of each container item
again, relative to the rest of the items.
5379
06:34:22,230 --> 06:34:23,230
So in this case, what we have to do is go
ahead and look at how this trig property works.
5380
06:34:23,230 --> 06:34:24,230
The default value for this, unlike flex grow
is one, not zero. So what this is saying is
5381
06:34:24,230 --> 06:34:25,230
shrink each item at the same rate as all the
other items. And that's why we can see that
5382
06:34:25,230 --> 06:34:26,230
once we go under the minimum height, or sorry,
minimum width, you can see that all of those
5383
06:34:26,230 --> 06:34:27,230
items begin to look the
5384
06:34:27,230 --> 06:34:28,230
same.
5385
06:34:28,230 --> 06:34:29,230
So what I'm going to do here is actually go
ahead and show you how to manipulate this.
5386
06:34:29,230 --> 06:34:30,230
And this is where the real responsive power
comes in. And where you can really change
5387
06:34:30,230 --> 06:34:31,230
how everything looks on different devices,
all we have to do is go ahead and specify
5388
06:34:31,230 --> 06:34:32,230
the value that we want here. And one thing
to note is that if you don't want something
5389
06:34:32,230 --> 06:34:33,230
to shrink, you can just set the value to zero.
So for example, if I wanted to remove the
5390
06:34:33,230 --> 06:34:34,230
shrinkage of our fourth item here, well let
me go with our first item. Right here, all
5391
06:34:34,230 --> 06:34:35,230
I have to do is go ahead and shet set, sorry,
our shrink value to zero. And what this is
5392
06:34:35,230 --> 06:34:36,230
going to say is don't shrink the item, even
if it goes below, do not shrink the item at
5393
06:34:36,230 --> 06:34:37,230
all, let everything else shrink. Let's go
ahead and see how this looks on our site.
5394
06:34:37,230 --> 06:34:38,230
So we're going ahead, we're removing that
space. But you can see that our first value
5395
06:34:38,230 --> 06:34:39,230
does not shrink at all. So there we go. Now
let's go ahead and start adding our shrinkage
5396
06:34:39,230 --> 06:34:40,230
values to the rest of our items here. So what
I'm going to do is first add a value of one
5397
06:34:40,230 --> 06:34:41,230
to all of them, just like this, just to keep
everything the same. And now what we're going
5398
06:34:41,230 --> 06:34:42,230
to do is go ahead and start manipulating them.
So first of all, let's go ahead and say that
5399
06:34:42,230 --> 06:34:43,230
we want our middle value to shrink three times
as fast. So we're gonna go over to our middle
5400
06:34:43,230 --> 06:34:44,230
value and change the flex shrink to three
times. So now we go ahead and refresh the
5401
06:34:44,230 --> 06:34:45,230
page. And when we shrink it, you can see that
that value shrinks three times as fast as
5402
06:34:45,230 --> 06:34:46,230
everything else. So you can see that and it's
pretty apparent there. So there we go. That's
5403
06:34:46,230 --> 06:34:47,230
pretty much it for our three values. Now one
thing I forgot to mention is if your flex
5404
06:34:47,230 --> 06:34:48,230
shrink is one and it's not there on purpose,
you can actually go ahead and remove it since
5405
06:34:48,230 --> 06:34:49,230
the default value is one forgot to mention
that in the when I started changing them.
5406
06:34:49,230 --> 06:34:50,230
But there we go. Now what I'm going to say
is, why would you use something like this
5407
06:34:50,230 --> 06:34:51,230
flex grow and flex shrink, when you're laying
out entire pages based on Flexbox, you want
5408
06:34:51,230 --> 06:34:52,230
to make it as responsive as possible, you
don't want to go and you know, have it looked
5409
06:34:52,230 --> 06:34:53,230
completely different on one device to the
other. What you can actually do is use this
5410
06:34:53,230 --> 06:34:54,230
to change the look of a website, depending
on what device you're on. So for example,
5411
06:34:54,230 --> 06:34:55,230
you can use this property to change the look
of a website on a mobile phone versus on a
5412
06:34:55,230 --> 06:34:56,230
widescreen TV, it's going to be completely
different. And you can do this using only
5413
06:34:56,230 --> 06:34:57,230
a few properties instead of having to go and
define entire styles for separate devices.
5414
06:34:57,230 --> 06:34:58,230
So from here, we can actually really see the
true cloud power of Flexbox. From here, we
5415
06:34:58,230 --> 06:34:59,230
can go ahead and actually model our website
with just a few styles that are very streamlined
5416
06:34:59,230 --> 06:35:00,230
and efficient to change the look of a website
completely on different devices. So I hope
5417
06:35:00,230 --> 06:35:01,230
that was a little bit easy. To understand
now, I know it's quite hard to wrap your head
5418
06:35:01,230 --> 06:35:02,230
around. But this is the core concept of Flexbox.
And it's what really makes Flexbox what it
5419
06:35:02,230 --> 06:35:03,230
is. So if you understand this, the rest of
Flexbox, and using it is going to be a breeze.
5420
06:35:03,230 --> 06:35:04,230
Alright, let's move on. So in this video,
we're going to be moving on from flex grocery
5421
06:35:04,230 --> 06:35:05,230
in basis and actually talking about a really
useful shorthand property that can summarize
5422
06:35:05,230 --> 06:35:06,230
all three of these into an even more streamline
method. So in the past video, I talked just
5423
06:35:06,230 --> 06:35:07,230
briefly about the flex property. And pretty
much what it is, is a shorthand to use the
5424
06:35:07,230 --> 06:35:08,230
flex grow shrink and basis property in one
go. So we can use this to our great advantage,
5425
06:35:08,230 --> 06:35:09,230
because instead of adding all of these properties
to every single one of these items, we can
5426
06:35:09,230 --> 06:35:10,230
actually just summarize it down into one simple
property. So let's go ahead and talk about
5427
06:35:10,230 --> 06:35:11,230
it. Pretty much the flex property, which is
the property that we're going to be using
5428
06:35:11,230 --> 06:35:12,230
follows or takes in three values, the grow
the shrink, and the basis. So what we're going
5429
06:35:12,230 --> 06:35:13,230
to do is first add our growth. In this case,
it's one, and then we're going to add our
5430
06:35:13,230 --> 06:35:14,230
shrink, which is the default value of
5431
06:35:14,230 --> 06:35:15,230
one.
5432
06:35:15,230 --> 06:35:16,230
And that's just a little tip, if you don't
actually have that defined, just go ahead
5433
06:35:16,230 --> 06:35:17,230
and set it as the default value. So just a
quick summary grow the default is zero, which
5434
06:35:17,230 --> 06:35:18,230
means it's not growable. The default string
value is one, which means shrink it at the
5435
06:35:18,230 --> 06:35:19,230
rate of everyone else. And then the there
is no default for the basis property, unless
5436
06:35:19,230 --> 06:35:20,230
you use something like auto. So what you can
do is go ahead and define that as 100 pixels.
5437
06:35:20,230 --> 06:35:21,230
Now, what we're going to do is go ahead and
do it for the rest of these items, flex, flex
5438
06:35:21,230 --> 06:35:22,230
just the property. Here, we're going to go
one, which is the grow three, which is the
5439
06:35:22,230 --> 06:35:23,230
shrink, and again, 100 pixels for the basis.
And you can start to see kind of the rhythm
5440
06:35:23,230 --> 06:35:24,230
that I'm getting into here, five for the grow
one for the shrink, which is the default,
5441
06:35:24,230 --> 06:35:25,230
and 100 pixels for our basis.
5442
06:35:25,230 --> 06:35:26,230
Let's go ahead and do it for this one.
5443
06:35:26,230 --> 06:35:27,230
And like I said, you can see the rhythm here,
and you can just go ahead and do this very
5444
06:35:27,230 --> 06:35:28,230
quickly, without having to manually go through
and add all three of these properties. One,
5445
06:35:28,230 --> 06:35:29,230
one, and 100 fixes.
5446
06:35:29,230 --> 06:35:30,230
All right, now let's go ahead and erase all
of these other unnecessary properties. Now
5447
06:35:30,230 --> 06:35:31,230
that we have our flex property and restart.
So if we did this, right, pretty much what's
5448
06:35:31,230 --> 06:35:32,230
going to happen is everything is going to
look the same, since all of our values are
5449
06:35:32,230 --> 06:35:33,230
still working, we just threw them into a shorthand.
Let's go ahead and first before we refresh,
5450
06:35:33,230 --> 06:35:34,230
check out the behavior. Whoops, something's
going wrong there. Yeah, there we go. So let's
5451
06:35:34,230 --> 06:35:35,230
just check out the behavior, we shrink B get
smaller D doesn't shrink at all. And we when
5452
06:35:35,230 --> 06:35:36,230
we size up, our last value gets bigger. Let's
go ahead and refresh the page and see if this
5453
06:35:36,230 --> 06:35:37,230
worked. So when we shrink, D is supposed to
stay the same, and B gets smaller. There we
5454
06:35:37,230 --> 06:35:38,230
go. So D stays the same, and B gets smaller.
And if we enlarge it, you can see that C gets
5455
06:35:38,230 --> 06:35:39,230
larger. So there we go, you can see how all
of this works. Instead of adding three properties,
5456
06:35:39,230 --> 06:35:40,230
we can actually just go ahead and do this
in one straight swoop, just go through and
5457
06:35:40,230 --> 06:35:41,230
add all of all three values using one property,
the flex property. Alright, let's move on.
5458
06:35:41,230 --> 06:35:42,230
So this is going to be the last video on Flexbox.
And I'm sure that we've summarized all of
5459
06:35:42,230 --> 06:35:43,230
the different things that you can do with
Flexbox in this section, and then you can
5460
06:35:43,230 --> 06:35:44,230
go off and start using it and creating all
sorts of really cool responsive websites and
5461
06:35:44,230 --> 06:35:45,230
layouts with it. But for now, what we're going
to be doing is going through and learning
5462
06:35:45,230 --> 06:35:46,230
the final property. Now we've learned how
to align all of the elements at the same time
5463
06:35:46,230 --> 06:35:47,230
in our flex container, we learned how to align
it both vertically and horizontally, but we're
5464
06:35:47,230 --> 06:35:48,230
actually going to be doing is learning how
to align each item. And remember, because
5465
06:35:48,230 --> 06:35:49,230
each item is laid out with width wise in a
certain way, we can only align it vertically.
5466
06:35:49,230 --> 06:35:50,230
So just keep that in mind for now. So let's
get started. Now in order to align it vertically,
5467
06:35:50,230 --> 06:35:51,230
we use the Align items property to work with
and align all of these. So in this case, what
5468
06:35:51,230 --> 06:35:52,230
we did with our container is aligned all of
them to center. But what we're going to be
5469
06:35:52,230 --> 06:35:53,230
doing now is going through and aligning each
individual item using a special property called
5470
06:35:53,230 --> 06:35:54,230
align itself. Now one thing to note is that
this property will override the Align items
5471
06:35:54,230 --> 06:35:55,230
property if you have it enabled. So for example,
if I wanted to align this to the top, it would
5472
06:35:55,230 --> 06:35:56,230
override our center and what The line this
only only and only this item to the top. So
5473
06:35:56,230 --> 06:35:57,230
let's get started. First thing I want to do
is go ahead and add the property. And remember,
5474
06:35:57,230 --> 06:35:58,230
we have to go and add it just like everything
else. So I'm going to go through and add it
5475
06:35:58,230 --> 06:35:59,230
now. So first thing I'm going to do is go
and let's just take our first item, for example.
5476
06:35:59,230 --> 06:36:00,230
Where is it? There we go. So now I'm going
to go ahead and add a line self. And now we
5477
06:36:00,230 --> 06:36:01,230
can go ahead and add our different values.
So let's go ahead and get started, I'm going
5478
06:36:01,230 --> 06:36:02,230
to go ahead and try something just like with
the normal values, let's go ahead and save
5479
06:36:02,230 --> 06:36:03,230
flex start. So just like our other values
with our default container, what we can actually
5480
06:36:03,230 --> 06:36:04,230
do is align them with the same values. So
center flex start and flex end. So let's go
5481
06:36:04,230 --> 06:36:05,230
ahead and refresh the page. And you can see
now that that specific item, which is D, or
5482
06:36:05,230 --> 06:36:06,230
the first item is aligned to the start of
the flex container, whereas the rest of the
5483
06:36:06,230 --> 06:36:07,230
items are aligned to the middle, which is
based on the Align items property that we
5484
06:36:07,230 --> 06:36:08,230
had on our container. So now let's go ahead
and create a sort of V shape out of all of
5485
06:36:08,230 --> 06:36:09,230
our items here. So what I'm going to do is
first go and add our flex, sorry, aligned
5486
06:36:09,230 --> 06:36:10,230
self property to all of our values, here are
all of our container items. And now what I'm
5487
06:36:10,230 --> 06:36:11,230
going to do is start styling them. So we know
that the first one is at the start, we want
5488
06:36:11,230 --> 06:36:12,230
the second one here to be in the center. So
although it's already defined, I'm just going
5489
06:36:12,230 --> 06:36:13,230
to say center to make everything a little
easier to read. Now we're going to go ahead
5490
06:36:13,230 --> 06:36:14,230
and look for the third one, which needs to
be at the bottom. So what I'm going to say
5491
06:36:14,230 --> 06:36:15,230
here is flex
5492
06:36:15,230 --> 06:36:16,230
end.
5493
06:36:16,230 --> 06:36:17,230
And let's go ahead and refresh working so
far. Our fourth one has to be on the same
5494
06:36:17,230 --> 06:36:18,230
level as he so we're going to keep that in
the center here, wherever it is, let's see.
5495
06:36:18,230 --> 06:36:19,230
Yep, it's the fourth one centered. And now
we want our final one to be at the top as
5496
06:36:19,230 --> 06:36:20,230
well. So it is a little confusing to read
with the orders. But after a little bit of
5497
06:36:20,230 --> 06:36:21,230
looking, you can see how this whole thing
works. Now obviously, it's a little bit out
5498
06:36:21,230 --> 06:36:22,230
of proportion because of our sizes here. But
you can see that our thing is still responsive.
5499
06:36:22,230 --> 06:36:23,230
It's still resizing in the same way, we just
aligned the items differently. Alright, so
5500
06:36:23,230 --> 06:36:24,230
there you go. That's pretty much how this
works. And one thing to note that before we
5501
06:36:24,230 --> 06:36:25,230
move on is you can't actually use stretch
and baseline on a line self, they just don't
5502
06:36:25,230 --> 06:36:26,230
work because they are kind of container specific
properties and they won't, they work off of
5503
06:36:26,230 --> 06:36:27,230
values of the container. So aligning it on
an item just wouldn't really work in the same
5504
06:36:27,230 --> 06:36:28,230
way. So that is one thing you need to keep
in mind is that you can only use these three
5505
06:36:28,230 --> 06:36:29,230
values. Alright, so like I said, we were moving
on and learning about all of the different
5506
06:36:29,230 --> 06:36:30,230
alignments. And now that we've learned how
to align each item, we can really use this
5507
06:36:30,230 --> 06:36:31,230
along with our flex property and some other
Flexbox properties on the container to create
5508
06:36:31,230 --> 06:36:32,230
a really nice responsive layout. So I encourage
you to go ahead and try this on your own,
5509
06:36:32,230 --> 06:36:33,230
create your own flex layouts, and don't even
just use these blocks, you can go through
5510
06:36:33,230 --> 06:36:34,230
and use images and forums and all sorts of
things. And just style them in a way that
5511
06:36:34,230 --> 06:36:35,230
makes the website look good. Because now that
you've learned the tools to create a responsive
5512
06:36:35,230 --> 06:36:36,230
container, you can go through and actually
start practically applying it to the real
5513
06:36:36,230 --> 06:36:37,230
world. Alright, let's move on. So in this
video, we're going to be looking at grid versus
5514
06:36:37,230 --> 06:36:38,230
Flexbox. Now in the previous section, we looked
at Flexbox as a whole, we looked at all the
5515
06:36:38,230 --> 06:36:39,230
different container properties, we also looked
at some of the other properties that we can
5516
06:36:39,230 --> 06:36:40,230
use on our items. But today, we're going to
be looking at a different type of well layout
5517
06:36:40,230 --> 06:36:41,230
property, and that is grid. So before we get
started, I'm going to give a little introduction
5518
06:36:41,230 --> 06:36:42,230
to grid and what it actually is. So similar
to Flexbox grid is a display type that's going
5519
06:36:42,230 --> 06:36:43,230
to allow us to work with our layout and our
CSS in a different way. So again, they are
5520
06:36:43,230 --> 06:36:44,230
both completely all complete alternatives
to some of the other layout features that
5521
06:36:44,230 --> 06:36:45,230
were used in the older times and in other
versions of CSS. So what we're going to be
5522
06:36:45,230 --> 06:36:46,230
doing is again, in this section, going through
looking at the different types, and what we
5523
06:36:46,230 --> 06:36:47,230
do with grid, and how it actually all fits
together.
5524
06:36:47,230 --> 06:36:48,230
So now that we know some of the similarities,
let's look at the differences. So although
5525
06:36:48,230 --> 06:36:49,230
they are both alternatives to our, to our
different layouts, what we can actually do
5526
06:36:49,230 --> 06:36:50,230
is look at how they work at a core level.
And although they are completely the same
5527
06:36:50,230 --> 06:36:51,230
in what they achieve and their core goals,
they are completely different in how they
5528
06:36:51,230 --> 06:36:52,230
work. So first of all, the grid system is
a lot more manual it requires well it doesn't
5529
06:36:52,230 --> 06:36:53,230
require but you can control your container
in a much easier way. So you can really customize
5530
06:36:53,230 --> 06:36:54,230
your layout and see how everything fits together
with a lot more tools. So one of the the main
5531
06:36:54,230 --> 06:36:55,230
difference is how the grid system focuses
on both the width and height. So although
5532
06:36:55,230 --> 06:36:56,230
Flexbox does have some height features, it's
mainly focused on the width of flex items
5533
06:36:56,230 --> 06:36:57,230
in the container. Whereas grid is focused,
very focused on providing both tools for width
5534
06:36:57,230 --> 06:36:58,230
and height to create Well, a grid. And that's
really the reason for the name is because
5535
06:36:58,230 --> 06:36:59,230
it is more focused on creating a grid, providing
tools for columns and rows, and all sorts
5536
06:36:59,230 --> 06:37:00,230
of things that we're going to cover in the
next few videos looking at, you know, some
5537
06:37:00,230 --> 06:37:01,230
of the tools that we can use in grid and the
inherent differences between grid and Flexbox.
5538
06:37:01,230 --> 06:37:02,230
So I hope that was a really in depth view
at the differences between grid and Flexbox.
5539
06:37:02,230 --> 06:37:03,230
And we will go through and talk more about
them as we go through the section, you know,
5540
06:37:03,230 --> 06:37:04,230
learning more tools and properties that we
can use on our grid. Alright, so I hope that
5541
06:37:04,230 --> 06:37:05,230
you took a lot from this video. And although
you're not really supposed to know anything
5542
06:37:05,230 --> 06:37:06,230
about how they work, it's good to keep in
mind about some of the differences between
5543
06:37:06,230 --> 06:37:07,230
them, and draw your own conclusions about
whether you should use grid or Flexbox depending
5544
06:37:07,230 --> 06:37:08,230
on what type of website or application you
are creating. Alright, let's move on.
5545
06:37:08,230 --> 06:37:09,230
So in this video, we're going to be starting
creating our different grid items and working
5546
06:37:09,230 --> 06:37:10,230
with our grids. So I've already created and
set up a little playground or sandbox for
5547
06:37:10,230 --> 06:37:11,230
our grid here, we've pretty much adopted the
same style as the Flexbox here using all of
5548
06:37:11,230 --> 06:37:12,230
our different, you know, widths and heights
and all these different blocks. But I encourage
5549
06:37:12,230 --> 06:37:13,230
you, when you're doing this on your own to
go ahead and experiment around, maybe use
5550
06:37:13,230 --> 06:37:14,230
some different items. I'm just doing this
because it's easy for demonstrations. Alright,
5551
06:37:14,230 --> 06:37:15,230
so let's get started. Pretty much grid. And
while Flexbox have very similar ways of activation,
5552
06:37:15,230 --> 06:37:16,230
they both use a display type or the display
property to set or activate the container.
5553
06:37:16,230 --> 06:37:17,230
Now the only difference is is is the property
that it or sorry, the value that needs to
5554
06:37:17,230 --> 06:37:18,230
be used to activate these, which is pretty
fair, which is fairly obvious. So let's get
5555
06:37:18,230 --> 06:37:19,230
started. First of all, we need to put it on
the container. Remember, we're not working
5556
06:37:19,230 --> 06:37:20,230
with the items, we're working with the container
as a whole. So all I need to do similar to
5557
06:37:20,230 --> 06:37:21,230
how we created our flex container is that
of saying Flexbox, or grid box or whatever,
5558
06:37:21,230 --> 06:37:22,230
all we have to do is type in grid. And what
this will do is set up our grid container.
5559
06:37:22,230 --> 06:37:23,230
Let's go and refresh. And you can see that
although you know may not appear that nothing
5560
06:37:23,230 --> 06:37:24,230
has changed, we have activated a whole range
of properties that we can now use on our grid
5561
06:37:24,230 --> 06:37:25,230
here to set up everything and start creating
our grid. Now you'll notice that when we set
5562
06:37:25,230 --> 06:37:26,230
up our Flexbox, so many things different so
many different things change. But without
5563
06:37:26,230 --> 06:37:27,230
grid, we actually need to go through and set
up the grid by ourselves, which is what the
5564
06:37:27,230 --> 06:37:28,230
whole manual element about it, which is where
the whole manual element comes in is we have
5565
06:37:28,230 --> 06:37:29,230
to go and create a grid and sort of shape
it in a way that suits our needs. Alright,
5566
06:37:29,230 --> 06:37:30,230
so that's pretty much it for creating the
grid. Now I know this wasn't a very heavy
5567
06:37:30,230 --> 06:37:31,230
video, but there are going to be a lot more
concepts that we're going to need to learn
5568
06:37:31,230 --> 06:37:32,230
in the future. So this is quite an easy video,
just setting up the grid. And now that we've
5569
06:37:32,230 --> 06:37:33,230
done the easy part, we're going to go through
and start learning some of the more difficult
5570
06:37:33,230 --> 06:37:34,230
parts of CSS Grid.
5571
06:37:34,230 --> 06:37:35,230
Alright,
5572
06:37:35,230 --> 06:37:36,230
let's move on. So in this video, we're going
to be moving on with grid and start creating
5573
06:37:36,230 --> 06:37:37,230
and setting up this grid to really just define
the style that we want to use for our website.
5574
06:37:37,230 --> 06:37:38,230
So what we're going to do is go ahead and
get started with some of the two basic properties
5575
06:37:38,230 --> 06:37:39,230
that we're going to be using, which are template
rows and columns. So unlike Flexbox, we can
5576
06:37:39,230 --> 06:37:40,230
actually specify the number of grids are well
the number of rows and columns that we want
5577
06:37:40,230 --> 06:37:41,230
manually and create the exact style that we
want to divide up all our elements. So what
5578
06:37:41,230 --> 06:37:42,230
we're going to be doing is using two special
properties that we can go ahead and use. And
5579
06:37:42,230 --> 06:37:43,230
what this is going to do is allow us to split
up our grid into a specified number of rows
5580
06:37:43,230 --> 06:37:44,230
and columns, which we can then divide the
items up into, and then start specifying the
5581
06:37:44,230 --> 06:37:45,230
sizes and other parts of these items. So like
I said, we're going to be going through and
5582
06:37:45,230 --> 06:37:46,230
you know, doing all of this and as we go through.
In this section, we're going to be getting
5583
06:37:46,230 --> 06:37:47,230
more experienced with rows and columns and
some of the other core concepts in grid that
5584
06:37:47,230 --> 06:37:48,230
will allow us to really shape up this grid
box that we have right here and start applying
5585
06:37:48,230 --> 06:37:49,230
it in different places. So Let's get started.
So like I said, the two properties that we're
5586
06:37:49,230 --> 06:37:50,230
going to be learning today are about template
columns and rows. So pretty much what this
5587
06:37:50,230 --> 06:37:51,230
does is sets up the grid to start off with
a certain number of rows or columns depending
5588
06:37:51,230 --> 06:37:52,230
on what property that you're using. And then
from there, you can actually specify the sizes
5589
06:37:52,230 --> 06:37:53,230
of each column and row. Now, we're not to
changing individual item sizes yet, but we
5590
06:37:53,230 --> 06:37:54,230
can actually go ahead and change the size
of each individual row or column to create
5591
06:37:54,230 --> 06:37:55,230
alternating sizes and alternating boxes, which
have alternating sizes. So let's get started.
5592
06:37:55,230 --> 06:37:56,230
Now the two properties that we need to use,
which are pretty easy to learn our grid, template
5593
06:37:56,230 --> 06:37:57,230
columns, and rows, don't forget about areas
for now we don't need to know them. Now, what
5594
06:37:57,230 --> 06:37:58,230
we're going to do is set up our grid template
columns first. So instead of doing something
5595
06:37:58,230 --> 06:37:59,230
where we might be taken a function or something,
this is actually set up in a really nice and
5596
06:37:59,230 --> 06:38:00,230
elegant way. And all we have to do is type
out the sizes that we want. And based on the
5597
06:38:00,230 --> 06:38:01,230
number of sizes or values that we input, it
will decide the number of rows that we want.
5598
06:38:01,230 --> 06:38:02,230
So I'll give you an example here, let's just
say I'm going to the first row to be 10 pixels
5599
06:38:02,230 --> 06:38:03,230
wide, which is pretty small. And then I wanted
the second one to be 50 pixels, and the third
5600
06:38:03,230 --> 06:38:04,230
one to be 10
5601
06:38:04,230 --> 06:38:05,230
pixels again.
5602
06:38:05,230 --> 06:38:06,230
So what we're pretty much doing here is setting
up setting it up so that we have three columns.
5603
06:38:06,230 --> 06:38:07,230
Because we've passed in three values, the
first is going to be about 10 pixels, which
5604
06:38:07,230 --> 06:38:08,230
is very, very small, the next one is going
to be 50 pixels. And then the last is going
5605
06:38:08,230 --> 06:38:09,230
to be 10 pixels. Now let's see how this looks.
Now if you don't already know this already,
5606
06:38:09,230 --> 06:38:10,230
columns are going downwards, not this way.
So just keep that in mind, we refresh the
5607
06:38:10,230 --> 06:38:11,230
page. And you can see what kind of an effect
that has here,
5608
06:38:11,230 --> 06:38:12,230
we have
5609
06:38:12,230 --> 06:38:13,230
a lot of empty space open here. Again, because
we're using absolute values and not relative
5610
06:38:13,230 --> 06:38:14,230
values. Or at least relative to the box that
we have here, you can see that our boxes here
5611
06:38:14,230 --> 06:38:15,230
are really divided up in a weird way. So our
first column is 10 pixels very small. And
5612
06:38:15,230 --> 06:38:16,230
then the second one is it's getting really
mixed up you can see here with our wrapping
5613
06:38:16,230 --> 06:38:17,230
and all of this different stuff. And of course,
we don't have those lines to show us how our
5614
06:38:17,230 --> 06:38:18,230
grid is set up. But you can see that doing
something like this would obviously really
5615
06:38:18,230 --> 06:38:19,230
mess up the grid. Now, obviously, you're not
going to go and set all of this to 10 pixels
5616
06:38:19,230 --> 06:38:20,230
at 50 pixels. But you can just see what kind
of an effect this has already. We haven't
5617
06:38:20,230 --> 06:38:21,230
even created any rows yet. And we've already
completely customized the way our grid looks
5618
06:38:21,230 --> 06:38:22,230
without touching or doing anything. Unlike
Flexbox, we had to actually really go in and
5619
06:38:22,230 --> 06:38:23,230
specify it in a way that changed everything.
So let's get started on some of the next one,
5620
06:38:23,230 --> 06:38:24,230
the next one, which is our grid template.
What's it called rows. So what's going to
5621
06:38:24,230 --> 06:38:25,230
happen here is instead of specifying the columns,
we're going to go ahead and specify the rows
5622
06:38:25,230 --> 06:38:26,230
and it works in exactly the same way, all
we need to do is pass in a set number of values,
5623
06:38:26,230 --> 06:38:27,230
and it'll decide what we need for us. And
just one thing to note, these don't need to
5624
06:38:27,230 --> 06:38:28,230
be the same imagine it imagine it as sort
of a table here, we have three columns going
5625
06:38:28,230 --> 06:38:29,230
downwards, and three rows going from left
to right. So let's go ahead and specify this
5626
06:38:29,230 --> 06:38:30,230
year, I'm going to go ahead and say I only
want two rows. So I'm gonna say the first
5627
06:38:30,230 --> 06:38:31,230
one is 50 pixels. The second one is 250 pixels.
Now let's see how this looks. So you can see
5628
06:38:31,230 --> 06:38:32,230
again, this whole thing has expanded. And
now our first row is much smaller, and our
5629
06:38:32,230 --> 06:38:33,230
second row is a lot bigger. So you can see
already what you can do with this. And that
5630
06:38:33,230 --> 06:38:34,230
you have power as of using these template
columns and rows, as I've explained before,
5631
06:38:34,230 --> 06:38:35,230
but this isn't a really convenient, or efficient
way to create a nice looking grid. Because
5632
06:38:35,230 --> 06:38:36,230
how are we supposed to know the elements or
the amounts of each device, especially with,
5633
06:38:36,230 --> 06:38:37,230
you know, all these different viewports and
sizes, we need to keep this consistent across
5634
06:38:37,230 --> 06:38:38,230
all devices. So there's actually a really
easy value that we can use, which is called
5635
06:38:38,230 --> 06:38:39,230
auto. Now if we actually go ahead and set
all of our rows to auto, what's going to happen
5636
06:38:39,230 --> 06:38:40,230
is it's actually going to divide the space
evenly between the three no matter the size.
5637
06:38:40,230 --> 06:38:41,230
And I can also even go ahead and do this with
my rows. And now if I refresh the page, you
5638
06:38:41,230 --> 06:38:42,230
can see this looks a lot better. Now you can
kind of see how the spacing is working here,
5639
06:38:42,230 --> 06:38:43,230
we have three columns. And obviously there's
nothing in our third column for the bottom
5640
06:38:43,230 --> 06:38:44,230
row. But then we also have two rows, so it's
kind of split down the middle. And now we
5641
06:38:44,230 --> 06:38:45,230
have our three elements up here and our fourth
and fifth element down here. So you can see
5642
06:38:45,230 --> 06:38:46,230
here that what's happening is it's dividing
the space evenly between our elements or our
5643
06:38:46,230 --> 06:38:47,230
grid. And if we did actually go ahead and
remove on the values and change it to an absolute
5644
06:38:47,230 --> 06:38:48,230
value, use something like 100 pixels, what's
going to happen is the remaining space is
5645
06:38:48,230 --> 06:38:49,230
going to be kind of divvied up between the
two columns. And obviously, it doesn't look
5646
06:38:49,230 --> 06:38:50,230
like it here, because we don't have spacings
enabled. There's a bunch of things going on
5647
06:38:50,230 --> 06:38:51,230
behind the scenes. But what happens is the
remaining space is kind of divided up between
5648
06:38:51,230 --> 06:38:52,230
the two columns. So you can see already that
with these values, we can create some really
5649
06:38:52,230 --> 06:38:53,230
nice looking grids without even having to
do much work. Now, what I would recommend
5650
06:38:53,230 --> 06:38:54,230
is, instead of going and specifying all of
our absolute values, go ahead and just create
5651
06:38:54,230 --> 06:38:55,230
the number of columns and rows that you want,
while also using auto values. Because later
5652
06:38:55,230 --> 06:38:56,230
in the future, what we're going to do is learn
some techniques to split up our items and
5653
06:38:56,230 --> 06:38:57,230
make them look a lot larger without having
to change the size of the columns and rows.
5654
06:38:57,230 --> 06:38:58,230
Because it is a much easier, it's much easier
to work with our items rather than the grid
5655
06:38:58,230 --> 06:38:59,230
itself. Alright, so that's pretty much it
for template columns and rows. Now, like I
5656
06:38:59,230 --> 06:39:00,230
said, just for any other exercise, I recommend
you to go ahead and play with this on your
5657
06:39:00,230 --> 06:39:01,230
own. Try and create your own custom grids
and throwing images and all sorts of things
5658
06:39:01,230 --> 06:39:02,230
in there, play around with it, and try and
see what you can create. And just try and
5659
06:39:02,230 --> 06:39:03,230
come up with this many cool crazy ideas as
possible. Because there is a lot you can do
5660
06:39:03,230 --> 06:39:04,230
with just these two. Properties, which are
grid template columns, and grid template rows.
5661
06:39:04,230 --> 06:39:05,230
Alright, let's move on. So in this video,
we're going to be looking at some more properties
5662
06:39:05,230 --> 06:39:06,230
relating to the grid container. Now, these
properties are very similar to the ones we
5663
06:39:06,230 --> 06:39:07,230
learned in Flexbox, which is actually somewhere
up here, where we've learned how to justify
5664
06:39:07,230 --> 06:39:08,230
and align items in different ways. But there
are very similar concepts. The only problem
5665
06:39:08,230 --> 06:39:09,230
is some of the values and the properties themselves
are actually kind of different. So we need
5666
06:39:09,230 --> 06:39:10,230
to go ahead and look over those differences.
So that we can get used to interchanging these
5667
06:39:10,230 --> 06:39:11,230
properties between the two without kind of
affecting our understanding of the properties.
5668
06:39:11,230 --> 06:39:12,230
So what I'm going to be doing in this video
is going and teaching you in this video how
5669
06:39:12,230 --> 06:39:13,230
to align and justify our items both horizontally
and vertically. So let's start with the first
5670
06:39:13,230 --> 06:39:14,230
one, which is very similar to Flexbox. And
it is the justify content property. So just
5671
06:39:14,230 --> 06:39:15,230
like we've learned before, this is going to
justify it on kind of the horizontal axis
5672
06:39:15,230 --> 06:39:16,230
instead of on the vertical axis. So for example,
if we were to center these items, what we
5673
06:39:16,230 --> 06:39:17,230
would do is we'll push them all to the center,
instead of moving them up and down. So there
5674
06:39:17,230 --> 06:39:18,230
we go. Let's go ahead and get started with
this, I'm going to go ahead and create a new
5675
06:39:18,230 --> 06:39:19,230
property here justify content. Now, just like
with our previous property, there are three
5676
06:39:19,230 --> 06:39:20,230
main values that are used both in our justify
content property, and the aligned content
5677
06:39:20,230 --> 06:39:21,230
property, which we're going to learn in just
a second. The only problem is in our Flexbox
5678
06:39:21,230 --> 06:39:22,230
section, we looked at them and they did have
a prefix, which are flex start and flex end.
5679
06:39:22,230 --> 06:39:23,230
So basically, like I said, these are sort
of do signify the start and end of the flex
5680
06:39:23,230 --> 06:39:24,230
box depending on what axes you're aligning
your items on. But instead of adding that
5681
06:39:24,230 --> 06:39:25,230
prefix here, we're just going to say start
and and center, instead of something like
5682
06:39:25,230 --> 06:39:26,230
grid start or granddad, they don't use any
of that prefixes. All that's included are
5683
06:39:26,230 --> 06:39:27,230
the three main keywords. So it's a lot simpler
to understand. And but it is a little bit
5684
06:39:27,230 --> 06:39:28,230
harder when you start using both Flexbox and
grid, and you get the two very mixed up or
5685
06:39:28,230 --> 06:39:29,230
confused. So let's go ahead and do that. Now.
I'm just going to go ahead and justified the
5686
06:39:29,230 --> 06:39:30,230
content to the center. Why don't I go ahead
and do it or justify it to the end this time
5687
06:39:30,230 --> 06:39:31,230
just to spice
5688
06:39:31,230 --> 06:39:32,230
things up a little bit.
5689
06:39:32,230 --> 06:39:33,230
If I refresh the page, you can see that our
template columns, and that's the key word
5690
06:39:33,230 --> 06:39:34,230
there template are ignored, and everything
is completely aligned to the right side of
5691
06:39:34,230 --> 06:39:35,230
our grid. So we can also do it just like with
our previous properties in our Flexbox, we
5692
06:39:35,230 --> 06:39:36,230
can also align it to the start and do pretty
much whatever we want with these. So the next
5693
06:39:36,230 --> 06:39:37,230
value, or the next two values that we're going
to use for this property are space around
5694
06:39:37,230 --> 06:39:38,230
and space evenly, which is a little bit different
from space between. So they both work in the
5695
06:39:38,230 --> 06:39:39,230
same way, in that they create spacing between
the items to give them to you all even them
5696
06:39:39,230 --> 06:39:40,230
out in the grid. But the only difference is
on our Flexbox we actually used space between
5697
06:39:40,230 --> 06:39:41,230
whereas on our grid, we're using the value
space evenly. So I'm going to go ahead and
5698
06:39:41,230 --> 06:39:42,230
show you that here. I'm going to just go ahead
and say space evenly. Like that. Now if I
5699
06:39:42,230 --> 06:39:43,230
refresh the page, you can see that although
it doesn't actually show up here, maybe because
5700
06:39:43,230 --> 06:39:44,230
of a developer error or something like that,
we now have our it Here spaced evenly, just
5701
06:39:44,230 --> 06:39:45,230
like we can see here in this grid box. Now
there are remember spaces between or before
5702
06:39:45,230 --> 06:39:46,230
and after our first items, and that's the
key word there. You can see instead of saying
5703
06:39:46,230 --> 06:39:47,230
between it says evenly. And pretty much, what
this is saying is, we're actually going to
5704
06:39:47,230 --> 06:39:48,230
space them evenly, not just put space in between
them. So like I said, I talked about a lot
5705
06:39:48,230 --> 06:39:49,230
of uses of these in the previous section,
but we're not going to go over those now.
5706
06:39:49,230 --> 06:39:50,230
So let's go ahead and try out the next value,
which is space around. And when we refresh
5707
06:39:50,230 --> 06:39:51,230
the page, you can see that this looks pretty
much exactly the same. Now, of course, we
5708
06:39:51,230 --> 06:39:52,230
don't have lots of space or room to work with
here. So you're not going to see the direct
5709
06:39:52,230 --> 06:39:53,230
impact or differences between these. So for
now, let's just consider them the same purpose.
5710
06:39:53,230 --> 06:39:54,230
Like I said, we've used both of these in the
past, and you know exactly what they do. So
5711
06:39:54,230 --> 06:39:55,230
now let's go ahead and get started with our
next value or sorry, property, which is our
5712
06:39:55,230 --> 06:39:56,230
align content property. Now, instead of using
align items, we're using aligned content.
5713
06:39:56,230 --> 06:39:57,230
So that's just one thing to keep in mind.
But I'm going to go ahead and say is aligned
5714
06:39:57,230 --> 06:39:58,230
content. And before that, let's actually go
ahead and give it a little bit more height,
5715
06:39:58,230 --> 06:39:59,230
I'm going to say maybe 500 pixels, refresh
the page. And obviously, these stretch out,
5716
06:39:59,230 --> 06:40:00,230
we don't have any defined heights for them.
But we don't have to worry about that for
5717
06:40:00,230 --> 06:40:01,230
now, I'll go ahead and change that in just
a second. So what I'm going to do is go ahead
5718
06:40:01,230 --> 06:40:02,230
and start playing around with some of these
properties. Now, what's actually really interesting
5719
06:40:02,230 --> 06:40:03,230
is for our align items, we can actually use
both space evenly and space around. But we
5720
06:40:03,230 --> 06:40:04,230
also we also have our space between property
from our Flexbox section. So if I go ahead
5721
06:40:04,230 --> 06:40:05,230
and try that out now,
5722
06:40:05,230 --> 06:40:06,230
space in between,
5723
06:40:06,230 --> 06:40:07,230
and refresh the page, you can see what happens
is that we have our space between right there
5724
06:40:07,230 --> 06:40:08,230
just as we've signified and it's not spaced
evenly. Remember if there's no space, before
5725
06:40:08,230 --> 06:40:09,230
or after our top and bottom items. So that's
a really cool feature to keep in mind with
5726
06:40:09,230 --> 06:40:10,230
our aligned content, property. And of course,
along with space evenly and space around,
5727
06:40:10,230 --> 06:40:11,230
we also have our three standard values, just
go ahead and show you that here are three
5728
06:40:11,230 --> 06:40:12,230
standard values, which are center start and
end. So I can go ahead and show you that
5729
06:40:12,230 --> 06:40:13,230
now. Start
5730
06:40:13,230 --> 06:40:14,230
out or sorry, line content to the end. And
that will push everything down to the bottom
5731
06:40:14,230 --> 06:40:15,230
of bottom of the page. So there we go. There's
a lot to digest. In this video, there's a
5732
06:40:15,230 --> 06:40:16,230
lot of different properties to cover and memorize.
But don't worry about all that for now just
5733
06:40:16,230 --> 06:40:17,230
understand which property does which. And
everything will just fall naturally into place.
5734
06:40:17,230 --> 06:40:18,230
And remember, if you ever forget how to do
something, you can always go and both review
5735
06:40:18,230 --> 06:40:19,230
the lectures or just Google it. It's really
that simple. There are tons of articles and
5736
06:40:19,230 --> 06:40:20,230
helpful resources out there to help you decide
or figure out some of the properties you may
5737
06:40:20,230 --> 06:40:21,230
have lost or forgotten in your time using
CSS. So there we go. That's pretty much it
5738
06:40:21,230 --> 06:40:22,230
for aligning content, it's quite easy in terms
of properties. Although there are a lot of
5739
06:40:22,230 --> 06:40:23,230
values once you start using them and getting
used to some of the subtle differences, everything
5740
06:40:23,230 --> 06:40:24,230
will just fall naturally into place. As I
said before, alright, let's move on. So in
5741
06:40:24,230 --> 06:40:25,230
this video, we're going to be looking at another
feature of our grids here, and that is going
5742
06:40:25,230 --> 06:40:26,230
to be column, column gaps column and row gaps.
So we've looked at aligning content, we've
5743
06:40:26,230 --> 06:40:27,230
looked at creating columns and rows. Now we're
going to look at the final piece that kind
5744
06:40:27,230 --> 06:40:28,230
of connects everything together for our containers,
which are gaps. So we've talked about how
5745
06:40:28,230 --> 06:40:29,230
our grid is kind of set up, we have our boxes,
we have our columns and our rows. And then
5746
06:40:29,230 --> 06:40:30,230
we can actually change these or override them
using our justification here, I'm actually
5747
06:40:30,230 --> 06:40:31,230
going to go ahead and erase these or comment
them out just for this lecture. So we can
5748
06:40:31,230 --> 06:40:32,230
create some good demonstrations here. So what
I'm going to be doing is going through and
5749
06:40:32,230 --> 06:40:33,230
talking about these gaps. And they're actually
pretty important when it comes to the whole
5750
06:40:33,230 --> 06:40:34,230
thing because you can completely change the
way a grid looks by creating spacing. And
5751
06:40:34,230 --> 06:40:35,230
obviously, if you've seen any websites, and
really look closely at it, you'll understand
5752
06:40:35,230 --> 06:40:36,230
the importance of spacing in websites, they
really bring everything together and create
5753
06:40:36,230 --> 06:40:37,230
sort of a hierarchy that's easy on the eyes
if you've taken any UX or design. So let's
5754
06:40:37,230 --> 06:40:38,230
get started. Now what I'm going to be doing
is going ahead and creating these column and
5755
06:40:38,230 --> 06:40:39,230
row gaps. So the first the first one I want
to talk about is column gaps. And just as
5756
06:40:39,230 --> 06:40:40,230
we were working with our call template columns
and template rows, the the properties that
5757
06:40:40,230 --> 06:40:41,230
we need to use are pretty similar. So first,
I'm going to go ahead and start with our columns.
5758
06:40:41,230 --> 06:40:42,230
Now the property that we're going to be using
is grid column gap. And you can obviously
5759
06:40:42,230 --> 06:40:43,230
kind of associate these together to memorize
them or maybe learn them easier. But besides
5760
06:40:43,230 --> 06:40:44,230
that, we're going to go ahead and get this
started. Now, of course, this only takes one
5761
06:40:44,230 --> 06:40:45,230
value, we don't need to specify any more,
because what we're going to be doing is giving
5762
06:40:45,230 --> 06:40:46,230
each while each column A gap between them.
So let's go ahead and give it a value, I'm
5763
06:40:46,230 --> 06:40:47,230
just going to go ahead and say 150 pixels.
To make it a little bit evident, go ahead
5764
06:40:47,230 --> 06:40:48,230
and refresh the page. And although it may
not be obvious, immediately, you can kind
5765
06:40:48,230 --> 06:40:49,230
of see that these columns are a little bit
more spaced out now. Now, of course, there's
5766
06:40:49,230 --> 06:40:50,230
no lines to kind of show you the visualization.
But you can kind of deduce from this, that
5767
06:40:50,230 --> 06:40:51,230
there is definitely a bigger gap between the
columns. Now that we've specified it. So now
5768
06:40:51,230 --> 06:40:52,230
what I'm going to do is go ahead and actually
change this and give it a row gap. So very
5769
06:40:52,230 --> 06:40:53,230
similar to our previous previous property,
we're going to use grid row gap. And this
5770
06:40:53,230 --> 06:40:54,230
is pretty much the exact same thing, except
it specifies the gap between rows. So this
5771
06:40:54,230 --> 06:40:55,230
is probably going to be a lot more obvious
here, what I'm going to do is just going ahead
5772
06:40:55,230 --> 06:40:56,230
and saying 300 pixels, and notice how the
gap of this place kind of gets bigger. You
5773
06:40:56,230 --> 06:40:57,230
can see now that there is a much bigger gap
between our top row and our bottom row. So
5774
06:40:57,230 --> 06:40:58,230
that's pretty easy. But obviously, you don't
want to go through and specify these every
5775
06:40:58,230 --> 06:40:59,230
single time. So there's actually a really
nice shorthand property that we can use to
5776
06:40:59,230 --> 06:41:00,230
bring this all together, I'm going to go ahead
and actually, I'll keep these for now, and
5777
06:41:00,230 --> 06:41:01,230
then I'll erase them
5778
06:41:01,230 --> 06:41:02,230
when we're done.
5779
06:41:02,230 --> 06:41:03,230
So instead of specifying which axes you want
to do it on, or which axis sorry, you can
5780
06:41:03,230 --> 06:41:04,230
just say grid gap. And what this is going
to do is just create the gap instantly, where
5781
06:41:04,230 --> 06:41:05,230
you can pass in two values and specify it
or do it all in one go. So this takes the
5782
06:41:05,230 --> 06:41:06,230
column first. And then the row, kind of just
how template columns goes first. And template
5783
06:41:06,230 --> 06:41:07,230
rows go first in a shorthand, which we haven't
actually talked about. But we'll get to that
5784
06:41:07,230 --> 06:41:08,230
later. For here, what we're going to do is
specify our column first, which is 150 pixels,
5785
06:41:08,230 --> 06:41:09,230
and our row gap next 300 pixels. Now, I'm
going to go ahead and erase these other values
5786
06:41:09,230 --> 06:41:10,230
that we don't need and refresh the page. So
I actually made a little mistake there, and
5787
06:41:10,230 --> 06:41:11,230
I put the column before the rows or if I cause
any confusion there. So what I'm going to
5788
06:41:11,230 --> 06:41:12,230
do is actually just go ahead and change this
really quickly. So that this will work. Now
5789
06:41:12,230 --> 06:41:13,230
if I go ahead and refresh, you can see that
they look exactly the same. Again, sorry for
5790
06:41:13,230 --> 06:41:14,230
that mix up. Just remember that the row or
the row size comes before the column size,
5791
06:41:14,230 --> 06:41:15,230
just keep that in mind. So there we go. Now
we have our grid gap setup. Now this is pretty
5792
06:41:15,230 --> 06:41:16,230
much it for our well, column gap or row gap
are all of these gaps for our grid layout.
5793
06:41:16,230 --> 06:41:17,230
Now, there's really not that much to it, it's
very easy to set up. But once you do that,
5794
06:41:17,230 --> 06:41:18,230
it becomes very easy to sort of work with
your grid along with the other properties
5795
06:41:18,230 --> 06:41:19,230
to create some really nice looking layouts.
And once we start learning some more of the
5796
06:41:19,230 --> 06:41:20,230
properties in the next few videos, you can
really maximize the use of the grid layout
5797
06:41:20,230 --> 06:41:21,230
in CSS. Alright, let's move on. So now we're
going to be moving on to a little bit more
5798
06:41:21,230 --> 06:41:22,230
complex, the more complicated parts grid,
and in this video, we're going to be covering
5799
06:41:22,230 --> 06:41:23,230
quite a big topic, it's going to be a lot
to chew. And don't worry, if you don't get
5800
06:41:23,230 --> 06:41:24,230
it on the first try. We're going to go through
this slowly, and we're going to go through
5801
06:41:24,230 --> 06:41:25,230
it step by step so that we can learn everything
about this. So in this video, we're gonna
5802
06:41:25,230 --> 06:41:26,230
be learning about the real true power of grid
and more we're going to be learning is how
5803
06:41:26,230 --> 06:41:27,230
to rearrange and resize items based on starting
at starting and ending points. So that's what
5804
06:41:27,230 --> 06:41:28,230
we're going to be doing today. The first thing
we need to do is obviously go and go to our
5805
06:41:28,230 --> 06:41:29,230
grid container on our HTML file, since we
need to specify the start and end points of
5806
06:41:29,230 --> 06:41:30,230
each item individually. So let's get started.
Now the first thing I'm going to do is actually
5807
06:41:30,230 --> 06:41:31,230
go ahead and remove all of these values because
it'll be much easier to see and understand
5808
06:41:31,230 --> 06:41:32,230
what's going on. When we just have these fives
here, what I'm actually going to do is go
5809
06:41:32,230 --> 06:41:33,230
ahead and add a sixth item just to break even
here and make everything look great. So I'm
5810
06:41:33,230 --> 06:41:34,230
going to go ahead and choose another color.
something random here, maybe a purple. Do
5811
06:41:34,230 --> 06:41:35,230
we have that? Yeah, we do have that will be
a green something. Actually, let's just go
5812
06:41:35,230 --> 06:41:36,230
for a nice dark orange something here. And
we're going to go ahead and copy that. And
5813
06:41:36,230 --> 06:41:37,230
now we have a sixth values to break even here.
So what we're going to be learning in this
5814
06:41:37,230 --> 06:41:38,230
video is how to, like I just said resize items,
and there are actually a few. There we go,
5815
06:41:38,230 --> 06:41:39,230
we have our colors have now, we do have a
few different shorthands and properties that
5816
06:41:39,230 --> 06:41:40,230
we can use to set this up. So the first thing
we need to learn is the lines and the concept
5817
06:41:40,230 --> 06:41:41,230
of lines. So we do know that we have our columns
and our rows. Well, what's happening here
5818
06:41:41,230 --> 06:41:42,230
is that each column starts and ends or well,
each column is designated a certain line.
5819
06:41:42,230 --> 06:41:43,230
So for example, this would be line one beginning
here, this would be line two, and then this
5820
06:41:43,230 --> 06:41:44,230
would be line three. And then for our rows,
we have our line one and our line two. So
5821
06:41:44,230 --> 06:41:45,230
what we can actually do is say set, set this
item to go from line one to line three, and
5822
06:41:45,230 --> 06:41:46,230
from row line one to row, line two. And we
can do this using a few properties and some
5823
06:41:46,230 --> 06:41:47,230
shorthand, and some other keywords and other
other things that we can do to set this whole
5824
06:41:47,230 --> 06:41:48,230
thing up. So one thing you need to keep in
mind that is that lines are the basically
5825
06:41:48,230 --> 06:41:49,230
the core concept, the most important part
of grid, it's what makes grid what it is,
5826
06:41:49,230 --> 06:41:50,230
all of the properties that we've learned,
are all kind of revolving around lines, and
5827
06:41:50,230 --> 06:41:51,230
the model is created by those lines. So that's
just one thing to keep in mind. Alright, let's
5828
06:41:51,230 --> 06:41:52,230
get started. So the first thing I'm going
to do is talk about how to start an end at
5829
06:41:52,230 --> 06:41:53,230
certain item at a designated area. So we're
going to go through and specify the start
5830
06:41:53,230 --> 06:41:54,230
and end points. Now there are many different
ways to do this. But we're going to start
5831
06:41:54,230 --> 06:41:55,230
with the basic sort of syntax that we should
use to set this up. And then we'll move in
5832
06:41:55,230 --> 06:41:56,230
some into some of the more advanced syntax
to set this thing up and start creating shorthands
5833
06:41:56,230 --> 06:41:57,230
and other shorts of properties. So let's go
ahead and get started. What I'm going to do
5834
06:41:57,230 --> 06:41:58,230
is select what item I want, let's just go
ahead and say the first item. And now what
5835
06:41:58,230 --> 06:41:59,230
we need to do is go ahead and set read column
like this.
5836
06:41:59,230 --> 06:42:00,230
So what I need to do from here is up whoops,
what I need to do from here is to specify
5837
06:42:00,230 --> 06:42:01,230
a start and an end point. And they are separated
by a slash. So the start point is going to
5838
06:42:01,230 --> 06:42:02,230
be the starting column line. So I'm going
to say one, and the end point is going to
5839
06:42:02,230 --> 06:42:03,230
be well, the ending, and I'm just going to
say two, or Yeah, I'm gonna say two or three.
5840
06:42:03,230 --> 06:42:04,230
For now, I'm just going to go ahead with three.
Now if I go ahead and refresh the page, you
5841
06:42:04,230 --> 06:42:05,230
can see what's going on here. Now, obviously,
it looks really weird with all of these different
5842
06:42:05,230 --> 06:42:06,230
items here, and they're being rearranged in
a different way. What's happening is we're
5843
06:42:06,230 --> 06:42:07,230
starting at line one, and then we're going
to end at line three. And you can see that
5844
06:42:07,230 --> 06:42:08,230
although it's not resizing properly, it still
does take up that space in an invisible way.
5845
06:42:08,230 --> 06:42:09,230
So we have our item two at the start of line
three, and everything is pushed right past
5846
06:42:09,230 --> 06:42:10,230
it overriding those template rows and columns
that we created. Now let's go ahead and specify
5847
06:42:10,230 --> 06:42:11,230
our next value, which is the grid row value.
So what we're going to do here is just with
5848
06:42:11,230 --> 06:42:12,230
our first one, we're going to set a start
and an end point and separate them by a slash.
5849
06:42:12,230 --> 06:42:13,230
So what I'm going to do is go ahead and say,
start at row one. And we're going to whoops,
5850
06:42:13,230 --> 06:42:14,230
and we're going to end again, let's just go
ahead and say line two, just like this. Now
5851
06:42:14,230 --> 06:42:15,230
I'm going to refresh the page. And you can
see nothing's happened because it does start
5852
06:42:15,230 --> 06:42:16,230
at one and end at two. Let's go ahead and
set three right there. So now you can see
5853
06:42:16,230 --> 06:42:17,230
what's going on here. Although it didn't,
it didn't show anything before when we had
5854
06:42:17,230 --> 06:42:18,230
one to two, because it already took up that
space. When we set it to 123, you can see
5855
06:42:18,230 --> 06:42:19,230
that everything has now been pushed again,
and the space has been separated accordingly.
5856
06:42:19,230 --> 06:42:20,230
So you can kind of see the power of this already,
you can create all sorts of layout menus and
5857
06:42:20,230 --> 06:42:21,230
sidebars, just by using this syntax alone.
And it is very powerful. But there's also
5858
06:42:21,230 --> 06:42:22,230
many different ways to do it, which we're
going to be covering over the next few videos.
5859
06:42:22,230 --> 06:42:23,230
Now instead of specifying an endpoint or an
end line. Because these can get quite confusing,
5860
06:42:23,230 --> 06:42:24,230
you don't know where line start and where
lines end. And it does get quite confusing,
5861
06:42:24,230 --> 06:42:25,230
especially when you have very big grids with
lots of different columns and rows. So instead
5862
06:42:25,230 --> 06:42:26,230
of this, you can actually specify the distance
that you want it to take up. So the keyword
5863
06:42:26,230 --> 06:42:27,230
that you can use for this is span. What this
is going to say is start at some line, whichever
5864
06:42:27,230 --> 06:42:28,230
one you choose, and span or take up a certain
amount of well spaces depending on what value
5865
06:42:28,230 --> 06:42:29,230
you're using. So for now, I'm going to say
span two, and here. I'm also going to change
5866
06:42:29,230 --> 06:42:30,230
this to span two. Now let's refresh and see
what happened. You can see that nothing has
5867
06:42:30,230 --> 06:42:31,230
changed. Of course because They are exactly
the same thing, you start at column one. And
5868
06:42:31,230 --> 06:42:32,230
you take up two more spaces, you go up two
more lines, you start at row one, and then
5869
06:42:32,230 --> 06:42:33,230
you go down two more lines. So you start at
line 112, just like that. And this is a much
5870
06:42:33,230 --> 06:42:34,230
easier way to work with grid columns and rows,
because you can kind of see what you're doing,
5871
06:42:34,230 --> 06:42:35,230
instead of just specifying start and end points
like this, you can actually kind of visualize
5872
06:42:35,230 --> 06:42:36,230
the what you're doing with your grids, and
how big you want to make your items. So that's
5873
06:42:36,230 --> 06:42:37,230
pretty much it for these different items.
Now, there are, like I said, many different
5874
06:42:37,230 --> 06:42:38,230
shorthands that you can use, which we're going
to be learning in just a few videos time.
5875
06:42:38,230 --> 06:42:39,230
But this is kind of the basic idea of specifying
these items, you can go through and you can
5876
06:42:39,230 --> 06:42:40,230
set start and end point, add points based
on the different lines and the sort of model
5877
06:42:40,230 --> 06:42:41,230
created by the grid. And then you can set
how big you want each item to be. Alright,
5878
06:42:41,230 --> 06:42:42,230
let's move on. So today we are going to be
covering or looking at the last feature of
5879
06:42:42,230 --> 06:42:43,230
our grid section. And it's pretty much just
a summary of what we did here, but using a
5880
06:42:43,230 --> 06:42:44,230
shorthand. So you can see that we have our
grid column and our grid row. So we identify
5881
06:42:44,230 --> 06:42:45,230
our starting and ending points for both axes.
But there's actually a way that you can do
5882
06:42:45,230 --> 06:42:46,230
this whole thing in one go. And usually when
you're developing what websites, you're going
5883
06:42:46,230 --> 06:42:47,230
to want to do this, you don't want to go and
do each of these properties individually.
5884
06:42:47,230 --> 06:42:48,230
For all of them, you're going to want to do
it quick and fast for both axes. And that's
5885
06:42:48,230 --> 06:42:49,230
how you get the maximum out of grid. So what
we're going to be using is something called
5886
06:42:49,230 --> 06:42:50,230
the grid area property. And just like before,
pretty much what happens is this is a shorthand
5887
06:42:50,230 --> 06:42:51,230
that summarizes these two in one property.
So it is a little bit confusing to get your
5888
06:42:51,230 --> 06:42:52,230
head around the
5889
06:42:52,230 --> 06:42:53,230
starting and ending points. So I'm just going
to go through it with you. So right now I
5890
06:42:53,230 --> 06:42:54,230
have changed this part a little bit of kind
of messed around with the column starts and
5891
06:42:54,230 --> 06:42:55,230
ends so that you can differentiate between
the values. So pretty much what the first
5892
06:42:55,230 --> 06:42:56,230
value we're going to input just like here
is going to be your row starting point. So
5893
06:42:56,230 --> 06:42:57,230
you're going to go ahead and input two in
this case, because we want to match this exactly.
5894
06:42:57,230 --> 06:42:58,230
And the next instead of your row end is actually
your column starting point. So then we're
5895
06:42:58,230 --> 06:42:59,230
going to put one. Now from here, this is where
a lot of people get mixed up and confused.
5896
06:42:59,230 --> 06:43:00,230
Pretty much what's happening is just how like
with margin, you go top right, bottom left,
5897
06:43:00,230 --> 06:43:01,230
or with any other kind of property that deals
with those kind of multiple value scenarios,
5898
06:43:01,230 --> 06:43:02,230
what's going to happen here is you have the
row column start, and then you have the row
5899
06:43:02,230 --> 06:43:03,230
column. And so just keep that in mind. And
everything will work out for you. So all you
5900
06:43:03,230 --> 06:43:04,230
have to do is go ahead and say two, one. And
now we're going to put our row end. Remember,
5901
06:43:04,230 --> 06:43:05,230
we have row start column, start row end, and
then column end. So here we're gonna put span
5902
06:43:05,230 --> 06:43:06,230
to Now remember, this can be a span value,
or an end value, it doesn't actually matter.
5903
06:43:06,230 --> 06:43:07,230
So you can do whatever you want here. And
then of course, the column ending value, which
5904
06:43:07,230 --> 06:43:08,230
in this case is span three. Should now what
we're going to do is go ahead and and just
5905
06:43:08,230 --> 06:43:09,230
comment these out for now and see if anything
has changed. And you can see, of course, it
5906
06:43:09,230 --> 06:43:10,230
hasn't. Since we pretty much summarize this
into our shorthand, we don't actually have
5907
06:43:10,230 --> 06:43:11,230
a use for these anymore, so I'm going to go
ahead and get rid of them. So now that you
5908
06:43:11,230 --> 06:43:12,230
know how to do it, let's talk about some of
the benefits of this. Now, when you're creating
5909
06:43:12,230 --> 06:43:13,230
a grid, you're creating a huge practical system,
most likely, you're going to be organizing
5910
06:43:13,230 --> 06:43:14,230
pages into headers, and sidebars, and all
sorts of things. And you don't want to go
5911
06:43:14,230 --> 06:43:15,230
and input those two for each one, it gets
a little bit confusing after a while. So it's
5912
06:43:15,230 --> 06:43:16,230
much easier if you just have one property
that can summarize both the column and the
5913
06:43:16,230 --> 06:43:17,230
row in one clean swoop. And then you can apply
them to all of your different pieces. So your
5914
06:43:17,230 --> 06:43:18,230
sidebar would go and start and end here, then
your header would go here and you get the
5915
06:43:18,230 --> 06:43:19,230
idea. So that's pretty much it for grids and
grid area, there's a lot to cover. And of
5916
06:43:19,230 --> 06:43:20,230
course, practice makes perfect with these
kinds of things. But the more you use it,
5917
06:43:20,230 --> 06:43:21,230
the more you will understand how to sort of
work with it and play around with some of
5918
06:43:21,230 --> 06:43:22,230
the tricks that really get grid to work properly.
Now these tricks can't really be taught, because,
5919
06:43:22,230 --> 06:43:23,230
of course, they're personal to the user, the
developer and what kind of work they're doing.
5920
06:43:23,230 --> 06:43:24,230
So there's always shortcuts and all sorts
of little tricks you can use with these properties
5921
06:43:24,230 --> 06:43:25,230
to really lay out your website related to
your special field of development or work.
5922
06:43:25,230 --> 06:43:26,230
Alright, let's move on. So this is going to
be starting a brand new section. And we're
5923
06:43:26,230 --> 06:43:27,230
actually going to be looking at a very cool
and useful feature in CSS. Now, of course,
5924
06:43:27,230 --> 06:43:28,230
this isn't a very old or considered a essential
feature, but it's still very useful. And it
5925
06:43:28,230 --> 06:43:29,230
can help you make your website look a lot
better. So in this section, we're going to
5926
06:43:29,230 --> 06:43:30,230
be covering everything to do with movement
on your page. So things like animations, transitions,
5927
06:43:30,230 --> 06:43:31,230
and some other features that you can use to
sort of change the way your website looks
5928
06:43:31,230 --> 06:43:32,230
without actually changing it, in a sense.
Now, of course, this will make a lot more
5929
06:43:32,230 --> 06:43:33,230
sense once we go forward and start working
with some of the properties. But the first
5930
06:43:33,230 --> 06:43:34,230
one I want to talk about in this video is
our transition property. So there is a lot
5931
06:43:34,230 --> 06:43:35,230
to cover in this video. And transition is
actually a shorthand for four different properties.
5932
06:43:35,230 --> 06:43:36,230
So there's going to be a lot to work with
and talk about, so I'm going to go through
5933
06:43:36,230 --> 06:43:37,230
it a little bit slow. But once you get to
the end of this video, you'll understand everything
5934
06:43:37,230 --> 06:43:38,230
about transitions and how to work with them.
Now you can see I've touched up this website
5935
06:43:38,230 --> 06:43:39,230
a little bit using any all of the skills that
we've learned in this section selectors, displays,
5936
06:43:39,230 --> 06:43:40,230
margins, all sorts of things like that, including
styling the button just with a little creativity.
5937
06:43:40,230 --> 06:43:41,230
And now we have our page kind of a little
bit better laid out for our animation. So
5938
06:43:41,230 --> 06:43:42,230
the main part that we're going to be focusing
on is our contact us section, and notably
5939
06:43:42,230 --> 06:43:43,230
our Submit button. So this is the main kind
of focus piece of this section. So pretty
5940
06:43:43,230 --> 06:43:44,230
much right now we have a static page, there's
nothing moving nothing changing positions
5941
06:43:44,230 --> 06:43:45,230
or properties or anything like that. And right
now, what I want to do is focus on the submit
5942
06:43:45,230 --> 06:43:46,230
button to create some transitions. Now pretty
much what's going to happen is we're going
5943
06:43:46,230 --> 06:43:47,230
to use pseudo selectors to change the state
of this button.
5944
06:43:47,230 --> 06:43:48,230
Or change some of the properties in it. So
for example, the background or the text color,
5945
06:43:48,230 --> 06:43:49,230
or anything like that, and then we're going
to use the transition property to make it
5946
06:43:49,230 --> 06:43:50,230
appear smooth. So that's one thing to keep
in mind, the transition property itself isn't
5947
06:43:50,230 --> 06:43:51,230
that big of a deal. But the real work goes
behind the pseudo selectors and how you use
5948
06:43:51,230 --> 06:43:52,230
them. So let's get started. The first thing
I want to do is use a pseudo selector to change.
5949
06:43:52,230 --> 06:43:53,230
Let's just go with the background for now.
So what I'm going to do is use my class that
5950
06:43:53,230 --> 06:43:54,230
I added, you can go ahead and add this on
your own if you're following along. And then
5951
06:43:54,230 --> 06:43:55,230
I'm going to use a pseudo selector. And I'm
just going to say for now, let's go with hover,
5952
06:43:55,230 --> 06:43:56,230
which is a pretty common pseudo selector.
Now, just to test this, that this works, I'm
5953
06:43:56,230 --> 06:43:57,230
going to change the color to black, because
again, there could always be issues. Let's
5954
06:43:57,230 --> 06:43:58,230
refresh hover, it's black, you can see that
it's already working, it's just not smooth.
5955
06:43:58,230 --> 06:43:59,230
So let's go through and start changing some
of these properties. What I'm going to do
5956
06:43:59,230 --> 06:44:00,230
is change the background to a lighter shade,
I'm actually going to just use the color picker
5957
06:44:00,230 --> 06:44:01,230
here, I'm going to go ahead and use a lighter
shade of blue, something that would indicate
5958
06:44:01,230 --> 06:44:02,230
that you're hovering over. So I'm going to
go ahead and do that. And for now, we're just
5959
06:44:02,230 --> 06:44:03,230
going to stick with one property. Well, once
we go forward, we're actually going to add
5960
06:44:03,230 --> 06:44:04,230
more and more properties to make it look a
lot cleaner. Let's go ahead and refresh. See
5961
06:44:04,230 --> 06:44:05,230
if that works, you can see that it is a much
lighter shade. And it looks like a proper
5962
06:44:05,230 --> 06:44:06,230
hover on a website. So let's get started.
Now we have our Submit button or our base
5963
06:44:06,230 --> 06:44:07,230
class, the one that's always active, and our
special pseudo class, which kind of uses specificity
5964
06:44:07,230 --> 06:44:08,230
to override our base class in certain conditions,
in this case, the hover. Now what we're going
5965
06:44:08,230 --> 06:44:09,230
to do is add our transition property. So what
we do is go to our base class. And we're going
5966
06:44:09,230 --> 06:44:10,230
to set our transition property here. And now
we have a bunch of different values to input.
5967
06:44:10,230 --> 06:44:11,230
The first is going to be the property that
you want to well transition because remember,
5968
06:44:11,230 --> 06:44:12,230
the property is basically going to smooth
it out and move the property on one hand and
5969
06:44:12,230 --> 06:44:13,230
from the base class slowly to the other in
a nice, clean, automated way. So if you want
5970
06:44:13,230 --> 06:44:14,230
to select all of your properties, you can
just hit all, but I wouldn't recommend that
5971
06:44:14,230 --> 06:44:15,230
unless you unless you want to shorten things
or smooth over time, because sometimes your
5972
06:44:15,230 --> 06:44:16,230
classes can change. And it can cause errors
in the long run. So what I would do is for
5973
06:44:16,230 --> 06:44:17,230
now I'm just going to select the specific
property that I want. Next thing I want to
5974
06:44:17,230 --> 06:44:18,230
talk about is the duration. So this is pretty
much the time it's going to take to move from
5975
06:44:18,230 --> 06:44:19,230
one property or one value to the other. Now
this can be anything. Now you would specify
5976
06:44:19,230 --> 06:44:20,230
this in seconds or milliseconds depending
on what you want to choose. I'm going to go
5977
06:44:20,230 --> 06:44:21,230
ahead and use seconds. So I'm going to say
two seconds. And s by the way is the unit
5978
06:44:21,230 --> 06:44:22,230
for seconds in case you didn't know. The next
we want to go is talk about the sort of transition
5979
06:44:22,230 --> 06:44:23,230
style So this is probably the most complicated
thing to work with, because there's a lot
5980
06:44:23,230 --> 06:44:24,230
of different styles and haven't really used
them in daily life. But it's pretty easy.
5981
06:44:24,230 --> 06:44:25,230
Pretty much what you're going to do is decide
what kind of a change do you want? Do you
5982
06:44:25,230 --> 06:44:26,230
want it to go straight from A to B? Do you
want it to be smooth or speedy. And what I'm
5983
06:44:26,230 --> 06:44:27,230
going to do is just run through some of the
main ones you have here. So the first one,
5984
06:44:27,230 --> 06:44:28,230
and the most common one is going to be ease
typing is, and pretty much what this does
5985
06:44:28,230 --> 06:44:29,230
is it's kind of the standard transition, it
goes is it goes straight from A to B, then
5986
06:44:29,230 --> 06:44:30,230
you have linear, which is not very commonly
used, especially in transitions. But it just
5987
06:44:30,230 --> 06:44:31,230
goes straight from A to B without any, you
know, speed changes or anything like
5988
06:44:31,230 --> 06:44:32,230
that.
5989
06:44:32,230 --> 06:44:33,230
And you also have a couple more, there is
one called ease in out like this. And you
5990
06:44:33,230 --> 06:44:34,230
can pretty much just read this a name, it
goes it eases using the previous one that
5991
06:44:34,230 --> 06:44:35,230
I just talked about. But of course in that
5992
06:44:35,230 --> 06:44:36,230
order.
5993
06:44:36,230 --> 06:44:37,230
So those are pretty much the three, or the
sorry, the four common ones that you would
5994
06:44:37,230 --> 06:44:38,230
use. And of course, there's a bunch more,
but these are really the main ones that you
5995
06:44:38,230 --> 06:44:39,230
would work with here. So pretty much let's
start working with our transition property
5996
06:44:39,230 --> 06:44:40,230
here. So I'm actually going to go with ease
and out just to spice it up a little bit,
5997
06:44:40,230 --> 06:44:41,230
not use the basic ones. And then the last
property that we're going to select is the
5998
06:44:41,230 --> 06:44:42,230
delay. So pretty much what's going to happen
is when you hover over it right now there's
5999
06:44:42,230 --> 06:44:43,230
no delay, it's zero seconds, the animation
plays instantly. Or what you can actually
6000
06:44:43,230 --> 06:44:44,230
do is set a delay that you can use to let's
just say after you hover, wait two seconds,
6001
06:44:44,230 --> 06:44:45,230
and then play the animation. So let's just
go ahead and set a delay of one second. And
6002
06:44:45,230 --> 06:44:46,230
that offer the semicolon a lot to digest there,
I know. But um, don't worry about it just
6003
06:44:46,230 --> 06:44:47,230
leave, it's just keep it there for now. And
if you don't understand it, we'll break it
6004
06:44:47,230 --> 06:44:48,230
down and do some more examples. Let's go ahead
and refresh the page. So what I'm going to
6005
06:44:48,230 --> 06:44:49,230
do is hover over my button here, you can see
that it's going to wait whoops. So I'm going
6006
06:44:49,230 --> 06:44:50,230
to hover over. Now we're going to wait. And
you can see after one second, it turns into
6007
06:44:50,230 --> 06:44:51,230
that kind of shade that we want it. Now I
feel like we're going to remove that one second
6008
06:44:51,230 --> 06:44:52,230
delay, because we don't need it. And I'm actually
going to shorten this down 2.5 seconds. Now
6009
06:44:52,230 --> 06:44:53,230
what I want to do is refresh the page. And
now you can see it's a lot faster. Now once
6010
06:44:53,230 --> 06:44:54,230
you get into this range of one, you want to
start using milliseconds. So we're going to
6011
06:44:54,230 --> 06:44:55,230
go 300 ms, which is milliseconds.
6012
06:44:55,230 --> 06:44:56,230
Let's refresh the
6013
06:44:56,230 --> 06:44:57,230
page. And like I said, just play around with
this tinker with it and see how it works.
6014
06:44:57,230 --> 06:44:58,230
So you can see when we do this, that it changes
the color. And when we hover over it changes
6015
06:44:58,230 --> 06:44:59,230
back. So now you can see the difference between
not having a transition and having it. Let's
6016
06:44:59,230 --> 06:45:00,230
comment this out for a second. And you can
see how that works. Without the transition,
6017
06:45:00,230 --> 06:45:01,230
it looks kind of jarring and quick and sharp.
It doesn't really look appealing. But when
6018
06:45:01,230 --> 06:45:02,230
you add that transition, it just completely
changes everything. Now why don't we go ahead
6019
06:45:02,230 --> 06:45:03,230
and try out some of the other styles because
it's much easier to show you how these styles
6020
06:45:03,230 --> 06:45:04,230
works, rather than just explaining them. So
let's go ahead and see linear.
6021
06:45:04,230 --> 06:45:05,230
So
6022
06:45:05,230 --> 06:45:06,230
pretty much what's going to happen, it just
goes straight from A to B, no speech changes
6023
06:45:06,230 --> 06:45:07,230
or anything. Of course, with something this
small, it's not very noticeable. But when
6024
06:45:07,230 --> 06:45:08,230
you have translations and all these different
changes, then it will definitely be noticeable.
6025
06:45:08,230 --> 06:45:09,230
So there you go, you have a linear transition
there. Now let's go ahead and try our ease
6026
06:45:09,230 --> 06:45:10,230
transition, refresh it. And you can see that
it is a lot faster. And like I said, not very
6027
06:45:10,230 --> 06:45:11,230
noticeable. But we can see a clear difference
in the speed and agility or what not agility
6028
06:45:11,230 --> 06:45:12,230
but the kind of curves of the transition,
it starts out very fast in towards the middle
6029
06:45:12,230 --> 06:45:13,230
and gets a little bit slower. And then towards
the end, it's much faster. Now of course,
6030
06:45:13,230 --> 06:45:14,230
it would be easier to demonstrate if it wasn't
300 milliseconds. Let's go ahead and see this
6031
06:45:14,230 --> 06:45:15,230
when it is on a higher time, so you can see
kind of how that works there. So there we
6032
06:45:15,230 --> 06:45:16,230
go. Those are the different types of transition
types. That's probably the hardest property
6033
06:45:16,230 --> 06:45:17,230
to or sorry value to work with. And then after
that, everything becomes a lot
6034
06:45:17,230 --> 06:45:18,230
simpler.
6035
06:45:18,230 --> 06:45:19,230
So now let's go ahead and start adding some
more properties here to make this a little
6036
06:45:19,230 --> 06:45:20,230
bit more interesting. I'm going to go ahead
and add some padding. So I'm going to say
6037
06:45:20,230 --> 06:45:21,230
when it's hovered over pretty much double
the padding, so 20 pixels, 30 pixels. Now
6038
06:45:21,230 --> 06:45:22,230
here, what we're going to do is either use
a comma to separate the different property
6039
06:45:22,230 --> 06:45:23,230
That we want to use. Or we can just erase
all of this and say all. Now we refresh it.
6040
06:45:23,230 --> 06:45:24,230
And you can see that that gets a lot bigger,
let's change that back to about 500 milliseconds.
6041
06:45:24,230 --> 06:45:25,230
Make that a lot shorter. And now you can see
it gets bigger. On top of that, the sorry,
6042
06:45:25,230 --> 06:45:26,230
the background changes. Now, of course, you
can do so many different changes with this,
6043
06:45:26,230 --> 06:45:27,230
you can maybe change the color, the font size,
even the weight. And once we learn some of
6044
06:45:27,230 --> 06:45:28,230
the translation, or sorry, transformation
functions, we can do a lot more with it. But
6045
06:45:28,230 --> 06:45:29,230
for now, we need to stick with the basics
of the transition concept. So before we move
6046
06:45:29,230 --> 06:45:30,230
on, there's one thing I need to talk about.
And those are the prefixes that we need to
6047
06:45:30,230 --> 06:45:31,230
use for browser support. So I think is with
much newer CSS versions is that not all browsers
6048
06:45:31,230 --> 06:45:32,230
support them, they all compile in a different
way. And some of them don't support these
6049
06:45:32,230 --> 06:45:33,230
newer properties, especially in the older
version. So for example, Internet Explorer
6050
06:45:33,230 --> 06:45:34,230
seven, Internet Explorer eight, all of those
very old browsers, which people still use,
6051
06:45:34,230 --> 06:45:35,230
won't be able to see this property. Now you
have two solutions to this, either use a fallback,
6052
06:45:35,230 --> 06:45:36,230
which is you know, if the transition doesn't
work, just maybe have a fallback image or
6053
06:45:36,230 --> 06:45:37,230
don't play it at all. Or you can use a browser
support prefix. So each one or each type of
6054
06:45:37,230 --> 06:45:38,230
browser has a different prefix, but the main
ones are for Chrome and Safari, we need to
6055
06:45:38,230 --> 06:45:39,230
use WebKit, like this. And remember, you need
to start it with a dash and end it with a
6056
06:45:39,230 --> 06:45:40,230
dash like this. Then you one for Mozilla Firefox
is going to be dash m o z. And then of course,
6057
06:45:40,230 --> 06:45:41,230
for some of the other browsers like opera,
you would use Oh, whoops, online, would you
6058
06:45:41,230 --> 06:45:42,230
Oh, for that. And those are pretty much the
three main ones. Now. WebKit is pretty much
6059
06:45:42,230 --> 06:45:43,230
an essential, it covers two browsers at once.
Now, of course, and result is also still important.
6060
06:45:43,230 --> 06:45:44,230
opera is important, but not as important as
these other two. Now one thing you need to
6061
06:45:44,230 --> 06:45:45,230
note is you can't just string these together,
you can't go dash WebKit dash smalls dash
6062
06:45:45,230 --> 06:45:46,230
O, you have to use separate property. So you
have to go and copy each one, and it is a
6063
06:45:46,230 --> 06:45:47,230
pain. But if you want the maximum browser
support, you need to do this. So of course,
6064
06:45:47,230 --> 06:45:48,230
if we refresh the page, nothing's gonna happen
here. But anybody who's using an older browser,
6065
06:45:48,230 --> 06:45:49,230
if I was testing this on maybe Internet Explorer
seven, would see a clear difference between
6066
06:45:49,230 --> 06:45:50,230
before and after we added these browser support
prefixes. So that's pretty much it for transitions.
6067
06:45:50,230 --> 06:45:51,230
Now, there is a lot to cover, and we will
work with them throughout the future. But
6068
06:45:51,230 --> 06:45:52,230
all you need to do is go ahead, select pretty
much any element you want, and start playing
6069
06:45:52,230 --> 06:45:53,230
around with it, add some different properties,
maybe go and change the pseudo selector. So
6070
06:45:53,230 --> 06:45:54,230
for example, if you want it to be active or
something like that, or if you click it, you
6071
06:45:54,230 --> 06:45:55,230
want to change some of these properties. There's
a bunch of pseudo selectors out there. And
6072
06:45:55,230 --> 06:45:56,230
combining that with the transition property
and the skills you've learned in CSS, you
6073
06:45:56,230 --> 06:45:57,230
can really make this website or whatever website
you're working on interactive, without even
6074
06:45:57,230 --> 06:45:58,230
having to learn any animation, or proper transformation
properties. Alright, let's move on. So in
6075
06:45:58,230 --> 06:45:59,230
this video, we're going to be covering different
transform properties. And this is going to
6076
06:45:59,230 --> 06:46:00,230
be quite a long video. Just like the transition
video, we do have a lot to cover. There's
6077
06:46:00,230 --> 06:46:01,230
many different values and functions that we
need to use to complete this. But it is a
6078
06:46:01,230 --> 06:46:02,230
pretty essential step of this section. So
let's just get straight into it. So firstly,
6079
06:46:02,230 --> 06:46:03,230
what we're going to be using in this video
are actually not values, their functions.
6080
06:46:03,230 --> 06:46:04,230
Now, just like this RGB thing is a function
that takes a bunch of inputs and gets a value
6081
06:46:04,230 --> 06:46:05,230
out. Or maybe something else. Well, it seems
like this is the only one on the page. But
6082
06:46:05,230 --> 06:46:06,230
what we're going to be doing is using a bunch
of functions that take in inputs, and actually
6083
06:46:06,230 --> 06:46:07,230
physically change what this is on the page.
Now obviously, all of these do physically
6084
06:46:07,230 --> 06:46:08,230
change what they are on the page. But instead
of inputting absolute or direct values, this
6085
06:46:08,230 --> 06:46:09,230
kind of processes in a different way behind
the scenes. So let's just jump straight into
6086
06:46:09,230 --> 06:46:10,230
it. First thing we need to learn is the property.
Now we're going to use our button again, and
6087
06:46:10,230 --> 06:46:11,230
I'm going to be using a value called transform.
So what we're going to do is plug in a bunch
6088
06:46:11,230 --> 06:46:12,230
of different values in here and see how it
affects this. So pretty much we have two different
6089
06:46:12,230 --> 06:46:13,230
sections of this video, we have our physical
change properties or our movement, so our
6090
06:46:13,230 --> 06:46:14,230
translation and our scaling, and then we also
have our different rotation properties, or
6091
06:46:14,230 --> 06:46:15,230
Well, I should say functions, but there we
go. So we're going to have our Translation
6092
06:46:15,230 --> 06:46:16,230
in our scale, so our physical changes, and
then our rotation. And at the end, I'm going
6093
06:46:16,230 --> 06:46:17,230
to throw in a nice shorthand function that
summarizes all of it. So let's start with
6094
06:46:17,230 --> 06:46:18,230
our physical changes. So the first thing we
need to learn about is translate. So we're
6095
06:46:18,230 --> 06:46:19,230
only going to be covering 2d translations
for today, because 3d can get very complicated
6096
06:46:19,230 --> 06:46:20,230
very quick. And it's not really useful in
day to day life or developer life, unless
6097
06:46:20,230 --> 06:46:21,230
you're making something that specifically
needs it. So we're just going to cover 2d
6098
06:46:21,230 --> 06:46:22,230
translations, and other function transformation
functions for
6099
06:46:22,230 --> 06:46:23,230
today.
6100
06:46:23,230 --> 06:46:24,230
So pretty much what this is going to do is
taken two different values, one of them is
6101
06:46:24,230 --> 06:46:25,230
going to be the Y shift and the x shift. And
it's going to actually shift physically shift
6102
06:46:25,230 --> 06:46:26,230
the elements to that position. So for example,
if you said, I want to move this button or
6103
06:46:26,230 --> 06:46:27,230
this image a little bit to the left, and I
wanted to move, or let's just say 10 pixels
6104
06:46:27,230 --> 06:46:28,230
to the left, and I wanted to move it 10 pixels
up, it would do that. And of course, there
6105
06:46:28,230 --> 06:46:29,230
are many different ways to do it. But what
we're going to do is use this translate method
6106
06:46:29,230 --> 06:46:30,230
to really change the way that this whole thing
works. So what we're going to do is are we're
6107
06:46:30,230 --> 06:46:31,230
going to use an alternative method to you
know, something like margin or grid or all
6108
06:46:31,230 --> 06:46:32,230
of those. So the first thing you want to do
is specify the x axis value. Now, in case
6109
06:46:32,230 --> 06:46:33,230
you haven't, you know, learned about graphs,
or you maybe forgot it, pretty much, what
6110
06:46:33,230 --> 06:46:34,230
happens is the x axis is going to be your
left and your right shift, right is going
6111
06:46:34,230 --> 06:46:35,230
to be your positive value, so anything above
zero, and if you want to shift it left, you
6112
06:46:35,230 --> 06:46:36,230
use negative values. And then of course, the
second value is the y axis. So up as positive
6113
06:46:36,230 --> 06:46:37,230
and down is negative. So let's start with
our x shift, I'm going to just go ahead and
6114
06:46:37,230 --> 06:46:38,230
say 50 pixels here. So I want to shift it
pick 50 pixels to the right. And remember,
6115
06:46:38,230 --> 06:46:39,230
we don't need we need to, we don't need to
say anything like to write or anything like
6116
06:46:39,230 --> 06:46:40,230
that, we just need to specify the value, then
we throw in a comma. And here, what we're
6117
06:46:40,230 --> 06:46:41,230
going to do is add our Y axis shift. So here,
I'm also going to say, let's just go with
6118
06:46:41,230 --> 06:46:42,230
30 pixels, refresh the page, see what happens.
Now, we can see here that it's actually staying
6119
06:46:42,230 --> 06:46:43,230
exactly the same. It's not moving. It's not
changing anything here. But you can see that
6120
06:46:43,230 --> 06:46:44,230
when we hover over it, it does actually move.
So what's going on here. Now, here's where
6121
06:46:44,230 --> 06:46:45,230
you have to be careful about where you add
your properties, you can see that I added
6122
06:46:45,230 --> 06:46:46,230
it to our pseudo selector instead of our base
class. And that's one thing or one point I
6123
06:46:46,230 --> 06:46:47,230
just wanted to make about these pseudo selectors
is that if you add them on, maybe here, it's
6124
06:46:47,230 --> 06:46:48,230
not just going to inherit it magically and
put it on the base class, you do need to be
6125
06:46:48,230 --> 06:46:49,230
specific. Remember, these two are completely
different classes, it's just that some of
6126
06:46:49,230 --> 06:46:50,230
them are being overridden. So for example,
our background and our padding already exist.
6127
06:46:50,230 --> 06:46:51,230
So what happens is that all of these styles
are already applied. And then the new styles
6128
06:46:51,230 --> 06:46:52,230
here are overridden. But this is a completely
new property, it doesn't actually
6129
06:46:52,230 --> 06:46:53,230
exist on our base class. So just make sure
that you don't make that mistake. Let's go
6130
06:46:53,230 --> 06:46:54,230
ahead and paste that on the base class. I'll
do it just above the transitions. Now refresh
6131
06:46:54,230 --> 06:46:55,230
the page, and it's translated perfectly. So
now that we've done that, I want to talk about
6132
06:46:55,230 --> 06:46:56,230
browser support for a second. Now all of these
are very new features to CSS, you do need
6133
06:46:56,230 --> 06:46:57,230
to make sure that you add your browser prefixes.
So WebKit, mas, and O. Now, I'm not going
6134
06:46:57,230 --> 06:46:58,230
to go through and add it for all of them.
I'm just going to leave it blank for now.
6135
06:46:58,230 --> 06:46:59,230
But you need to keep in mind that if you want
the maximum support on your on your page on
6136
06:46:59,230 --> 06:47:00,230
your site, you want to make sure you include
those prefixes. So there we go, we've covered
6137
06:47:00,230 --> 06:47:01,230
it translates. Now let's work with our next
value, which is going to be scale. So scale
6138
06:47:01,230 --> 06:47:02,230
works in a similar way to how maybe increasing
the padding would work. What's gonna happen
6139
06:47:02,230 --> 06:47:03,230
is you're going to go and you're going to
type in scale, which is the name of the function,
6140
06:47:03,230 --> 06:47:04,230
and then you're going to pass in a decimal
value, it doesn't have to be a decimal, but
6141
06:47:04,230 --> 06:47:05,230
pretty much what you're going to do is just
say, let's say I want to scale this up by
6142
06:47:05,230 --> 06:47:06,230
two and a half times, what's gonna happen
is this is going to size up by two and a half,
6143
06:47:06,230 --> 06:47:07,230
we refresh, you can see that it's gotten a
lot bigger, and padding and all of that it
6144
06:47:07,230 --> 06:47:08,230
doesn't really apply or change anything here.
It just scales everything up by two and a
6145
06:47:08,230 --> 06:47:09,230
half. So you can obviously see some of the
issues here with margin and padding and all
6146
06:47:09,230 --> 06:47:10,230
sorts of things like this. So be pretty careful
when you do this. You don't want to mess up
6147
06:47:10,230 --> 06:47:11,230
your page or change your style, or anything
like that. You just want to make sure that
6148
06:47:11,230 --> 06:47:12,230
you can scale without having to to mess with
the layout of your page. So that's for scale,
6149
06:47:12,230 --> 06:47:13,230
and all of the physical properties. Now let's
move on to some of the rotation properties.
6150
06:47:13,230 --> 06:47:14,230
So the first two, we're going to cover or
sorry, the first one I'm going to cover is
6151
06:47:14,230 --> 06:47:15,230
pretty simple. It's just a standard rotate.
But then after that, I'm going to cover two
6152
06:47:15,230 --> 06:47:16,230
really special ones, which are actually skewing
on different axes. So we'll get to that in
6153
06:47:16,230 --> 06:47:17,230
just a second. Let's refresh the page. So
the first one I'm going to use is rotate,
6154
06:47:17,230 --> 06:47:18,230
and this takes one value, obviously, it's
going to be our degree value. So if you don't
6155
06:47:18,230 --> 06:47:19,230
remember from our gradient section, what happens
pretty much here is we rotated kind of circularly.
6156
06:47:19,230 --> 06:47:20,230
Well, not for this one. But we can use degrees
to actually change the angle or direction
6157
06:47:20,230 --> 06:47:21,230
of our gradient. So for example, 90 degrees
B, a 90 degree shift, so would go to the right,
6158
06:47:21,230 --> 06:47:22,230
and then negative 90 degrees would go the
other way. So it would go to the left. So
6159
06:47:22,230 --> 06:47:23,230
if you just remember that you'd be doing great
here. So let's just say I wanted to use minus
6160
06:47:23,230 --> 06:47:24,230
45 degrees, and remember the symbol for it.
So what's gonna happen pretty much this is
6161
06:47:24,230 --> 06:47:25,230
going to shift slightly, or will not shift,
but it's going to rotate. And you can see
6162
06:47:25,230 --> 06:47:26,230
what happens there. Now, if this was minus
90, it will pretty much flip. So it was facing
6163
06:47:26,230 --> 06:47:27,230
up vertically. And I'll actually show you
that now. But pretty much what you're doing
6164
06:47:27,230 --> 06:47:28,230
here is just rotating it around it center,
and changing the rotation of it. Pretty simple,
6165
06:47:28,230 --> 06:47:29,230
pretty easy to use. So now let's talk about
the two special ones. So pretty much what's
6166
06:47:29,230 --> 06:47:30,230
going to happen here is they're going to skew
them along certain axes. Now, this is really
6167
06:47:30,230 --> 06:47:31,230
hard to explain. And most likely, nobody will
get it if it explained. So the only real way
6168
06:47:31,230 --> 06:47:32,230
to show it or the only real way to teach it
is by showing it. So what I'm going to do
6169
06:47:32,230 --> 06:47:33,230
is use skew. And you can see we have our shorthand
and we also have skew x and skew y. So what
6170
06:47:33,230 --> 06:47:34,230
I'm going to select this skew x first, and
pretty much this is going to shift it or rotate
6171
06:47:34,230 --> 06:47:35,230
it along the x axis instead of its center.
So remember, the X is kind of
6172
06:47:35,230 --> 06:47:36,230
a horizontal rod. So just kind of imagine
a stick or a paper attached to a rod and you're
6173
06:47:36,230 --> 06:47:37,230
rotating it around that rod. So now let's
go ahead and input our value just like before,
6174
06:47:37,230 --> 06:47:38,230
we're going to use degree values. So I'm going
to go 45 degrees positive, we refresh the
6175
06:47:38,230 --> 06:47:39,230
page. And obviously, it looks quite weird,
because it's pretty hard to simulate these
6176
06:47:39,230 --> 06:47:40,230
kinds of things. But you can see that pretty
much what this has happened is rotated along
6177
06:47:40,230 --> 06:47:41,230
that axis. So if I go negative 45, it's going
to go the other way, just like that. And you
6178
06:47:41,230 --> 06:47:42,230
can kind of see how that works. Now if we
change this to skew y, it's going to go it's
6179
06:47:42,230 --> 06:47:43,230
going to do this exact same thing. But it's
going to be on the opposite axis. So it's
6180
06:47:43,230 --> 06:47:44,230
going to be on a vertical rod. So just imagine
that, refresh the page, and you can see how
6181
06:47:44,230 --> 06:47:45,230
that is working. Now obviously, it is very
hard to see and visualize. So I wouldn't encourage
6182
06:47:45,230 --> 06:47:46,230
you to use skew X or Y. If you want to rotate
something you should most likely stick or
6183
06:47:46,230 --> 06:47:47,230
you should try and stick to the three I just
covered. So the last value we're going to
6184
06:47:47,230 --> 06:47:48,230
be talking about or the last function is going
to be our matrix function. So this is going
6185
06:47:48,230 --> 06:47:49,230
to be a shorthand to summarize everything
into one go. And pretty much from here, what
6186
06:47:49,230 --> 06:47:50,230
we're going to do is pretty much just summarize
everything in one clean swoop. So pretty much
6187
06:47:50,230 --> 06:47:51,230
this takes six arguments. And one thing you
do have to note is it doesn't take rotation
6188
06:47:51,230 --> 06:47:52,230
into account, it only works with skews, so
you just have to keep that in mind. If you're
6189
06:47:52,230 --> 06:47:53,230
planning to rotate it, you should probably
add that as a as another function. So let's
6190
06:47:53,230 --> 06:47:54,230
get started. What we're going to do is go
ahead and work with our matrix function. So
6191
06:47:54,230 --> 06:47:55,230
we're going to erase this. And we're going
to go ahead and add our matrix. Now these
6192
06:47:55,230 --> 06:47:56,230
six arguments do follow a very, very specific
pattern or a order. So we're going to have
6193
06:47:56,230 --> 06:47:57,230
to go through it slowly so that you can understand
it. And it is a little bit out of order, logically,
6194
06:47:57,230 --> 06:47:58,230
so we're just going to take our time this.
Now the first value is going to be your x
6195
06:47:58,230 --> 06:47:59,230
scale. Now one thing I forgot to mention is
that we were actually using shorthand. shorthand
6196
06:47:59,230 --> 06:48:00,230
functions to avoid all the mess with scale
x and scale y and just shorten things up.
6197
06:48:00,230 --> 06:48:01,230
So one thing you do need to keep in mind is
that every scale component or function like
6198
06:48:01,230 --> 06:48:02,230
this will have an x and a y value. And what
we pretty much did is summarize them down
6199
06:48:02,230 --> 06:48:03,230
into one or into those shorthand functions.
So we can just do it really easily. But here
6200
06:48:03,230 --> 06:48:04,230
it's actually split up into different functions.
So let's To start with our scale x. Now one
6201
06:48:04,230 --> 06:48:05,230
thing to note is that if you want to keep
it the same, all you have to do is input one,
6202
06:48:05,230 --> 06:48:06,230
pretty much this is not typing pretty much
what this is going to happen. Or what this
6203
06:48:06,230 --> 06:48:07,230
is going to do is say set this button or object
or element one times as big as itself, which
6204
06:48:07,230 --> 06:48:08,230
is, of course, just going to result in the
same. So the next is your skew y and your
6205
06:48:08,230 --> 06:48:09,230
skew x. Now if you don't want to do anything,
you set it to zero. But if you do want to
6206
06:48:09,230 --> 06:48:10,230
skew it along the axes, you do have to use
decimal
6207
06:48:10,230 --> 06:48:11,230
decimal values here. And one thing also to
note is that you don't have to include the
6208
06:48:11,230 --> 06:48:12,230
unit's like we did before. So no PX or mm
or dagger do anything like that, you just
6209
06:48:12,230 --> 06:48:13,230
include the numbers. So you do include decimal
points here. So I'm just going to go quick
6210
06:48:13,230 --> 06:48:14,230
45 on both of these. And remember, this is
actually 45 degrees, so keep that in mind.
6211
06:48:14,230 --> 06:48:15,230
Next thing we're going to do is input our
scale y. So again, you do have scale x and
6212
06:48:15,230 --> 06:48:16,230
scale y, if you want to keep it the same,
set it to one, and then you have your translate
6213
06:48:16,230 --> 06:48:17,230
x and translate y. So I'm going to say 100
pixels. Whoops, 150. Remember, pixels pixels.
6214
06:48:17,230 --> 06:48:18,230
So this is a little bit confusing, but it's
don't try not to use it that much only use
6215
06:48:18,230 --> 06:48:19,230
it if you really have to, or if you want to
shorten code down. But I would recommend not
6216
06:48:19,230 --> 06:48:20,230
using this function very often. It's quite
clunky and ordered, and it doesn't really
6217
06:48:20,230 --> 06:48:21,230
allow for freedom. So just keep that in mind
when you're using it. Let's refresh. And you
6218
06:48:21,230 --> 06:48:22,230
can see our new item here scaling is, of course,
the same it shifted on the x and y axes. So
6219
06:48:22,230 --> 06:48:23,230
you can see that here, it doesn't create that
rotation that you may be expecting, because
6220
06:48:23,230 --> 06:48:24,230
remember, it is a skew on individual axes.
Just remember that. And of course, our scale
6221
06:48:24,230 --> 06:48:25,230
on the x and y is one, our translation of
x is 100. So it's about this much. And then
6222
06:48:25,230 --> 06:48:26,230
our translation of y is 50. So there we go,
we have everything set up. And now it's pretty
6223
06:48:26,230 --> 06:48:27,230
much just all working, we have our shifts
our movements here, and we also have our scaling.
6224
06:48:27,230 --> 06:48:28,230
So go ahead and try these out on different
elements, it doesn't just have to be with
6225
06:48:28,230 --> 06:48:29,230
a button, you can use this on Grid Elements,
although some of them may not work. You can
6226
06:48:29,230 --> 06:48:30,230
use this on images, text, all sorts of things,
these work on any element, and they can really
6227
06:48:30,230 --> 06:48:31,230
help you to style your website without having
to use some of the traditional methods that
6228
06:48:31,230 --> 06:48:32,230
we've learned. Alright, let's move on. So
in this video, we're going to be looking at
6229
06:48:32,230 --> 06:48:33,230
CSS animations. So we've looked at transitions
and some of the different transformation functions
6230
06:48:33,230 --> 06:48:34,230
that we can use to sort of work with our elements
in a different way. But now we're going to
6231
06:48:34,230 --> 06:48:35,230
be learning another essential component, which
are animations. So we're going to be covering
6232
06:48:35,230 --> 06:48:36,230
this over the next few videos. And for the
first one, we're going to be creating the
6233
06:48:36,230 --> 06:48:37,230
animation. So first of all, what are the advantages
of using an animation? Well, firstly, when
6234
06:48:37,230 --> 06:48:38,230
you're using a transition, you have to apply
those specific styles to everything you want
6235
06:48:38,230 --> 06:48:39,230
to perform a transition with. But with an
animation, you can define the changes once
6236
06:48:39,230 --> 06:48:40,230
and then apply them to anything. So for example,
let's just say I wanted to create an animation
6237
06:48:40,230 --> 06:48:41,230
that turns something from red to black, or
sorry, turns the background from red to black,
6238
06:48:41,230 --> 06:48:42,230
then you can apply it to any item. Whereas
if you use transitions, you'd have to go through
6239
06:48:42,230 --> 06:48:43,230
and go through every single element, change
the suit of selectors, and do all sorts of
6240
06:48:43,230 --> 06:48:44,230
things. On top of that, when you're using
animations, you can play something at the
6241
06:48:44,230 --> 06:48:45,230
start, instead of having or with a delay instead
of having to wait for some event to happen
6242
06:48:45,230 --> 06:48:46,230
with a pseudo selector. So pretty much what
happens here is you can say, we can pretty
6243
06:48:46,230 --> 06:48:47,230
much just remove this image completely from
the page or translate it at the
6244
06:48:47,230 --> 06:48:48,230
start
6245
06:48:48,230 --> 06:48:49,230
when the page is first refreshed. We can also
use this to really make our website interactive
6246
06:48:49,230 --> 06:48:50,230
and change the way this website looks completely.
So let's get started. Now, first thing you
6247
06:48:50,230 --> 06:48:51,230
need to realize is that these animations are
completely custom, custom. You can name them
6248
06:48:51,230 --> 06:48:52,230
whatever you want and do whatever you want
inside them. There are a few keywords that
6249
06:48:52,230 --> 06:48:53,230
we need to use to get this set up. Now an
animation is split up into something called
6250
06:48:53,230 --> 06:48:54,230
keyframes. Now pretty much each animation
has at least one at least two keyframes. So
6251
06:48:54,230 --> 06:48:55,230
you have the starting and the ending. And
then you can add keyframes in between to decide
6252
06:48:55,230 --> 06:48:56,230
the different stages of the animation. So
to define an animation, all you have to do
6253
06:48:56,230 --> 06:48:57,230
is go at keyframes. So in this case Is the
prefix and keyframes is going to be our keyword.
6254
06:48:57,230 --> 06:48:58,230
And then you name the animation. I'm just
going to say, translate elements just like
6255
06:48:58,230 --> 06:48:59,230
that. Now you can name this whatever you want.
Remember, it's completely up to you, then
6256
06:48:59,230 --> 06:49:00,230
you're going to open it up with brackets.
So now it's a little bit different to how
6257
06:49:00,230 --> 06:49:01,230
we've been using CSS, we can just define styles
and expect it to work perfectly. There are
6258
06:49:01,230 --> 06:49:02,230
two different ways or two different main ways
that we can define our keyframes. So pretty
6259
06:49:02,230 --> 06:49:03,230
much the kind of standard way of writing one
of these keyframes is typing out the the keyword.
6260
06:49:03,230 --> 06:49:04,230
So for example, I'm just going to type example
here. Now, of course, if in a real world scenario
6261
06:49:04,230 --> 06:49:05,230
wouldn't be like this, it would be a number
or a percentage, or an actual keyword, but
6262
06:49:05,230 --> 06:49:06,230
it wouldn't just say example, then you're
going to create these curly braces, again
6263
06:49:06,230 --> 06:49:07,230
inside of our keyframes. And here, you would
type the styles at this stage. So for example,
6264
06:49:07,230 --> 06:49:08,230
if I wanted a red background, you would type
it here. So what I'm going to do is talk about
6265
06:49:08,230 --> 06:49:09,230
the first two keywords, which are to and from.
So first of all, let's start with from, so
6266
06:49:09,230 --> 06:49:10,230
this is pretty much going to be your initial
starting point. And then two, which is going
6267
06:49:10,230 --> 06:49:11,230
to be your ending starting or ending point
sorry, here, what you're going to do is type
6268
06:49:11,230 --> 06:49:12,230
in whatever you want. So for example, let's
just say our, I'm actually going to change
6269
06:49:12,230 --> 06:49:13,230
this black to red, since that's what the or
sorry, red to black, red to black. Now here,
6270
06:49:13,230 --> 06:49:14,230
I would say start from when the background
is red. Now there doesn't have to be anything
6271
06:49:14,230 --> 06:49:15,230
here. But it would be recommended that you
do start with something unless you're going
6272
06:49:15,230 --> 06:49:16,230
for something specific after that. And then
here to, I'm going to say at the end of it,
6273
06:49:16,230 --> 06:49:17,230
make sure the background is black. Now, of
course we don't have to work with timings
6274
06:49:17,230 --> 06:49:18,230
or anything here, because that's all decided
when we add and work with the animation on
6275
06:49:18,230 --> 06:49:19,230
our element. So there we go, we have a define.
Now these are the first this is the first
6276
06:49:19,230 --> 06:49:20,230
way to do something. But what if you wanted
more than one background, you can't just add
6277
06:49:20,230 --> 06:49:21,230
two background properties in one go. So instead
of this, what we use is percentages. So you
6278
06:49:21,230 --> 06:49:22,230
can say at 0%, you want to have some special
properties. So I'm going to say background
6279
06:49:22,230 --> 06:49:23,230
is red. And then you can say at 100%. So at
the end of the animation, this is when it's
6280
06:49:23,230 --> 06:49:24,230
100% complete the background to be black.
Now, the direct advantage to using this, you
6281
06:49:24,230 --> 06:49:25,230
can actually add more than more than two stops.
So for example, I can go at 50%, I want the
6282
06:49:25,230 --> 06:49:26,230
background to be yellow.
6283
06:49:26,230 --> 06:49:27,230
Now realistically, you can add as many properties
here as you want, it doesn't really change
6284
06:49:27,230 --> 06:49:28,230
anything. But of course, you want to try and
limit the amount of properties you add or
6285
06:49:28,230 --> 06:49:29,230
sorry, stops or keyframes to maybe six or
seven at the max. Now unless you're doing
6286
06:49:29,230 --> 06:49:30,230
something very specific. Maybe you want strobe
lights or something like that, you're going
6287
06:49:30,230 --> 06:49:31,230
to want to keep it limited. So there we go,
we have these steps here. But the last thing
6288
06:49:31,230 --> 06:49:32,230
I want to cover is that you don't just have
to work with one property. What if we wanted
6289
06:49:32,230 --> 06:49:33,230
to translate something. So what I can do is
actually set the Transform, remember, it is
6290
06:49:33,230 --> 06:49:34,230
a property. And then I can say translate this.
So by zero pixels and zero pixels. So of course,
6291
06:49:34,230 --> 06:49:35,230
we don't actually have to type out this property.
What I'm going to do is now copy this over.
6292
06:49:35,230 --> 06:49:36,230
And so 50% of the way we want it to translate
by 10 pixels, and 10 pixels. And at the end
6293
06:49:36,230 --> 06:49:37,230
of it, we want to translate by 20 pixels and
20 pixels. So you can see how this works.
6294
06:49:37,230 --> 06:49:38,230
So for example, let's just say we wanted to
enlarge something and change the color from
6295
06:49:38,230 --> 06:49:39,230
red to black. We can do it just like this
except maybe using scale or padding or any
6296
06:49:39,230 --> 06:49:40,230
other way that you choose whichever one whichever
one you think is best for the specific website
6297
06:49:40,230 --> 06:49:41,230
you're developing. Now one thing I'm going
to mention is that the kind of convention
6298
06:49:41,230 --> 06:49:42,230
is to keep these curly brackets on the same
line. But if it is getting a little bit long
6299
06:49:42,230 --> 06:49:43,230
like this one, you can definitely open and
close them just like I'm doing here. Don't
6300
06:49:43,230 --> 06:49:44,230
be limited by the whitespace. It's not really
a defining factor. You can space these however
6301
06:49:44,230 --> 06:49:45,230
you want. But usually you're not going to
use more than one property on a keyframe like
6302
06:49:45,230 --> 06:49:46,230
this. If you do have a giant animation, something
with, you know backgrounds, transforms and
6303
06:49:46,230 --> 06:49:47,230
margins you're going to want to, you know,
space it out make it easy for people to read.
6304
06:49:47,230 --> 06:49:48,230
So this doesn't just have to be multiples
of 10. This could be 30% 37% way 37% of the
6305
06:49:48,230 --> 06:49:49,230
way through, it could be 25 you could split
it into quarters, you could do pretty much
6306
06:49:49,230 --> 06:49:50,230
anything you want with this But the key thing
you have to remember is you're designing your
6307
06:49:50,230 --> 06:49:51,230
own animation, you're going to want to fit
it to how you want. So for example, if you
6308
06:49:51,230 --> 06:49:52,230
just wanted to enlarge something, you didn't
really you don't really have to use these
6309
06:49:52,230 --> 06:49:53,230
percentages you can just use to and from or
from and to, since you only have two stops,
6310
06:49:53,230 --> 06:49:54,230
but if you want to do something like multiple
color change, then you most likely want to
6311
06:49:54,230 --> 06:49:55,230
switch to percentages. So you want to go from
0% to 33% 66%, you know, work with it, just
6312
06:49:55,230 --> 06:49:56,230
kind of see how everything works together
and design the animation based on what you
6313
06:49:56,230 --> 06:49:57,230
need. So this is the video based on designing
the animation. Now in the next video, we're
6314
06:49:57,230 --> 06:49:58,230
actually going to be adding our animation
and start working with it, to change it based
6315
06:49:58,230 --> 06:49:59,230
on what we need for each element. Alright,
let's move on. So in this video, we are going
6316
06:49:59,230 --> 06:50:00,230
to be adding the animation that we created
in the previous video to one of our elements.
6317
06:50:00,230 --> 06:50:01,230
And then we're actually going to be going
through and working with it in the next video.
6318
06:50:01,230 --> 06:50:02,230
So first of all, let's just recap what we've
done. So far. In the previous video, we created
6319
06:50:02,230 --> 06:50:03,230
some keyframes for animation, I talked about
all the different units, and how you can actually
6320
06:50:03,230 --> 06:50:04,230
set these values. And we covered all of that.
But now that we've actually created our animation,
6321
06:50:04,230 --> 06:50:05,230
it's time to go through and add them to some
of our elements. So this is going to be quite
6322
06:50:05,230 --> 06:50:06,230
a short video because it is quite easy to
just go ahead and add the animation. But there
6323
06:50:06,230 --> 06:50:07,230
is a lot to cover about the different properties
of animations, which we're going to be talking
6324
06:50:07,230 --> 06:50:08,230
about in the next video. So let's get started.
The first thing is to find a suitable item
6325
06:50:08,230 --> 06:50:09,230
that we can apply this to. So obviously, this
is used with translation and background colors.
6326
06:50:09,230 --> 06:50:10,230
So we can pretty much apply it to anything
on this page. For now I'm just going to go
6327
06:50:10,230 --> 06:50:11,230
with our about me text right there. So the
first thing I'm going to do is go ahead and
6328
06:50:11,230 --> 06:50:12,230
select it by adding a class, it looks like
where is it hold on, let's see seems to be
6329
06:50:12,230 --> 06:50:13,230
have lost and all this. It's got to be somewhere
there we go about me. So he already has a
6330
06:50:13,230 --> 06:50:14,230
class subtitles. So what we're going to do
is, well, actually, there's already stuff
6331
06:50:14,230 --> 06:50:15,230
applied there. So it would be much better
if we actually added an ID to it using specificity.
6332
06:50:15,230 --> 06:50:16,230
And we're just going to say about
6333
06:50:16,230 --> 06:50:17,230
me
6334
06:50:17,230 --> 06:50:18,230
just like that. Now what I would recommend
you keep your animations and keyframes at
6335
06:50:18,230 --> 06:50:19,230
the bottom so that if you ever need to reference
them, you can just scroll down and see all
6336
06:50:19,230 --> 06:50:20,230
of them there. So what I'm going to do is
go ahead and select this. So I'm going to
6337
06:50:20,230 --> 06:50:21,230
go hash, and then about me, open up the curly
braces. And now what we're going to do is
6338
06:50:21,230 --> 06:50:22,230
go and start adding our animation. So this
is pretty easy to do, all you have to do is
6339
06:50:22,230 --> 06:50:23,230
use one property animation name. And you can
see a little shorthand there. But we're going
6340
06:50:23,230 --> 06:50:24,230
to be covering that a little bit later. Let's
go ahead and add that. And here we're going
6341
06:50:24,230 --> 06:50:25,230
to put the name of our animation. So this
would be red to black. And remember, it's
6342
06:50:25,230 --> 06:50:26,230
going to be the exact name of the animation
that we specified here. So let's go ahead
6343
06:50:26,230 --> 06:50:27,230
and refresh the page, see how this works.
And you can see that nothing's happening.
6344
06:50:27,230 --> 06:50:28,230
So this is something that I want to cover
in the next video because we're actually going
6345
06:50:28,230 --> 06:50:29,230
to be working with some of the properties.
But for now, all you need to know is that
6346
06:50:29,230 --> 06:50:30,230
we do need to apply some special properties
for the animation to start running. So for
6347
06:50:30,230 --> 06:50:31,230
now, all we've done is taken the keyframes
just slot them on to the about me title. And
6348
06:50:31,230 --> 06:50:32,230
in the next video, we're going to go and actually
set this up so that we can start seeing it
6349
06:50:32,230 --> 06:50:33,230
moving, changing the times and actually making
the animation come to life. Alright, let's
6350
06:50:33,230 --> 06:50:34,230
move on. So now we're actually going to be
going ahead and covering the different properties
6351
06:50:34,230 --> 06:50:35,230
that we can do in our little CSS stylesheet.
Here, we're going to go through, we're going
6352
06:50:35,230 --> 06:50:36,230
to add some of these different animation properties.
And we're actually going to start working
6353
06:50:36,230 --> 06:50:37,230
with it so that we can really get into how
the animation works and how we can work with
6354
06:50:37,230 --> 06:50:38,230
it. So let's get started. Now, I'm only going
to be covering some of the basic properties
6355
06:50:38,230 --> 06:50:39,230
here. But there are many more out there. There
are so many different ways that you can work
6356
06:50:39,230 --> 06:50:40,230
with these animations and change their properties
or how they work. Well, what we're going to
6357
06:50:40,230 --> 06:50:41,230
do is go ahead and use some of these basic
functions, so we can get this up and running
6358
06:50:41,230 --> 06:50:42,230
and working. So let's get started. The first
one, I want to talk about an animation duration.
6359
06:50:42,230 --> 06:50:43,230
And this is probably the best or well not
really the best, but it's the most important
6360
06:50:43,230 --> 06:50:44,230
one, because pretty much what happens is the
animation duration is going to actually allow
6361
06:50:44,230 --> 06:50:45,230
your animation to run. So what I'm going to
do here is first of all set up this function
6362
06:50:45,230 --> 06:50:46,230
here. And pretty much the default value of
this property here it's actually zero. And
6363
06:50:46,230 --> 06:50:47,230
that's why in the last video, this wasn't
running at all, we added the animation, but
6364
06:50:47,230 --> 06:50:48,230
because the default value is zero, pretty
much the animation style starts and finishes
6365
06:50:48,230 --> 06:50:49,230
at the exact same time. Well, not really.
But we can't see it at all the time is zero.
6366
06:50:49,230 --> 06:50:50,230
So we're going to do here is specify a second
value here. So I'm going to go ahead and say
6367
06:50:50,230 --> 06:50:51,230
two seconds, which is quite fast. So I'm actually
going to go ahead with four seconds. Now if
6368
06:50:51,230 --> 06:50:52,230
we refresh the page, you can see that that
animation does play. And you can see it kind
6369
06:50:52,230 --> 06:50:53,230
of works like that, it goes from red to yellow
to black. So that's the first thing about
6370
06:50:53,230 --> 06:50:54,230
the animation that you'll notice it goes,
it stops, and then it finishes. And we're
6371
06:50:54,230 --> 06:50:55,230
going to be using some of the other properties
to actually change how this work and maybe,
6372
06:50:55,230 --> 06:50:56,230
you know, repeat it over and over again and
do all sorts of things with them. So the next
6373
06:50:56,230 --> 06:50:57,230
property I'm going to be covering is the sort
of style of how the property works. So we've
6374
06:50:57,230 --> 06:50:58,230
already covered the name of the property,
which is obviously applying the property or
6375
06:50:58,230 --> 06:50:59,230
the animation itself. We've also talked about
the duration. But now we're going to be talking
6376
06:50:59,230 --> 06:51:00,230
about the style. So pretty much the style
is probably the hardest property to learn
6377
06:51:00,230 --> 06:51:01,230
about kind of how, you know, we looked at
transition properties or styles. And those
6378
06:51:01,230 --> 06:51:02,230
were the hardest, this is pretty much the
exact same. So pretty much what happens here
6379
06:51:02,230 --> 06:51:03,230
is that this style is going to define the
speeds, or how the animation works out. So
6380
06:51:03,230 --> 06:51:04,230
all we have to do is go ahead and type out
animation. Animation, dash, sorry, timing
6381
06:51:04,230 --> 06:51:05,230
function. There we go. And now from here,
we can apply the different speeds or
6382
06:51:05,230 --> 06:51:06,230
styles.
6383
06:51:06,230 --> 06:51:07,230
So I'm going to be talking about the main
ones. And you can probably recognize these
6384
06:51:07,230 --> 06:51:08,230
from the transitions video. So we have ease,
which is the normal one you can see there.
6385
06:51:08,230 --> 06:51:09,230
And then we also have a few more. So let's
go ahead and check it out. We have linear,
6386
06:51:09,230 --> 06:51:10,230
of course, which is just straight, there's
no speed changes, or weird anything like that,
6387
06:51:10,230 --> 06:51:11,230
you can see just go straight down. So you
can see a very clear difference there, especially
6388
06:51:11,230 --> 06:51:12,230
here, unlike the transition. Whereas with
ease, it would stop in the middle and then
6389
06:51:12,230 --> 06:51:13,230
speed back up. Whereas linear, it just goes
straight. Of course, we also have ease in
6390
06:51:13,230 --> 06:51:14,230
and ease out and ease in out just like we
covered before. So there we go, I'm going
6391
06:51:14,230 --> 06:51:15,230
to leave it at linear, because I think it
looks the best. There we go. And you can see
6392
06:51:15,230 --> 06:51:16,230
we've set that speed curve there. So now let's
talk about the next property, which is going
6393
06:51:16,230 --> 06:51:17,230
to be the animation delay. So the delay is
a little bit of a weird case here, because
6394
06:51:17,230 --> 06:51:18,230
you can use positive values. But you can also
use negative values, which is a little bit
6395
06:51:18,230 --> 06:51:19,230
confusing, but let's talk about it here. So
I'm going to go ahead and add an animation
6396
06:51:19,230 --> 06:51:20,230
delay, just like that. And here, I'm going
to specify a delay time. So for example, two
6397
06:51:20,230 --> 06:51:21,230
seconds. Now, of course, this works perfectly.
we refresh waits two seconds, and then the
6398
06:51:21,230 --> 06:51:22,230
animation plays just like you would normally.
But what if we added a negative to here, what
6399
06:51:22,230 --> 06:51:23,230
do you think would happen? If we refresh,
you can see it's already at yellow. So what's
6400
06:51:23,230 --> 06:51:24,230
pretty much happening here is that it starts
when the animation is zero, which is the default,
6401
06:51:24,230 --> 06:51:25,230
it starts right as the page loads. But if
you go negative two, it's pretty much acting
6402
06:51:25,230 --> 06:51:26,230
as if you're already two seconds into the
animation. That's kind of how negative values
6403
06:51:26,230 --> 06:51:27,230
work here. Now, obviously, there's no real
application for this unless you're looking
6404
06:51:27,230 --> 06:51:28,230
for something really, really niche that you
need it. But this isn't really widespread
6405
06:51:28,230 --> 06:51:29,230
or used. very commonly, it's just a really
cool thing to know about animation delays.
6406
06:51:29,230 --> 06:51:30,230
So the next thing we're going to cover is
the iteration count. And I talked about this
6407
06:51:30,230 --> 06:51:31,230
a little bit when we started the duration.
And it's pretty much going to say how many
6408
06:51:31,230 --> 06:51:32,230
times this thing is going to loop over. So
we can use the property animation iteration
6409
06:51:32,230 --> 06:51:33,230
count. And here, what we're going to do is
apply our the number of times we wanted to
6410
06:51:33,230 --> 06:51:34,230
iterate. So for example, if I wanted to, to
iterate or loop over two times, I could refresh,
6411
06:51:34,230 --> 06:51:35,230
of course, it starts a little bit early, and
it goes another time. And there we go after
6412
06:51:35,230 --> 06:51:36,230
that is finished, so it went over two times.
Now there's also a really special value you
6413
06:51:36,230 --> 06:51:37,230
can use here, which is infinite. And then
this means that this is just going to keep
6414
06:51:37,230 --> 06:51:38,230
going over and over pretty much forever until
you terminate the page or close it or even
6415
06:51:38,230 --> 06:51:39,230
change something. But when this is set, it's
gonna keep looping over and over again pretty
6416
06:51:39,230 --> 06:51:40,230
much forever. So there we go. Now let's go
ahead and talk about the shorthand property.
6417
06:51:40,230 --> 06:51:41,230
And pretty much what we're gonna do here,
whoops, actually, we need to cover one more
6418
06:51:41,230 --> 06:51:42,230
value before we use that shorthand. And that's
going to be our animation direction. So this
6419
06:51:42,230 --> 06:51:43,230
is the final value just like you're seeing
here before we started, but it's actually
6420
06:51:43,230 --> 06:51:44,230
pretty useful unlike something like the negative
animation delay value here. Pretty much what
6421
06:51:44,230 --> 06:51:45,230
this is going to say is the starting and ending
points of the animation. So for example, let's
6422
06:51:45,230 --> 06:51:46,230
go ahead and add that property their animation
direction. And now we're going to talk about
6423
06:51:46,230 --> 06:51:47,230
the four main values for this function. Of
course, the default value is going to be normal,
6424
06:51:47,230 --> 06:51:48,230
which is just like that. And that, of course,
plays from 0% to 100%, just like normal. And
6425
06:51:48,230 --> 06:51:49,230
I'm actually going to set this iteration to
two times and remove the delay. Just like
6426
06:51:49,230 --> 06:51:50,230
that, so that we can get the full picture
here. So if we refresh the page, you can see
6427
06:51:50,230 --> 06:51:51,230
that it's just normal, it goes from start
to finish. And then you have your opposite
6428
06:51:51,230 --> 06:51:52,230
way, which is reverse. So pretty much what
happens here is it goes from 100% to 0%. And
6429
06:51:52,230 --> 06:51:53,230
the properties aren't flipped, they stay exactly
the same. So if you look at this, it goes
6430
06:51:53,230 --> 06:51:54,230
back in time, all the way to its starting
position. So the other two, which are a little
6431
06:51:54,230 --> 06:51:55,230
bit more complicated to understand, are alternate.
So just like this, so alternate pretty much
6432
06:51:55,230 --> 06:51:56,230
means it's going to go forward and then go
backward. So it kind of bounced back, you
6433
06:51:56,230 --> 06:51:57,230
can see there, so it goes from zero to 100.
And then in the same animation, well not the
6434
06:51:57,230 --> 06:51:58,230
same. It goes from 100 to zero. And then of
course, just like with our first two, you
6435
06:51:58,230 --> 06:51:59,230
have alternate reverse, which does still the
alternation, but it starts at 100, instead
6436
06:51:59,230 --> 06:52:00,230
of at zero, so it's kind of going to start
here and then go back to it starting and bounce
6437
06:52:00,230 --> 06:52:01,230
back to 100.
6438
06:52:01,230 --> 06:52:02,230
Let's look at that here. You can see it goes
up, and then it bounces all the way back to
6439
06:52:02,230 --> 06:52:03,230
its starting position. So there we go. That's
pretty much how this whole thing works.
6440
06:52:03,230 --> 06:52:04,230
And those are the four are actually here,
it's five main main functions and or sorry,
6441
06:52:04,230 --> 06:52:05,230
properties. What we're going to have to do
here is summarize all of them because there
6442
06:52:05,230 --> 06:52:06,230
is a lot to cover. And you're not going to
add five animations every time, especially
6443
06:52:06,230 --> 06:52:07,230
when you have to use all of the different
browser support tools and prefixes. And it
6444
06:52:07,230 --> 06:52:08,230
gets really complicated after some time. So
what I'm going to do is use a very cool shorthand
6445
06:52:08,230 --> 06:52:09,230
that just summarizes everything for us. So
we don't even have to use our animation name
6446
06:52:09,230 --> 06:52:10,230
here, we can just cover it all once in our
animation shorthand, so I'm going to do it
6447
06:52:10,230 --> 06:52:11,230
here, animation. So the first, this takes,
of course, five values, your first value is
6448
06:52:11,230 --> 06:52:12,230
going to be your animation name, which is
red to black. Your next value is going to
6449
06:52:12,230 --> 06:52:13,230
be the duration, which is a pretty important
one. So we're going to set it the same at
6450
06:52:13,230 --> 06:52:14,230
four seconds, your next value is going to
be your timing function or your speed. So
6451
06:52:14,230 --> 06:52:15,230
we're going to set it linear here. And then
next is going to be your delay. Now we removed
6452
06:52:15,230 --> 06:52:16,230
that there, but we do have to put that delay.
So I'm just going to say zero. Next, I'm going
6453
06:52:16,230 --> 06:52:17,230
to put the iteration count, which is two.
And finally the direction which is alternate.
6454
06:52:17,230 --> 06:52:18,230
Whoops, alternate reverse. Now you can see
that does get a little bit long there. So
6455
06:52:18,230 --> 06:52:19,230
I'm going to leave both of these versions
on in the project file for you to decide for
6456
06:52:19,230 --> 06:52:20,230
yourself. Now let's refresh the page, see
what happens. Oh, whoops, forgot the pixels.
6457
06:52:20,230 --> 06:52:21,230
Sorry, forgot the second value there. Let's
refresh. And now you can see that it goes
6458
06:52:21,230 --> 06:52:22,230
from the back to the start, just like we had
here. So like I said that shorthand is a little
6459
06:52:22,230 --> 06:52:23,230
bit hectic to memorize and you know, learn
all of the different values. But there is
6460
06:52:23,230 --> 06:52:24,230
always Google if you forget the order or anything
like that. And what makes this really useful.
6461
06:52:24,230 --> 06:52:25,230
If you want to add any browser freebet for
prefixes like this, you can easily do that.
6462
06:52:25,230 --> 06:52:26,230
And then just copy this over for the different
prefixes. So you can go here, here, here and
6463
06:52:26,230 --> 06:52:27,230
put your different prefixes. So I have from
Mozilla, we have from Microsoft, so Internet
6464
06:52:27,230 --> 06:52:28,230
Explorer. And then of course, we have our
opera. So we have four different prefixes
6465
06:52:28,230 --> 06:52:29,230
here and five values for one element, you'd
have to put 20 properties just to get this
6466
06:52:29,230 --> 06:52:30,230
all covered. Now, you can probably see the
advantage of using something like this, with
6467
06:52:30,230 --> 06:52:31,230
that shorthand over all of the really clunky
properties. Alright, so that's pretty much
6468
06:52:31,230 --> 06:52:32,230
it for animation properties, or the different
types of animations or ways you can manipulate
6469
06:52:32,230 --> 06:52:33,230
these animations. Of course, there is once
you learn this, there's a lot of power that
6470
06:52:33,230 --> 06:52:34,230
can go into it. You can create all sorts of
different animations, grow styles, and then
6471
06:52:34,230 --> 06:52:35,230
you can really manipulate them just by using
these five values. We didn't even we didn't
6472
06:52:35,230 --> 06:52:36,230
even have to touch the animation to make it
look completely different. So that's pretty
6473
06:52:36,230 --> 06:52:37,230
much it. Now we've covered a lot of features
in CSS. And in the next section, we're actually
6474
06:52:37,230 --> 06:52:38,230
going to be going through and styling the
website from scratch as a challenge. So you're
6475
06:52:38,230 --> 06:52:39,230
going to have a challenge to style a website.
And then the solution is the video I'm going
6476
06:52:39,230 --> 06:52:40,230
to show you and that's where you're really
going to get challenged to use all of the
6477
06:52:40,230 --> 06:52:41,230
skills you've learned in this section. Maybe
touch up on some things that you may not have
6478
06:52:41,230 --> 06:52:42,230
been comfortable with, or you may have been
fuzzy on. Alright, let's move on.
6479
06:52:42,230 --> 06:52:43,230
So now that you've learned pretty much all
of the basic skills, or some of the more advanced
6480
06:52:43,230 --> 06:52:44,230
skills as well, in CSS, it's time to move
on and start working on a challenge. So pretty
6481
06:52:44,230 --> 06:52:45,230
much in this challenge, you are given an unstyled
website, which by the way, a zip, or a packaged
6482
06:52:45,230 --> 06:52:46,230
file of all of the files that you can use
to get started is available for download on
6483
06:52:46,230 --> 06:52:47,230
this Udemy lecture. So what you can do is
just go ahead and download that, and it's
6484
06:52:47,230 --> 06:52:48,230
going to prompt you and bring up this page.
So you can see, we have a lot of stuff See
6485
06:52:48,230 --> 06:52:49,230
here, and I'm actually going to zoom out,
just to get a better view of it. But there's
6486
06:52:49,230 --> 06:52:50,230
a lot of raw images, raw HTML, there's no,
there's no styling on it at all. And what
6487
06:52:50,230 --> 06:52:51,230
your job is to do is to follow these objectives
here, given here, just follow them and obviously,
6488
06:52:51,230 --> 06:52:52,230
don't follow them to the core to the bone,
you can, you know, make any attendance upended,
6489
06:52:52,230 --> 06:52:53,230
you know, amendment sorry, to, to these lists
of tasks as you like, but pretty much, you're
6490
06:52:53,230 --> 06:52:54,230
just gonna have to style this website from
scratch using the techniques that we've learned
6491
06:52:54,230 --> 06:52:55,230
coloring the layout grid Flexbox animations,
just completely revamped this website. Now
6492
06:52:55,230 --> 06:52:56,230
one note is I do have my own solution video
posted in on the next lecture. But it is quite
6493
06:52:56,230 --> 06:52:57,230
long, so you don't have to watch that. But
if you want to see how I did it, maybe you
6494
06:52:57,230 --> 06:52:58,230
want to, you know, review everything or get
a little view on some of the topics, you can
6495
06:52:58,230 --> 06:52:59,230
always watch that but don't feel forced or
don't feel like you have to watch that lecture.
6496
06:52:59,230 --> 06:53:00,230
If you don't want to watch it, all you have
to do is click on it the bulleted list icon
6497
06:53:00,230 --> 06:53:01,230
and just tick off the lecture, just make sure
that if you want it to mark as complete, just
6498
06:53:01,230 --> 06:53:02,230
tick off the lecture make sure that it is
finished. And then you don't have to watch
6499
06:53:02,230 --> 06:53:03,230
it. But other than that, we have this website
that is just completely unstyled. And we have
6500
06:53:03,230 --> 06:53:04,230
to go and style it. Now just to show you this
is what our website here looks like I'm going
6501
06:53:04,230 --> 06:53:05,230
to actually refresh the page. So you can see
that nice fade in, we have a sidebar, which
6502
06:53:05,230 --> 06:53:06,230
we styled and created borders for. And we
also have a nice image grid. So you can see
6503
06:53:06,230 --> 06:53:07,230
there that is responsive. So if I go and actually
resize the window, you can see there that
6504
06:53:07,230 --> 06:53:08,230
it is responsive, we have a little bit of
image changing there. And it is just overall
6505
06:53:08,230 --> 06:53:09,230
a responsive website. So this is how it looks.
And there you go, you can see we've changed
6506
06:53:09,230 --> 06:53:10,230
the backgrounds, we've imported our own custom
fonts. And we use Flexbox and grid to set
6507
06:53:10,230 --> 06:53:11,230
up this website along with animations, you
can see a nice transition in color there.
6508
06:53:11,230 --> 06:53:12,230
So we're going to be doing all of this in
the solution video. Again, you don't have
6509
06:53:12,230 --> 06:53:13,230
to watch it, you can either copy what it looks
like on this page. Or instead, you can just
6510
06:53:13,230 --> 06:53:14,230
go and do whatever you want. Pretty much just
take the content I give you and style it however
6511
06:53:14,230 --> 06:53:15,230
way. And I would encourage you to either go
on the video lab website, or the q&a section
6512
06:53:15,230 --> 06:53:16,230
of this course and post what you've got, you
know, show off your skills and show off what
6513
06:53:16,230 --> 06:53:17,230
you can create out of this website, it's really
encouraged to you know, share it with the
6514
06:53:17,230 --> 06:53:18,230
community, and everyone can learn from each
other and the skills. So don't feel limited
6515
06:53:18,230 --> 06:53:19,230
by anything you've learned in this course,
if you want to do something very specific
6516
06:53:19,230 --> 06:53:20,230
that you haven't learned or you forgot how
to do just for you feel free to use Google,
6517
06:53:20,230 --> 06:53:21,230
this isn't a test, it's more of a fun activity
to see how far you've gotten in CSS. So that's
6518
06:53:21,230 --> 06:53:22,230
just one thing to keep in mind. Alright, I
will see you in the solution video. So in
6519
06:53:22,230 --> 06:53:23,230
this video, we're going to get started and
start finishing up this website, we're going
6520
06:53:23,230 --> 06:53:24,230
to, you know, do all of the skills and use
everything we've learned over the course to
6521
06:53:24,230 --> 06:53:25,230
get this all set up and running. Alright,
let's get started. So the first thing I want
6522
06:53:25,230 --> 06:53:26,230
to do is just flip the page over here with
my HTML. And then we're going to get started
6523
06:53:26,230 --> 06:53:27,230
straight away. So before we start anything,
I think we need to link a CSS stylesheet,
6524
06:53:27,230 --> 06:53:28,230
I'm actually just going to go ahead and close
off our previous site. Because what's happening
6525
06:53:28,230 --> 06:53:29,230
here is we have our actual site set up. But
we need to start working on our CSS through
6526
06:53:29,230 --> 06:53:30,230
an external stylesheet as we've been doing
for the last well for most of this course.
6527
06:53:30,230 --> 06:53:31,230
So we're going to get started with that. We're
going to use Ctrl or Command n to create a
6528
06:53:31,230 --> 06:53:32,230
new file. And then I'm going to save it in
my CSS folder here. And I'm going to call
6529
06:53:32,230 --> 06:53:33,230
it style dot CSS. All right, there we go.
So the next thing I want to do is start laying
6530
06:53:33,230 --> 06:53:34,230
out what we need for the website. And what
I like to do before I start is just kind of
6531
06:53:34,230 --> 06:53:35,230
get myself in the right mind frame by setting
out the kind of phones I want to use, the
6532
06:53:35,230 --> 06:53:36,230
different colors, everything like that. So
what I'm going to do is just create a comment
6533
06:53:36,230 --> 06:53:37,230
Up here using this notation. I've used it
a couple times throughout the course. And
6534
06:53:37,230 --> 06:53:38,230
what we're going to do is in here, we're going
to type out all of the stuff we need. So I'm
6535
06:53:38,230 --> 06:53:39,230
going to say primary font. Whoops. So we have
our primary font, here, we have our secondary
6536
06:53:39,230 --> 06:53:40,230
font.
6537
06:53:40,230 --> 06:53:41,230
And now we have our different colors. So what
I like to do for my colors is have my RGB
6538
06:53:41,230 --> 06:53:42,230
code, do whatever here, and then you have
the name of the color. So this would be for
6539
06:53:42,230 --> 06:53:43,230
example, black, pretty much. So we're going
to do that in just a second. But first of
6540
06:53:43,230 --> 06:53:44,230
all, let's just go and find the fonts that
we want to use. We're not going to import
6541
06:53:44,230 --> 06:53:45,230
them yet. But we just want to look and see
what kind of fonts we need. So what I'm going
6542
06:53:45,230 --> 06:53:46,230
to do is just choose two here, pretty randomly,
again, usually most websites will use at maximum
6543
06:53:46,230 --> 06:53:47,230
three fonts, but you should use or maybe two
fonts, one for headers, and one for normal
6544
06:53:47,230 --> 06:53:48,230
text. So I'm going to go ahead and use later,
we used it previously to pretty nice font.
6545
06:53:48,230 --> 06:53:49,230
And we're also going to go ahead and for our
headers, we're going to use Roboto condensed,
6546
06:53:49,230 --> 06:53:50,230
so we have normal Roboto here, but we're going
to use the condensed version. So for the primary
6547
06:53:50,230 --> 06:53:51,230
font, it's going to be later. And for our
secondary, which is for pretty much headers
6548
06:53:51,230 --> 06:53:52,230
and subtitles, things like that, it's going
to be Roboto condensed. Alright, there we
6549
06:53:52,230 --> 06:53:53,230
go. Let's go ahead and check out the website.
And the color scheme is blue, and orange.
6550
06:53:53,230 --> 06:53:54,230
So if you made your website using a different
color scheme, don't worry about it, it doesn't
6551
06:53:54,230 --> 06:53:55,230
really matter. But what we're going to do
is go ahead and try and find some blues and
6552
06:53:55,230 --> 06:53:56,230
oranges. So I'm going to find for each color,
a main color, so pretty dark, bold color,
6553
06:53:56,230 --> 06:53:57,230
and then one that's a little bit lighter and
easier on the eyes. So let's start off with
6554
06:53:57,230 --> 06:53:58,230
blue here, I'm going to go with quite a dark
kind of blue something around here. And I'm
6555
06:53:58,230 --> 06:53:59,230
going to copy that in. And I'm going to say
dark blue, although it's not really dark,
6556
06:53:59,230 --> 06:54:00,230
dark blue. But I'm going to say that and paste
in the code. Now let's go with a lighter blue.
6557
06:54:00,230 --> 06:54:01,230
Now we can always use RGBA color codes. But
again, doing this allows us more freedom in
6558
06:54:01,230 --> 06:54:02,230
the long run when we start working with everything.
So let's go ahead and just copy that. And
6559
06:54:02,230 --> 06:54:03,230
this is going to be our light blue. Now let's
move on to orange. So again, these are very
6560
06:54:03,230 --> 06:54:04,230
opposing colors. That's why I chose them.
So we're going to go again with quite a striking,
6561
06:54:04,230 --> 06:54:05,230
you know, very bold orange. So something like
this would be good. So I'm just going to say
6562
06:54:05,230 --> 06:54:06,230
the bold orange. And again, it doesn't really
matter what you give these, your names, as
6563
06:54:06,230 --> 06:54:07,230
long as you kind of understand them, you can
name them whatever you want. And then we're
6564
06:54:07,230 --> 06:54:08,230
going to go with a lighter orange. So something
around here. Now what I like to do, if you're
6565
06:54:08,230 --> 06:54:09,230
trying to create a lighter color, is just
look for something on the this side of the
6566
06:54:09,230 --> 06:54:10,230
spectrum closer towards the higher values
of the RGB. So if it's low, it's most likely
6567
06:54:10,230 --> 06:54:11,230
going to be dark, you can see that in effect
here. So I'm going to go ahead and say in
6568
06:54:11,230 --> 06:54:12,230
light orange, is just like that. Alright,
so we've set up our color schemes now. So
6569
06:54:12,230 --> 06:54:13,230
we have everything written down and ready
to go. But next thing we need to do is actually
6570
06:54:13,230 --> 06:54:14,230
link the stylesheet because we haven't linked
it yet. So what I'm going to do in my head
6571
06:54:14,230 --> 06:54:15,230
here is create a link tag, hit tab. And now
we're going to reference it just like before,
6572
06:54:15,230 --> 06:54:16,230
we need to go back one directory, we use dot
dot. Now we're up here in our challenge directory.
6573
06:54:16,230 --> 06:54:17,230
So previously, we were here. Now we'll jump
back up to challenge. Now we need to jump
6574
06:54:17,230 --> 06:54:18,230
back forward one into the CSS directory. And
then from there, we need to reference the
6575
06:54:18,230 --> 06:54:19,230
file, which is style dot CSS.
6576
06:54:19,230 --> 06:54:20,230
Just like that, refresh the page. And of course,
nothing's gonna visibly change because we
6577
06:54:20,230 --> 06:54:21,230
haven't written anything down yet. But that's
a pretty good first task. So again, none of
6578
06:54:21,230 --> 06:54:22,230
these have to be in order, as I said in the
last video, so we're just going to go ahead
6579
06:54:22,230 --> 06:54:23,230
and fix up these images because they are quite
big. So that's what I'm going to do. First,
6580
06:54:23,230 --> 06:54:24,230
I'm going to go ahead and reference all the
images for now. Now we can go and change the
6581
06:54:24,230 --> 06:54:25,230
classes and do specificity later. But for
now, I'm just going to specify them and group
6582
06:54:25,230 --> 06:54:26,230
them all at once. So I'm going to set their
width to 400 pixels, and their height 200
6583
06:54:26,230 --> 06:54:27,230
pixels. Now, obviously, I've kind of created
a, a, I really don't like absolute values.
6584
06:54:27,230 --> 06:54:28,230
But for something like this, it isn't, it's
kind of necessary. And we can work with the
6585
06:54:28,230 --> 06:54:29,230
relative newness or the responsiveness of
these images later. So let's go ahead and
6586
06:54:29,230 --> 06:54:30,230
refresh see how it looks. So now we know for
sure that our images are working fine. And
6587
06:54:30,230 --> 06:54:31,230
of course, you can see how the absolute values
are kind of stretching this out. They're not
6588
06:54:31,230 --> 06:54:32,230
kept in proportion. But for now we don't need
to worry about that. So there we go. We've
6589
06:54:32,230 --> 06:54:33,230
resized our images, and now we can see everything
a lot more clearly. So we have our images
6590
06:54:33,230 --> 06:54:34,230
set up. The next thing I want to do is actually
set up our page. To have two sections, we
6591
06:54:34,230 --> 06:54:35,230
want to have our content section. And we want
to have our sidebar. So we have our sidebar
6592
06:54:35,230 --> 06:54:36,230
section, I'm actually going to create a divider
there, our sidebar section and our main section.
6593
06:54:36,230 --> 06:54:37,230
So that's what we're going to do. So I'm sorry,
our content section. So we have a main div
6594
06:54:37,230 --> 06:54:38,230
here, which clot groups everything together.
So in my eyes, the best way to do this would
6595
06:54:38,230 --> 06:54:39,230
be using a grid. So what I'm going to do is
select the class main. Although now that I'm
6596
06:54:39,230 --> 06:54:40,230
looking at it, we could probably just use
an ID instead. So I'm going to go ahead and
6597
06:54:40,230 --> 06:54:41,230
change the ID to main, remember, there's only
one main on the whole page. So it's not like
6598
06:54:41,230 --> 06:54:42,230
we need to use a class. And from here, we'll
get started. So the first thing I want to
6599
06:54:42,230 --> 06:54:43,230
do is set the display type to grid. Right.
So this is going to obviously set up a grid.
6600
06:54:43,230 --> 06:54:44,230
Now, we won't be able to see anything here
pretty obviously. But now we're going to start
6601
06:54:44,230 --> 06:54:45,230
working with it. So pretty much what I have
vision for the change is we have our content
6602
06:54:45,230 --> 06:54:46,230
section, which is taking up the majority of
the page, and then we have our posts section.
6603
06:54:46,230 --> 06:54:47,230
So our post section is going to be much smaller,
it's going to be while a sidebar, that's kind
6604
06:54:47,230 --> 06:54:48,230
of the definition of it. And it's going to
take up a small portion on this side of the
6605
06:54:48,230 --> 06:54:49,230
page. So that's what I'm going to do here,
I'm going to create two columns. So one of
6606
06:54:49,230 --> 06:54:50,230
the grid template columns, just like that,
and I'm going to set them to 70% and 30%.
6607
06:54:50,230 --> 06:54:51,230
Now, instead of using auto auto, which would
just change them to the exact same height,
6608
06:54:51,230 --> 06:54:52,230
we're now giving the first column a preference.
So it's going to be a little bit bigger than
6609
06:54:52,230 --> 06:54:53,230
the second one, we refresh. And it's working
great. Now, what I recommend that you do while
6610
06:54:53,230 --> 06:54:54,230
you're doing this is always try and go and
see how your page looks in different viewpoints.
6611
06:54:54,230 --> 06:54:55,230
So if you go ahead and you click on Inspect
anywhere on your page, you can actually go
6612
06:54:55,230 --> 06:54:56,230
and use your Chrome responsiveness kind of
thing here to check out how your page would
6613
06:54:56,230 --> 06:54:57,230
look on different devices. So I would recommend
using this over resizing the browser, because
6614
06:54:57,230 --> 06:54:58,230
resizing, the browser actually shows some
inaccuracy. So you can really see how it would
6615
06:54:58,230 --> 06:54:59,230
look like on your phone, or you know, maybe
an iPad or a tablet or something like that
6616
06:54:59,230 --> 06:55:00,230
without having to actually go on those tablets.
So there we go. Now what I'm going to do is
6617
06:55:00,230 --> 06:55:01,230
go ahead and manipulate this a little bit.
So I'm going to go ahead and create a grid
6618
06:55:01,230 --> 06:55:02,230
gap. to separate the two, I'm going to say
it's about 50 pixels. There we go. And, yeah,
6619
06:55:02,230 --> 06:55:03,230
let's you can see now that that gap has been
created. And if we go ahead and inspect the
6620
06:55:03,230 --> 06:55:04,230
page, you can see let me go to a phone, actually,
you can see that there's a gap there a clear
6621
06:55:04,230 --> 06:55:05,230
gap. And at least for now, it's not very evident.
But once we start, you know, creating borders
6622
06:55:05,230 --> 06:55:06,230
and things like that, we can really see this
in a much better way. So there we go. That's
6623
06:55:06,230 --> 06:55:07,230
great and working fine. So now that we've
set up the set that up, I want to do something
6624
06:55:07,230 --> 06:55:08,230
that we actually should have done at the beginning,
which is add classes here because you can
6625
06:55:08,230 --> 06:55:09,230
see that although I've added the main classes
myself, we still want to be able to, you know,
6626
06:55:09,230 --> 06:55:10,230
group subtitles together or paragraph text,
so that once we start doing all of the important
6627
06:55:10,230 --> 06:55:11,230
stuff, like importing images, and all sorts
of things like that, we want to be able to
6628
06:55:11,230 --> 06:55:12,230
group all of them or style all of them together
at the same time. So that's what I'm going
6629
06:55:12,230 --> 06:55:13,230
to do here. First thing I want to do is add
a class of subtitle to all of the subtitles,
6630
06:55:13,230 --> 06:55:14,230
just pretty obvious. Now again, some of them
are h1, some of them are h tos and all sorts
6631
06:55:14,230 --> 06:55:15,230
of things like that. So I'm going to go class
6632
06:55:15,230 --> 06:55:16,230
is subtitle. And here as well, class is subtitle.
Now, we kind of want all of the subtitles
6633
06:55:16,230 --> 06:55:17,230
to be relatively the same size. But you can
see here that there's actually a mini topic
6634
06:55:17,230 --> 06:55:18,230
which we want to be smaller. So what I'm going
to do is change the class and change this
6635
06:55:18,230 --> 06:55:19,230
actually to topic,
6636
06:55:19,230 --> 06:55:20,230
subtitle.
6637
06:55:20,230 --> 06:55:21,230
So now we can specify this in a more specific
way. So instead of having to use the subtitle
6638
06:55:21,230 --> 06:55:22,230
class, we can actually go and talk about this
in a different way. So there we go. Now let's
6639
06:55:22,230 --> 06:55:23,230
go ahead and start looking at some of the
other parts of the site. Oh, we actually still
6640
06:55:23,230 --> 06:55:24,230
have more, you can see we have a lot of stuff
here. So what I'm going to do is actually
6641
06:55:24,230 --> 06:55:25,230
add classes to each of these posts, because
they are going to be a little bit different
6642
06:55:25,230 --> 06:55:26,230
considering the grid situation that we have
here. So I have six posts. So I'm going to
6643
06:55:26,230 --> 06:55:27,230
set their class to post title,
6644
06:55:27,230 --> 06:55:28,230
like that.
6645
06:55:28,230 --> 06:55:29,230
And what I want to do is also set some of
the other stuff. So here, for example, our
6646
06:55:29,230 --> 06:55:30,230
paragraphs, or kind of our descriptions and
our posts, I want to also create a class for
6647
06:55:30,230 --> 06:55:31,230
those. So I'm going to say class, I'm going
to say post text, or post description, it
6648
06:55:31,230 --> 06:55:32,230
doesn't really matter, whichever one you are
comfortable with. And we're going to leave
6649
06:55:32,230 --> 06:55:33,230
these blank for now. And actually also go
ahead and add a class to these dips. Because
6650
06:55:33,230 --> 06:55:34,230
remember, the more we can specify The better
our page is going to look. Now obviously,
6651
06:55:34,230 --> 06:55:35,230
we're just doing baseline kind of stuff here.
If we ever need to specify something in the
6652
06:55:35,230 --> 06:55:36,230
future, you just go and add a class, a class
to that. So there we go, we have everything
6653
06:55:36,230 --> 06:55:37,230
set up. Now we've added our classes. So the
next thing I want to do is go ahead and import
6654
06:55:37,230 --> 06:55:38,230
my different fonts. So firstly, let's go ahead
and check out our little documentation mini
6655
06:55:38,230 --> 06:55:39,230
documentation there. And we're going to start
selecting some of these fonts. So first thing
6656
06:55:39,230 --> 06:55:40,230
I want to do is download or import in Leto.
So I'm going to go and select Leto. And here,
6657
06:55:40,230 --> 06:55:41,230
I'm going to go ahead and just copy that link.
Or actually, before that, let's go ahead and
6658
06:55:41,230 --> 06:55:42,230
add some more families so that we can import
it all at the same time. So we have our Roboto
6659
06:55:42,230 --> 06:55:43,230
condensed, there we go. add that. Now what
we're going to do is go ahead and whoops,
6660
06:55:43,230 --> 06:55:44,230
didn't mean to do that. Now, we're going to
go ahead and select some other fonts here
6661
06:55:44,230 --> 06:55:45,230
or sorry, weights here. So I'm going to select
bold 704. Later, I'm going to also select
6662
06:55:45,230 --> 06:55:46,230
bold 700. And we're also going to go with
a light. So the load time is moderate, it's
6663
06:55:46,230 --> 06:55:47,230
not going to, you know be very easy on the
site. But it is worth it. Because these are
6664
06:55:47,230 --> 06:55:48,230
all the fonts that we need. And without them,
the site would look completely different.
6665
06:55:48,230 --> 06:55:49,230
So let's go ahead and import those. I'm going
to go into my index and insert the link right
6666
06:55:49,230 --> 06:55:50,230
below here. So I'm going to do that oh, because
actually, we need to put the stylesheet below
6667
06:55:50,230 --> 06:55:51,230
the below the fonts, remember, because we
need the fonts to load in first. So there
6668
06:55:51,230 --> 06:55:52,230
we go, we have that important. Now what we're
going to do is just go ahead and copy these
6669
06:55:52,230 --> 06:55:53,230
onto our onto here, just for reference. Now
we are going to, you know, put these and specify
6670
06:55:53,230 --> 06:55:54,230
these different selectors, obviously, but
for now, I just want to leave them in there.
6671
06:55:54,230 --> 06:55:55,230
So it just in case we forget some of these
fallbacks or anything like that, we're just
6672
06:55:55,230 --> 06:55:56,230
going to keep that there. For reference, I'm
going to actually put that in our little notepad
6673
06:55:56,230 --> 06:55:57,230
there. So now let's go ahead and refresh the
page. And obviously, we won't see much of
6674
06:55:57,230 --> 06:55:58,230
a change since we just add added classes.
But there we go, we have our kind of hierarchy
6675
06:55:58,230 --> 06:55:59,230
set up to start working with our website.
So let's go ahead and start using these fonts.
6676
06:55:59,230 --> 06:56:00,230
Now, what I'm going to do first is select
everything that has a class of
6677
06:56:00,230 --> 06:56:01,230
subtitle, right here.
6678
06:56:01,230 --> 06:56:02,230
And what I'm going to do is paste in this
font family, or actually, before we do that,
6679
06:56:02,230 --> 06:56:03,230
why don't we use the CSS specificity chart,
we're going to start by selecting everything
6680
06:56:03,230 --> 06:56:04,230
that has the class of key, so all paragraphs,
so I'm going to do the lips, I'm going to
6681
06:56:04,230 --> 06:56:05,230
select all classes, all paragraph elements.
And I'm going to give them that later font
6682
06:56:05,230 --> 06:56:06,230
family. So what this is going to do is style
everything. And if we don't like that, what
6683
06:56:06,230 --> 06:56:07,230
we can do instead is just go and change the
font family. So that for example, if maybe
6684
06:56:07,230 --> 06:56:08,230
we want to have a different font, maybe it's
a subtitle or some special text, we can just
6685
06:56:08,230 --> 06:56:09,230
easily specify it without having to go through
and you know, specify each one every single
6686
06:56:09,230 --> 06:56:10,230
time. So it's a much easier way. So now that
we are starting to do this, we can actually
6687
06:56:10,230 --> 06:56:11,230
start to see flaws here. So for example, we
also want the list items to be styled. So
6688
06:56:11,230 --> 06:56:12,230
I'm going to do select all allies,
6689
06:56:12,230 --> 06:56:13,230
allies.
6690
06:56:13,230 --> 06:56:14,230
And now I'm going to paste in that same font
family, and refresh. And you can see that
6691
06:56:14,230 --> 06:56:15,230
that is now working we have everything set
up here. And you can see there's also a little
6692
06:56:15,230 --> 06:56:16,230
bit of text here. So you can kind of start
to notice bugs in you know, maybe HTML that
6693
06:56:16,230 --> 06:56:17,230
you've written or anything like that, you
can easily start to notice bugs in it, once
6694
06:56:17,230 --> 06:56:18,230
you start styling it. So this is most likely
an indentation error. Maybe this text ended
6695
06:56:18,230 --> 06:56:19,230
up outside the paragraph tag, so I'm going
to look for it. It is next to our l eyes.
6696
06:56:19,230 --> 06:56:20,230
And you can see it is right there. So what
I'm going to do is just erase that we started
6697
06:56:20,230 --> 06:56:21,230
out, we start up our p tag. And I'm going
to create a new one under it just to make
6698
06:56:21,230 --> 06:56:22,230
things a little cleaner. Now I refresh and
that is working. This is most likely an error
6699
06:56:22,230 --> 06:56:23,230
with indentation, things like
6700
06:56:23,230 --> 06:56:24,230
that.
6701
06:56:24,230 --> 06:56:25,230
So now we have our paragraph text, everything
like that set up. What I'm going to do is
6702
06:56:25,230 --> 06:56:26,230
now work on our headers. So I'm going to start
off with our h ones. And I'm going to give
6703
06:56:26,230 --> 06:56:27,230
it that header font family. So I'm going to
Ctrl x which is cut or Command x if you're
6704
06:56:27,230 --> 06:56:28,230
on Mac. And I'm going to paste that in refresh.
And you can see that that is worked on our
6705
06:56:28,230 --> 06:56:29,230
heading here. Now we're going to do it on
all of our h twos, which remember if you've
6706
06:56:29,230 --> 06:56:30,230
kind of looked at the code, our our subtitles,
do that and now those have also been styled.
6707
06:56:30,230 --> 06:56:31,230
So just by doing that our page has been completely
transformed. We've you know, imported this
6708
06:56:31,230 --> 06:56:32,230
custom font and laid out our site in a way
that just makes it look a lot better. So that
6709
06:56:32,230 --> 06:56:33,230
is working fine. So There we go, we have this
set up, and it is working fine. Now what I
6710
06:56:33,230 --> 06:56:34,230
want to do is go ahead and start working on
some of other layout features on this page.
6711
06:56:34,230 --> 06:56:35,230
Once we get into that, we can start tackling
coloring and formatting and all the other
6712
06:56:35,230 --> 06:56:36,230
things after we've used the fonts. So let's
get started. What I want to do first is working
6713
06:56:36,230 --> 06:56:37,230
on our little image grid here. So we don't
actually have a proper grid setup, which is
6714
06:56:37,230 --> 06:56:38,230
what I'm looking to fix in this in this part
of the video. So I'm going to go ahead and
6715
06:56:38,230 --> 06:56:39,230
do that. Now. I'm going to first of all, select
it. So we're going to look for that class
6716
06:56:39,230 --> 06:56:40,230
that we use, which is image grid. So we're
going to go into here and select that using
6717
06:56:40,230 --> 06:56:41,230
dot image dash grid. And there are many different
ways to create a grid these days, but the
6718
06:56:41,230 --> 06:56:42,230
way I'm going to use to make it a lot easier
is just use Flexbox. So we've already used
6719
06:56:42,230 --> 06:56:43,230
grid once Flexbox would be a great way to
solve this. So let's go ahead and refresh
6720
06:56:43,230 --> 06:56:44,230
the page. And now you can see that we have
created a little Flexbox here. So we have
6721
06:56:44,230 --> 06:56:45,230
that set up. And obviously you can see that
it is pretty badly laid out right after creating
6722
06:56:45,230 --> 06:56:46,230
the Flexbox. So we're going to tackle that
problem now. Now, there are actually only
6723
06:56:46,230 --> 06:56:47,230
two commands that we need to fix this, we
can go and set up our flex grow and shrink
6724
06:56:47,230 --> 06:56:48,230
to make it just how we like it. But there
is an easy workaround to it, the first thing
6725
06:56:48,230 --> 06:56:49,230
we want to do is turn wrapping on. So we're
going to say flex wrap, wrap. And this is
6726
06:56:49,230 --> 06:56:50,230
just going to move everything on to a new
line, which is pretty easy. You can see there
6727
06:56:50,230 --> 06:56:51,230
that that is working fine now. And when I
resize the page or turn it into full width,
6728
06:56:51,230 --> 06:56:52,230
you can see that that creates a nice three
by three image grid. But even if we go into
6729
06:56:52,230 --> 06:56:53,230
our inspector or change the responsiveness,
it also resizes accordingly. The last thing
6730
06:56:53,230 --> 06:56:54,230
I want to do is change it so that it's not
kind of you know, placed like this, I want
6731
06:56:54,230 --> 06:56:55,230
to kind of make it in the center of the page.
So what I'm going to do is just use the simple
6732
06:56:55,230 --> 06:56:56,230
justify content property and set that to center.
Now we refresh, and you can see that this
6733
06:56:56,230 --> 06:56:57,230
has been realigned to the center of the page.
And remember, we do have a sidebar here, which
6734
06:56:57,230 --> 06:56:58,230
is kind of, you know, giving us the illusion
that it's not taking up the space, it actually
6735
06:56:58,230 --> 06:56:59,230
should be. But it is centered. So it's centered
to that 80% of the page, you do need to keep
6736
06:56:59,230 --> 06:57:00,230
that in mind when you're working with this.
Once you start working with coloring, you'll
6737
06:57:00,230 --> 06:57:01,230
really start to see the page come together.
So the last thing I want to do is kind of
6738
06:57:01,230 --> 06:57:02,230
create a gap between some of these images
because they don't look that good when they're
6739
06:57:02,230 --> 06:57:03,230
just slammed together, you want to create
some kind of contrast between colors. So we're
6740
06:57:03,230 --> 06:57:04,230
going to use a nice special selector. To do
this, we're going to select every single image
6741
06:57:04,230 --> 06:57:05,230
inside of the grid instead of having to place
new classes on them. So what I'm going to
6742
06:57:05,230 --> 06:57:06,230
do is go ahead and select dot image grid,
and then this symbol, which is the greater
6743
06:57:06,230 --> 06:57:07,230
than symbol, and then image. So this is every
image inside of our image grid, open that
6744
06:57:07,230 --> 06:57:08,230
up. And we're just going to give it a margin
of 10 pixels very easy, we don't need to work
6745
06:57:08,230 --> 06:57:09,230
with anything else, refresh the page, and
that margin has been added. So you can see
6746
06:57:09,230 --> 06:57:10,230
how that looks a lot better now that we've
done it. And it's still responsive when we
6747
06:57:10,230 --> 06:57:11,230
you know, change the display, maybe to iPad
or anything like that you can see it is still
6748
06:57:11,230 --> 06:57:12,230
responsive, it's not changing it at, it's
not changing it at all. So that's really good.
6749
06:57:12,230 --> 06:57:13,230
So there we go, I'm going to set that up.
So now that we have our image grid set up,
6750
06:57:13,230 --> 06:57:14,230
the last thing I want to work with is this
right here. So it says in our objective list,
6751
06:57:14,230 --> 06:57:15,230
we want to move this image onto the side.
So there you could use Flexbox, or grid, this
6752
06:57:15,230 --> 06:57:16,230
is a pretty simple scenario. So what I'm going
to do, instead of doing that is just use a
6753
06:57:16,230 --> 06:57:17,230
simple float. So I'm going to give this an
ID since we only need to do this as a one
6754
06:57:17,230 --> 06:57:18,230
time thing. So I'm going to go ahead and look
for that image, give it an ID of image, one,
6755
06:57:18,230 --> 06:57:19,230
because it is the first image on the page.
You can name this anything you want, depending
6756
06:57:19,230 --> 06:57:20,230
on the purpose of the
6757
06:57:20,230 --> 06:57:21,230
element. But I'm going to give it that class
there. So I'm going to set it as image one,
6758
06:57:21,230 --> 06:57:22,230
just like this. So what I'm going to do is
go ahead and give that a float of right, just
6759
06:57:22,230 --> 06:57:23,230
like that. And whoops, forgot the id selector
there, we refresh the page. And now that is
6760
06:57:23,230 --> 06:57:24,230
working fine. Now obviously, you can see there
is a little bit of an issue with the spacing.
6761
06:57:24,230 --> 06:57:25,230
So we're going to use a quick fix for this
and give it a margin of about 15 pixels. So
6762
06:57:25,230 --> 06:57:26,230
this is going to kind of push everything to
the side. And obviously you can see there
6763
06:57:26,230 --> 06:57:27,230
are still issues with positioning and everything.
But that's kind of the you know, issue with
6764
06:57:27,230 --> 06:57:28,230
using floats and things like that you can't
really control where the spacing is going
6765
06:57:28,230 --> 06:57:29,230
to go. So what I'm going to do to fix this
is just increase the height a little bit.
6766
06:57:29,230 --> 06:57:30,230
So instead of setting a height of 200 pixels,
I'm going to go ahead and set it to maybe
6767
06:57:30,230 --> 06:57:31,230
250. Now we're going to refresh and it's almost
there. We're going to actually use 300 pixels.
6768
06:57:31,230 --> 06:57:32,230
Now, of course, in a normal scenario, you
wouldn't have to use this, you know, maybe
6769
06:57:32,230 --> 06:57:33,230
you would want to use a grid or Flexbox, like
I specified here. But like I said, you can
6770
06:57:33,230 --> 06:57:34,230
pretty much use whatever creative methods
you deem necessary. And this is much easier
6771
06:57:34,230 --> 06:57:35,230
because again, there are only three items
and using something like a grid, or a Flexbox
6772
06:57:35,230 --> 06:57:36,230
wouldn't really be practical in this situation.
So there we go, we have this, this and this
6773
06:57:36,230 --> 06:57:37,230
laid out just perfectly. Now we're gonna go
ahead and tackle some of the other parts of
6774
06:57:37,230 --> 06:57:38,230
this site. So we have our little image grid
here, we have things like this, let's go ahead
6775
06:57:38,230 --> 06:57:39,230
and check out our item list here. So we do
have animations, which we're going to leave
6776
06:57:39,230 --> 06:57:40,230
for last, we have our image grid. And there
we go. So our next task is going to be creating
6777
06:57:40,230 --> 06:57:41,230
those borders. So we did create our post here.
So remember, we have our post class. So let's
6778
06:57:41,230 --> 06:57:42,230
go ahead and select that. I'm going to go
ahead and say dot post. So first thing I'm
6779
06:57:42,230 --> 06:57:43,230
going to do is go ahead and set a border.
So this is going to be our first use of the
6780
06:57:43,230 --> 06:57:44,230
color scheme that we created. So I'm going
to say to pixels, because monnit, that big,
6781
06:57:44,230 --> 06:57:45,230
solid.
6782
06:57:45,230 --> 06:57:46,230
And now we're going to go ahead and copy a
color from up here. So I'm going to go ahead
6783
06:57:46,230 --> 06:57:47,230
and use a dark blue. Just like that, copy
it in just like an RGB color code.
6784
06:57:47,230 --> 06:57:48,230
We've done it many times before, refresh,
and we have our borders. Now, obviously, there
6785
06:57:48,230 --> 06:57:49,230
are some issues with margining. So what I'm
going to do is give each of those a margin
6786
06:57:49,230 --> 06:57:50,230
of about 10 pixels, just like our images,
refresh the page, and it's working. So there
6787
06:57:50,230 --> 06:57:51,230
we go, we have our posts, and they are separated.
Now, pretty much we do have some internal
6788
06:57:51,230 --> 06:57:52,230
padding issues, which is normal, we'll go
ahead and style those in just a second. But
6789
06:57:52,230 --> 06:57:53,230
first of all, if you can start to see our
sidebar working here, we have that little
6790
06:57:53,230 --> 06:57:54,230
grid gap. And we have our the start of our
second column there. So it's working great.
6791
06:57:54,230 --> 06:57:55,230
Let's go ahead and start working with our
margins here. So first thing I'm going to
6792
06:57:55,230 --> 06:57:56,230
select is our post title. So I'm going to
go ahead and say post title. Now you can do
6793
06:57:56,230 --> 06:57:57,230
this in two ways. Since there's only one h2
and every post, you could go and say it like
6794
06:57:57,230 --> 06:57:58,230
this. Or you can use this class that we created.
So we're going to actually just go ahead and
6795
06:57:58,230 --> 06:57:59,230
use that. So what I'm going to say is give
it a margin on the left of maybe five pixels.
6796
06:57:59,230 --> 06:58:00,230
And now what that's going to do is push that
inside. And we're going to have to do the
6797
06:58:00,230 --> 06:58:01,230
same for our paragraph text. So I'm going
to go ahead and add our post text class here,
6798
06:58:01,230 --> 06:58:02,230
I must have forgotten it. So we're going to
go on dot post text and give that the same
6799
06:58:02,230 --> 06:58:03,230
margin. There we go. And now we have everything
pushed in. So there are still margining issues
6800
06:58:03,230 --> 06:58:04,230
there. You can see that with some of these
here. So I'm actually going to go ahead and
6801
06:58:04,230 --> 06:58:05,230
also give our text a right margin. And again,
this is all about experimentation. So go ahead,
6802
06:58:05,230 --> 06:58:06,230
and you know, play around with this and see
what really works for you. And you can see
6803
06:58:06,230 --> 06:58:07,230
that now that's really fixed that up. And
we have our posts sorted. So there we go,
6804
06:58:07,230 --> 06:58:08,230
we have everything working. Now let's go ahead
and try and work with more of our color scheme.
6805
06:58:08,230 --> 06:58:09,230
Because right now, it's pretty blank here.
So what I'm going to do is go ahead and just,
6806
06:58:09,230 --> 06:58:10,230
you know, use this color scheme in a better
way. So firstly, I'm going to give the page
6807
06:58:10,230 --> 06:58:11,230
a background. So what I'm going to do is give
the whole page so I'm going to use the body
6808
06:58:11,230 --> 06:58:12,230
selector. I'm actually going to do that at
the top. So I'm going to use the body selector
6809
06:58:12,230 --> 06:58:13,230
body. And I'm going to give it a color, or
sorry, background, a background and I'm going
6810
06:58:13,230 --> 06:58:14,230
to give it our light blue color, just like
that. Oh, let's copy the name as well, you
6811
06:58:14,230 --> 06:58:15,230
just want to copy the color code, remember.
And there we go. Our whole page now has a
6812
06:58:15,230 --> 06:58:16,230
light blue color. Now, I'm actually going
to go ahead and use an RGBA because this isn't
6813
06:58:16,230 --> 06:58:17,230
light enough. So that's what I meant about
flexibility at the beginning of the video,
6814
06:58:17,230 --> 06:58:18,230
you can go ahead and change the colors based
on your main four here. So I'm going to give
6815
06:58:18,230 --> 06:58:19,230
this about point five, just make it a little
bit lighter on the eyes. You can see that
6816
06:58:19,230 --> 06:58:20,230
looks a lot better now. So now that we've
done that, I'm actually considering changing
6817
06:58:20,230 --> 06:58:21,230
the border color here. So what I'm going to
do is go ahead and find it. And instead of
6818
06:58:21,230 --> 06:58:22,230
using our blue, I'm going to use a bold orange
so it's going to be quite striking on the
6819
06:58:22,230 --> 06:58:23,230
eyes there. So I'm going to go ahead and do
that. And there we go. We have our dark orange
6820
06:58:23,230 --> 06:58:24,230
there. Now what I'm going to do is specify
this and select our sidebar class. So I'm
6821
06:58:24,230 --> 06:58:25,230
going to go ahead and do that right below
all of these. So I'm going to go dot sidebar.
6822
06:58:25,230 --> 06:58:26,230
And I'm going to give it a background of a
light orange. So it's going to create a nice,
6823
06:58:26,230 --> 06:58:27,230
a nice contrast, in effect tabin. And again,
I copied the name. So I'm going to go ahead
6824
06:58:27,230 --> 06:58:28,230
and give it that background that we need,
which is our light orange. Now I refresh the
6825
06:58:28,230 --> 06:58:29,230
page. And oh, something must Oh is selected
subtitle went on to the wrong one. So I'm
6826
06:58:29,230 --> 06:58:30,230
going to paste that in here. And there we
go. Now refresh the page, and we have that
6827
06:58:30,230 --> 06:58:31,230
orange background color there. So we could
you know, do some color changes and mess around
6828
06:58:31,230 --> 06:58:32,230
with these. But for now, I think this is fine.
We don't really need to change these in any
6829
06:58:32,230 --> 06:58:33,230
way. For now. So we have our orange background,
we've kind of incorporated this color scheme
6830
06:58:33,230 --> 06:58:34,230
very well. So we're going to do a little checkup
of our sections here. So we've laid out our
6831
06:58:34,230 --> 06:58:35,230
content, we've created our margins, or spacing,
things like that, we pretty much have everything
6832
06:58:35,230 --> 06:58:36,230
set up here, except for our links and our
hovers and our transitions.
6833
06:58:36,230 --> 06:58:37,230
So this is going to be the final part of the
video, we're going to go we're going to set
6834
06:58:37,230 --> 06:58:38,230
up our, you know, maybe our changes our resizes,
things like that, and then we're going to
6835
06:58:38,230 --> 06:58:39,230
finish off the solution, it is getting quite
long. And I want to keep this short. So let's
6836
06:58:39,230 --> 06:58:40,230
get started. So first thing I'm going to do
is work with our links. Now, we haven't actually
6837
06:58:40,230 --> 06:58:41,230
added anything to the links. So that's what
I'm going to do first of all, now I kind of
6838
06:58:41,230 --> 06:58:42,230
left it up to you what you want to add to
the links, but what I'm going to do is just
6839
06:58:42,230 --> 06:58:43,230
go and check out each of these. So I'm going
to go click on all of them. And I'm just going
6840
06:58:43,230 --> 06:58:44,230
Oh, whoops, I went into the href. And here,
I'm just going to add lorem ipsum and some
6841
06:58:44,230 --> 06:58:45,230
dummy text, like that. So now we're going
to use because I don't really feel like going
6842
06:58:45,230 --> 06:58:46,230
and adding a whole bunch of classes and selectors,
I'm going to use our special advanced selector
6843
06:58:46,230 --> 06:58:47,230
there. So inside of our sidebar here, we're
actually inside of our post, sorry, we're
6844
06:58:47,230 --> 06:58:48,230
going to go post and then our a or our anchor
tag. Now we're going to go ahead and work
6845
06:58:48,230 --> 06:58:49,230
with these. So I'm going to refresh the page,
make sure they're there. So first thing we
6846
06:58:49,230 --> 06:58:50,230
need to do is give it that left right margin
that we need, remember, because to space it
6847
06:58:50,230 --> 06:58:51,230
out a little bit, then what I'm going to do
is say text decoration none. So pretty much
6848
06:58:51,230 --> 06:58:52,230
what this is going to do. Oh whoops, didn't
need to add that text, what I'm going to do
6849
06:58:52,230 --> 06:58:53,230
is give it a text decoration property of none.
So pretty much what this is going to do is
6850
06:58:53,230 --> 06:58:54,230
change this. So that pretty much instead of
having this underline, it's just going to
6851
06:58:54,230 --> 06:58:55,230
be blank text. So this looks a lot cleaner,
especially when we go ahead and add our um,
6852
06:58:55,230 --> 06:58:56,230
our fonts, so I'm going to do that next. So
remember, we have it added to our paragraphs
6853
06:58:56,230 --> 06:58:57,230
or allies. And I think it only makes sense
if we added to our anchor tags, as well. So
6854
06:58:57,230 --> 06:58:58,230
I'm going to go ahead and add that whoops.
So I'm going to add that there. And now we
6855
06:58:58,230 --> 06:58:59,230
have that font, so it's looking great again.
So now let's go ahead and start adding some
6856
06:58:59,230 --> 06:59:00,230
pseudo selectors. So we have our basic colors.
Now all of these are already clicked. But
6857
06:59:00,230 --> 06:59:01,230
pretty much we have our post color. So I'm
going to say the post color is going to be
6858
06:59:01,230 --> 06:59:02,230
our that dark blue that we had. So this is
before it's clicked remember. So dark blue.
6859
06:59:02,230 --> 06:59:03,230
Copy that in and set this as the main color.
And now we're going to combine our special
6860
06:59:03,230 --> 06:59:04,230
selectors with a pseudo selector. Now, we
haven't actually seen this before, but it's
6861
06:59:04,230 --> 06:59:05,230
pretty easy to do, you just add it onto the
element. And the only thing that we're going
6862
06:59:05,230 --> 06:59:06,230
to change remember is going to be the color
of the text there. So I'm going to go and
6863
06:59:06,230 --> 06:59:07,230
find our light blue. And I'm going to paste
that in. So now when we hover over it, it
6864
06:59:07,230 --> 06:59:08,230
should change the color to a light blue. That's
working great. Now let's add our transition.
6865
06:59:08,230 --> 06:59:09,230
So I'm going to use the transition property.
Now I'm not going to use any of the prefixes.
6866
06:59:09,230 --> 06:59:10,230
But if you're using an older browser, you
want to support it or you want browser support,
6867
06:59:10,230 --> 06:59:11,230
you should always use this. So now I'm going
to specify specify what I want in the transition.
6868
06:59:11,230 --> 06:59:12,230
So I'm only going to use the basic properties.
So I'm going to say maybe point five seconds,
6869
06:59:12,230 --> 06:59:13,230
hover out sorry, point five seconds color.
And yeah, that's pretty much it. So let's
6870
06:59:13,230 --> 06:59:14,230
go ahead and fresh. Now we hover over it and
it takes 0.5 seconds to change color. Now
6871
06:59:14,230 --> 06:59:15,230
we could of course go and you know add our
special styles for our transition. But I'm
6872
06:59:15,230 --> 06:59:16,230
only going to use the two basic ones here,
which is the time and the property. So we've
6873
06:59:16,230 --> 06:59:17,230
changed that. Now we have our link color change.
The last thing we need, or the last two things
6874
06:59:17,230 --> 06:59:18,230
is the image grow. And the page animation
sequence, which is going to be our sidebar,
6875
06:59:18,230 --> 06:59:19,230
and our, our main section here kind of fading
in if if it makes sense. So that's what we're
6876
06:59:19,230 --> 06:59:20,230
going to do here. First thing I'm going to
do is go and set the image grow. So what I'm
6877
06:59:20,230 --> 06:59:21,230
going to do is go somewhere, where's my image,
I'm selecting my images. If there's none here,
6878
06:59:21,230 --> 06:59:22,230
I can just go and change that. Now, what I'm
going to do is first create our image hover,
6879
06:59:22,230 --> 06:59:23,230
just like that. And I Oh, yeah, I forgot I
put that up at the top here. So I'm going
6880
06:59:23,230 --> 06:59:24,230
to create my image hover. And here, I'm going
to put in what I need. So I want to, you know,
6881
06:59:24,230 --> 06:59:25,230
increase the height. So I'm going to say,
the height is going to be 250 pixels. And
6882
06:59:25,230 --> 06:59:26,230
the width is going to be 500 pixels, because
we want that two to one aspect ratio. So now
6883
06:59:26,230 --> 06:59:27,230
we refresh hover over an image becomes bigger,
we hover over an image becomes bigger. So
6884
06:59:27,230 --> 06:59:28,230
now what we want to do is add that transition
property. So we're going to go again, point
6885
06:59:28,230 --> 06:59:29,230
five seconds,
6886
06:59:29,230 --> 06:59:30,230
and we're going to add two properties. So
we're going to go height and width separated
6887
06:59:30,230 --> 06:59:31,230
by a comma, refresh. And of course, it seems
to be a little problem there. Whoops, I forgot
6888
06:59:31,230 --> 06:59:32,230
to
6889
06:59:32,230 --> 06:59:33,230
add that
6890
06:59:33,230 --> 06:59:34,230
misspelling here. Now we do that and it changed
it. Now you can see that there is a little
6891
06:59:34,230 --> 06:59:35,230
bit of a weird kind of transition effect there.
So it increases the width fully, and then
6892
06:59:35,230 --> 06:59:36,230
it increases the height. So what I'm going
to do to fix that is just use the all property.
6893
06:59:36,230 --> 06:59:37,230
So what this is going to do is transition
the height and the width together. When I
6894
06:59:37,230 --> 06:59:38,230
refresh, you can see that that styles or moves
everything together, because pretty much what's
6895
06:59:38,230 --> 06:59:39,230
happening is it's overriding our our width
property, it's just setting it instantly,
6896
06:59:39,230 --> 06:59:40,230
and then it's changing the height, which we
don't want. So I'm going to set that there,
6897
06:59:40,230 --> 06:59:41,230
you can see that's working great. So what
we're going to do now is go ahead and create
6898
06:59:41,230 --> 06:59:42,230
that fade in effect that we needed for our
content and sidebar. So first thing I want
6899
06:59:42,230 --> 06:59:43,230
to do is go ahead and select both of them.
So I'm going to select our content. And I'm
6900
06:59:43,230 --> 06:59:44,230
going to select our sidebar. And now what
I'm going to do is start creating our animation.
6901
06:59:44,230 --> 06:59:45,230
So the first thing we need to do is create
keyframes. So I'm going to go add keyframes,
6902
06:59:45,230 --> 06:59:46,230
and then the name of our animation, let's
just call it fade in for now. So the next
6903
06:59:46,230 --> 06:59:47,230
thing I need to do is select my, the different
time stamps I want. So I'm going to use the
6904
06:59:47,230 --> 06:59:48,230
from and two keywords to do this from and
to. Now we're going to use a property that
6905
06:59:48,230 --> 06:59:49,230
we haven't actually learned before. And hopefully
you Google this and try to find it when doing
6906
06:59:49,230 --> 06:59:50,230
the challenge. And it's actually called opacity.
So this allows us to go from opacity of zero,
6907
06:59:50,230 --> 06:59:51,230
no percents, no pixels, just straight number
to opacity one, just like our RGB a color
6908
06:59:51,230 --> 06:59:52,230
code, now we're going to do is just refresh
the page, obviously, we're not going to see
6909
06:59:52,230 --> 06:59:53,230
anything, just make sure that everything is
still running the same. So I'm going to go
6910
06:59:53,230 --> 06:59:54,230
ahead and now add our animations to both of
these sections or both of these block here.
6911
06:59:54,230 --> 06:59:55,230
Sorry, blocks. So I'm going to go ahead and
say the animation name is going to be fade
6912
06:59:55,230 --> 06:59:56,230
in. We're also going to set the duration.
Remember, we always need a duration to two
6913
06:59:56,230 --> 06:59:57,230
seconds, refresh the page. Hopefully this
works. And you can see that it now fades in.
6914
06:59:57,230 --> 06:59:58,230
So there we go, we have our page set up and
working, we refresh here, we can hover over
6915
06:59:58,230 --> 06:59:59,230
images and make them look better. And it just
looks really cool over also, you know, we
6916
06:59:59,230 --> 07:00:00,230
pretty much set up this page from scratch.
And now we have it all working, we have our
6917
07:00:00,230 --> 07:00:01,230
fonts, and everything seems to be looking
great. Alright, let's move on. So you've reached
6918
07:00:01,230 --> 07:00:02,230
the end of the course now. So before we move
on, I want to congratulate you it very few
6919
07:00:02,230 --> 07:00:03,230
people who ended up starting the course make
it to the end. And it does take a lot of discipline
6920
07:00:03,230 --> 07:00:04,230
to learn everything and stick to it throughout
the course. So I just like to say well done.
6921
07:00:04,230 --> 07:00:05,230
And it's great that you're here with me. But
now that you've learned CSS what what is there
6922
07:00:05,230 --> 07:00:06,230
to do next? I mean, should I just stop and
use my skills? Or are there other things that
6923
07:00:06,230 --> 07:00:07,230
I need to learn. So I'm going to give you
this helpful guide to maybe get you off your
6924
07:00:07,230 --> 07:00:08,230
feet and start learning new skills progressing
your careers. So I'm going to talk about it.
6925
07:00:08,230 --> 07:00:09,230
Now before we move on. Let's just take a second
and recap what position we're in right now.
6926
07:00:09,230 --> 07:00:10,230
So by now you should have pretty good proficiency
in both html5 and CSS three, which are just
6927
07:00:10,230 --> 07:00:11,230
the latest versions of the two. So you should
know all of the concepts and inner workings
6928
07:00:11,230 --> 07:00:12,230
behind CSS and how it works so you can really
see how a page is fit together using everything
6929
07:00:12,230 --> 07:00:13,230
so box models Flexbox responsive this things
like that. By now, you should have the skills
6930
07:00:13,230 --> 07:00:14,230
to style your website in pretty much any way
that you want. If you want to make it, you
6931
07:00:14,230 --> 07:00:15,230
know, a very rustic or vintage feel. Or if
you want to lay it out in a nice modern design,
6932
07:00:15,230 --> 07:00:16,230
you should be able to layout your website
with as much creative freedom as you want.
6933
07:00:16,230 --> 07:00:17,230
But here are some skills that you should learn,
learn next. So there are three main front
6934
07:00:17,230 --> 07:00:18,230
end technologies that are called the Big Three.
So you've already covered two of them, which
6935
07:00:18,230 --> 07:00:19,230
are HTML and CSS. The third one, and arguably
the most important is JavaScript. Now, JavaScript
6936
07:00:19,230 --> 07:00:20,230
is the programming language, it's kind of
what makes a website come to life, it gives
6937
07:00:20,230 --> 07:00:21,230
it that interactive feel. And you can also
change things in a much easier way. And without
6938
07:00:21,230 --> 07:00:22,230
JavaScript, you can't really grab the essence
of web development as a whole, you need it
6939
07:00:22,230 --> 07:00:23,230
to be able to bring your website together
and really take it to the next level. So that's
6940
07:00:23,230 --> 07:00:24,230
one skill that you should definitely learn
next, if you're planning on continuing. Now,
6941
07:00:24,230 --> 07:00:25,230
once you've learned JavaScript,
6942
07:00:25,230 --> 07:00:26,230
then you have to go on and choose what kind
of career path you want to go down. If you're
6943
07:00:26,230 --> 07:00:27,230
planning to go down a front end route, so
you're only developing things that you know,
6944
07:00:27,230 --> 07:00:28,230
you're only changing the look and feel of
the website, on the main mainframe, then you
6945
07:00:28,230 --> 07:00:29,230
should start learning some more advanced skills
on either of the big three. So I've let I've
6946
07:00:29,230 --> 07:00:30,230
left some examples there. So there are lots
of libraries, frameworks, that things people
6947
07:00:30,230 --> 07:00:31,230
have created. So you can go and research some
of these. Some of them I would recommend for
6948
07:00:31,230 --> 07:00:32,230
CSS, or some of the pre processors, which
are sass and less. So I would recommend you
6949
07:00:32,230 --> 07:00:33,230
go and check those out. You can also look
at some JavaScript frameworks. So things like
6950
07:00:33,230 --> 07:00:34,230
react ESX, and also some other libraries.
So bootstrap, Font Awesome, and semantic UI.
6951
07:00:34,230 --> 07:00:35,230
So again, don't take all of those, as you
know, you're trying to wrack your brain and
6952
07:00:35,230 --> 07:00:36,230
keep all those in your memory. Just go and
do some research on what where you want to
6953
07:00:36,230 --> 07:00:37,230
go and what kind of skills you should learn
next, those who are looking to go into server
6954
07:00:37,230 --> 07:00:38,230
architecture. So more back end development,
people who are looking to fix up the processing
6955
07:00:38,230 --> 07:00:39,230
website, saving users or, you know, delivering
specified content should look into some back
6956
07:00:39,230 --> 07:00:40,230
end architecture and programming languages.
So for example, Django would be one for web
6957
07:00:40,230 --> 07:00:41,230
development or server development for the
web. And it is made or powered by Python,
6958
07:00:41,230 --> 07:00:42,230
you also have PHP and a JavaScript, which
is JavaScript web server, which is called
6959
07:00:42,230 --> 07:00:43,230
node j, s. And then you have some others like
Ruby and dotnet. So there are so many out
6960
07:00:43,230 --> 07:00:44,230
there, you can always go and research and
you'll find tons of options. So there you
6961
07:00:44,230 --> 07:00:45,230
go. So that's pretty much it. We've covered
everything on CSS, we've talked about grids,
6962
07:00:45,230 --> 07:00:46,230
Flexbox. And pretty much everything there
is to know about the basic concepts behind
6963
07:00:46,230 --> 07:00:47,230
CSS, when you can start specializing and going
into very specific details. And obviously,
6964
07:00:47,230 --> 07:00:48,230
it's ever expansive, you're never going to
have to stop learning. So by the time you're
6965
07:00:48,230 --> 07:00:49,230
watching this, there could be an entirely
new version of CSS out with a ton of new features.
6966
07:00:49,230 --> 07:00:50,230
So never stop learning and always keep, you
know, taking up new skills and trying to learn
6967
07:00:50,230 --> 07:00:51,230
more about the skills that you already have.
So that's one thing I would recommend to keep
6968
07:00:51,230 --> 07:00:52,230
in mind and just continue down this path and
you will eventually end up as a web developer
6969
07:00:52,230 --> 07:00:53,230
that can really create things to his or her
creative freedom. Alright, thanks for taking
6970
07:00:53,230 --> 07:00:53,232
the course.860526
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.