Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:00,060 --> 00:00:03,209
building websites used to be simple, we had
a single design, we had to make the site look
2
00:00:03,209 --> 00:00:07,029
exactly like that design. And then we were
done. Now there's some problems with that
3
00:00:07,029 --> 00:00:10,430
browsers used to render things differently.
But at the end of the day, we just had this
4
00:00:10,430 --> 00:00:14,580
one layout to do, it was completely static,
we just had to recreate what probably a Photoshop
5
00:00:14,580 --> 00:00:18,520
document that we were given look like. And
that was it. Now we have to take design, and
6
00:00:18,520 --> 00:00:23,570
we have to make it work on every device from
sometimes a watch screen up to an 80 inch
7
00:00:23,570 --> 00:00:29,650
television. That's not necessarily something
that's super easy to do. But we have the fundamentals
8
00:00:29,650 --> 00:00:34,370
down, we understand how to make a static site.
So it's time to get into the responsive frame
9
00:00:34,370 --> 00:00:38,080
of mind. And we're going to work our way up
from getting a design to simply work on a
10
00:00:38,080 --> 00:00:42,740
single screen size, to be able to being able
to get it to work on any device, thinking
11
00:00:42,740 --> 00:00:48,250
responsively isn't easy at first. But we are
going to work our way up, we're going to be
12
00:00:48,250 --> 00:00:51,600
exploring the do's and don'ts. And we're going
to look at how we can plan things out to make
13
00:00:51,600 --> 00:00:56,400
our life a little bit easier in the long run.
But do know, this is just an introduction
14
00:00:56,400 --> 00:01:00,700
to thinking responsively we're not covering
everything there is in this module about how
15
00:01:00,700 --> 00:01:04,170
to build a responsive website, we're getting
our feet wet with it, we're gonna start looking
16
00:01:04,170 --> 00:01:09,770
at a few new things. But I don't want to overwhelm.
As I've said, before, I'd like teaching through
17
00:01:09,770 --> 00:01:12,590
projects, we get a project, we're gonna learn
the different things, we need to get that
18
00:01:12,590 --> 00:01:17,049
project to work. And then as we get into more
complex projects, we can add on more complexity
19
00:01:17,049 --> 00:01:21,420
to the CSS, so we're always adding on new
things. We're not just dumping it all on it
20
00:01:21,420 --> 00:01:24,689
first. And this module is really going to
set the stage for everything that's going
21
00:01:24,689 --> 00:01:28,909
to come, we're going to look at how to approach
a layout. So you see a late late when you
22
00:01:28,909 --> 00:01:32,210
when you see that late, what do you do? How
do you start planning, what do you how your
23
00:01:32,210 --> 00:01:35,119
system start moving forward? Before we jump
into the layouts, that we're going to look
24
00:01:35,119 --> 00:01:39,539
at CSS units, because we've seen pixels so
far, but we have a whole bunch of different
25
00:01:39,539 --> 00:01:43,600
ones, we have ones that are absolute, we have
relatives, and percentage or sort of relative
26
00:01:43,600 --> 00:01:46,840
units as well. And we're going to be looking
at all of those, we're going to be looking
27
00:01:46,840 --> 00:01:51,950
at the basics of Flexbox. And if you did the
CSS Crash Course, you touched on Flexbox,
28
00:01:51,950 --> 00:01:56,030
right at the end of it. But we didn't really
get into it, we just saw what it makes columns.
29
00:01:56,030 --> 00:02:00,659
And that was it. So this one's not going to
be a deep dive, I have a full module later
30
00:02:00,659 --> 00:02:04,579
on in the course, we're going to do a deep
dive into Flexbox to really make sure we understand
31
00:02:04,579 --> 00:02:08,679
the ins and outs of it. Because Flexbox is
complex. And again, I don't want to throw
32
00:02:08,679 --> 00:02:13,390
all this complexity at you and overwhelm you,
here's how we can start using Flexbox to just
33
00:02:13,390 --> 00:02:17,450
make things start working. And once you are
comfortable being able to do that, later on,
34
00:02:17,450 --> 00:02:21,489
we've had a lot of practice with it, we can
up the complexity on it a little bit, and
35
00:02:21,489 --> 00:02:25,939
also the basics of media queries. So media
queries are an essential tool in adapting
36
00:02:25,939 --> 00:02:29,620
our site to different screen sizes, we're
going to be seeing in this just how they can
37
00:02:29,620 --> 00:02:33,739
work and how we can start using them to make
our websites work across different sizes,
38
00:02:33,739 --> 00:02:38,290
we are going to work on a few different things.
But this is the main thing we're going to
39
00:02:38,290 --> 00:02:41,840
be focusing on, which is a three page website
that we're going to be doing and we're going
40
00:02:41,840 --> 00:02:44,930
to be making it fully responsive, we're going
to look at how we can go from the mobile view
41
00:02:44,930 --> 00:02:49,909
of that up to this full screen site just like
this one. If you need a lot of fun, I'm really
42
00:02:49,909 --> 00:02:54,079
looking forward to it. So let's jump into
the lessons and start learning how we can
43
00:02:54,079 --> 00:03:01,590
start thinking responsively. Before we can
really take a dive into making responsive
44
00:03:01,590 --> 00:03:05,970
websites, the first thing that we need to
do is take a bit of a deeper dive into CSS
45
00:03:05,970 --> 00:03:11,560
units. Because there are many different types
of units that we can use. We have absolute
46
00:03:11,560 --> 00:03:14,549
units. And this is what we've already been
using, we have relative units. And we also
47
00:03:14,549 --> 00:03:18,700
have percentage, which is a bit of a special
case. So absolute units, you've already seen
48
00:03:18,700 --> 00:03:22,349
these, this is the pixel, they're the easiest
ones to understand, because they're a fixed
49
00:03:22,349 --> 00:03:26,480
size, and they're always the same size. We
also have a whole bunch of other ones that
50
00:03:26,480 --> 00:03:30,920
you don't see come up too often your points
centimeters, millimeters inches. If you can
51
00:03:30,920 --> 00:03:36,430
think of a unit that exists in the real world,
you can use that unit in your designs. Now
52
00:03:36,430 --> 00:03:39,870
the thing that's weird about those ignoring
pixels, we're just thinking like the point
53
00:03:39,870 --> 00:03:43,099
centimeter millimeter inch, if you put your
like a ruler up on the screen, they're not
54
00:03:43,099 --> 00:03:46,150
really going to correspond to it, you shouldn't
really be using them. Unless you're doing
55
00:03:46,150 --> 00:03:51,140
print styles, you can make a stylesheet or
a set of styles for a document to be printed.
56
00:03:51,140 --> 00:03:55,499
In that case, that's fine. But the rest of
the time, if you need an absolute fixed unit
57
00:03:55,499 --> 00:03:59,920
go with your pixel, we also have percentages.
So percentages are mainly used for width.
58
00:03:59,920 --> 00:04:04,840
And they're pretty easy to understand. Because
it's a percentage that's relative to the parent.
59
00:04:04,840 --> 00:04:08,930
Now I said they're usually used for width,
because on height, things get a little weird.
60
00:04:08,930 --> 00:04:11,610
Sometimes it's relative to the height of the
parent, sometimes it's actually relative to
61
00:04:11,610 --> 00:04:14,930
the width of the parents. But we're not setting
heights very often, we're going to see some
62
00:04:14,930 --> 00:04:19,149
use cases later on in this course where we
will be setting heights. But for now we're
63
00:04:19,149 --> 00:04:22,310
going to be sticking with percentages for
width, because that's usually where we're
64
00:04:22,310 --> 00:04:26,970
going to be using them. And it makes it really
easy both to do something that's going to
65
00:04:26,970 --> 00:04:31,770
be like 80% of the whole browser window. Or
if it's children, sometimes you want to call
66
00:04:31,770 --> 00:04:37,210
them so one of them is 60%. And one of them
is 40% or 70% and 30%. And you know they're
67
00:04:37,210 --> 00:04:42,009
taking up 100% total. So it's much easier
than trying to calculate the actual pixel
68
00:04:42,009 --> 00:04:46,200
dimensions on things when you use percentages.
The last type is relative units. And there
69
00:04:46,200 --> 00:04:51,370
are two different types of relative units.
There's units that are relative to font sizes,
70
00:04:51,370 --> 00:04:55,150
and there's units that are relative to the
viewport. So the viewport is your browser
71
00:04:55,150 --> 00:04:58,920
window. In this starting to think responsively
we're not going to get into the viewport unit
72
00:04:58,920 --> 00:05:02,281
we're going to focus on the one ones that
are relative to font size, because they're
73
00:05:02,281 --> 00:05:06,600
used so much more. The viewport units have
special cases, they are definitely used in
74
00:05:06,600 --> 00:05:11,389
some situations, and we are going to look
at them in this course, just not in this module.
75
00:05:11,389 --> 00:05:16,220
Now, the idea of having units that are relative
to font size, it might sound a little bit
76
00:05:16,220 --> 00:05:19,350
complicated, but once you start playing around
with them, it's really not that bad. So as
77
00:05:19,350 --> 00:05:22,651
I said, we're only going to be paying attention
to the ones that are relative to font size
78
00:05:22,651 --> 00:05:26,789
for now, and not that the viewport units.
So the two units we're going to be seeing
79
00:05:26,789 --> 00:05:31,810
are M and REM. There are actually other ones
as well, you have a CH unit and some others,
80
00:05:31,810 --> 00:05:34,270
but we're not going to get into them. For
now we're going to focus on the M and the
81
00:05:34,270 --> 00:05:39,200
REM, because these are the ones that are used
the most often. The viewport units, just you
82
00:05:39,200 --> 00:05:44,170
know them, we have the VW VHV min V max, they
stand for the viewport width and height, and
83
00:05:44,170 --> 00:05:50,639
then the viewport minimum or maximum, which
those ones are weird, and they they have specific
84
00:05:50,639 --> 00:05:54,900
use cases. But the VW and VH are pretty handy.
We're gonna as I said, we're not going to
85
00:05:54,900 --> 00:05:58,520
get to them in this module, though. So that's
it for our quick introduction into the different
86
00:05:58,520 --> 00:06:01,900
units. In the next one, we're going to get
our hands dirty with a little bit of code.
87
00:06:01,900 --> 00:06:05,740
And since we've already been using pixels,
and which is an absolute unit a lot, we're
88
00:06:05,740 --> 00:06:09,340
going to take a dive in the next video and
look at how percentages work and get our hands
89
00:06:09,340 --> 00:06:16,389
dirty with a layout. So we're gonna start
with percentages instead of m and m just because
90
00:06:16,389 --> 00:06:21,650
it's much easier to understand how they work.
And so if we look at a layout like this, when
91
00:06:21,650 --> 00:06:24,800
we will be making this layout in the next
module of the course, once we've learned how
92
00:06:24,800 --> 00:06:27,440
to think responsibly, because we're going
to make it responsive, we're going to make
93
00:06:27,440 --> 00:06:31,789
this work on small screens up to big screens.
And that's going to be our project in the
94
00:06:31,789 --> 00:06:36,160
next one. But for now just looking at this
and thinking about it with what we know at
95
00:06:36,160 --> 00:06:40,240
the moment, I would have a set width on the
total size of this. So say I say the entire
96
00:06:40,240 --> 00:06:45,500
document here is 960 pixels. So I set a width,
I put a container on the whole thing or something
97
00:06:45,500 --> 00:06:50,199
and they say width 960 pixels. So that's fine.
And this is a common size we used to use in
98
00:06:50,199 --> 00:06:54,280
the really, really old days. And then I have
the two parts here. So I need to define an
99
00:06:54,280 --> 00:06:58,070
individual width for the left and the right
side. So I might say, well, I want that left
100
00:06:58,070 --> 00:07:03,900
side to be about 70% of that. So I need to
calculate what that is. So I do 960 times
101
00:07:03,900 --> 00:07:09,039
point seven. And that would give me 672 pixels.
So now I know the width and height, set the
102
00:07:09,039 --> 00:07:13,479
width of 672 pixels for my left side. But
then there's also the other side, and I have
103
00:07:13,479 --> 00:07:18,520
to find out the fixed pixel value for that
side. And all then I also have padding in
104
00:07:18,520 --> 00:07:22,610
there. So then I have to start subtracting
padding and doing all this. It's annoying,
105
00:07:22,610 --> 00:07:26,770
right? You don't want to have to start thinking
about all of these things. And this is for
106
00:07:26,770 --> 00:07:30,550
a fixed width. Imagine now you're trying to
bring all those numbers into it for you're
107
00:07:30,550 --> 00:07:35,350
trying to like adjust it for different screen
sizes. So instead of complicating matters,
108
00:07:35,350 --> 00:07:40,000
when we think responsibly, we want to simplify
matters a big part of thinking responsively.
109
00:07:40,000 --> 00:07:47,199
And I sorry, if I ever say respond responsibly,
they're so similar. So if we when we start
110
00:07:47,199 --> 00:07:51,759
to think responsively, it's all about trying
to simplify and not complicate matters. So
111
00:07:51,759 --> 00:07:55,229
you remember this layout, we just finished
it. But let's say we wanted to turn this into
112
00:07:55,229 --> 00:08:00,389
a more responsive layout, instead of the fixed
layout like we have. Now, we can do that.
113
00:08:00,389 --> 00:08:05,009
So let's go and take a look at how we can
do it. And you can probably guess the one
114
00:08:05,009 --> 00:08:08,880
thing that we really need to change is this
fixed container width, because right now it
115
00:08:08,880 --> 00:08:13,500
has a width of 620 pixels. So we have a set
width on that container. I'm also going to
116
00:08:13,500 --> 00:08:17,360
turn this border back on, just so we can really
visualize what's happening. While we're playing
117
00:08:17,360 --> 00:08:21,000
with this, I'm gonna save that for the moment,
we're gonna come and take a look at it. And
118
00:08:21,000 --> 00:08:25,539
you can see when I play with the screen size,
we're set at 620 pixels. So it's working at
119
00:08:25,539 --> 00:08:30,340
big screens. But if we go smaller, all of
a sudden, I run into this problem where I
120
00:08:30,340 --> 00:08:36,200
have side scrolling. So I get a scroll bar
to go left and right. Because my screen is
121
00:08:36,200 --> 00:08:40,909
too small for the content that's in there,
my content is wider than my viewport width.
122
00:08:40,909 --> 00:08:44,820
And that causes the side scrolling issue.
So if I was going to open this page on a cell
123
00:08:44,820 --> 00:08:49,040
phone, that would it just wouldn't work, right,
I wouldn't get this issue, I wouldn't be able
124
00:08:49,040 --> 00:08:52,220
to see it, I get this weird problem there
that I'm not even going to worry about right
125
00:08:52,220 --> 00:08:57,260
now. It just does not look good. So how can
we fix it, as I mentioned, we want to change
126
00:08:57,260 --> 00:09:01,880
this from a set width to a percentage. So
what I want you to do right now is change
127
00:09:01,880 --> 00:09:05,810
this over to a percentage, it has to be 100%
or less, and I would go with less than 100%,
128
00:09:05,810 --> 00:09:09,810
it would defeat the purpose of the container.
If not, try different sizes, see what they
129
00:09:09,810 --> 00:09:14,740
look like play around with the screen size
in the player here. And then once you're happy,
130
00:09:14,740 --> 00:09:18,380
and you sort of see what's going on, I'm going
to dive in and we'll look into it in a little
131
00:09:18,380 --> 00:09:25,500
bit more detail. Great, so um, you know, it's
pretty evident, let's say I do 50% on this,
132
00:09:25,500 --> 00:09:29,950
I think it's obvious what's going to happen
is those containers are now 50% of the total
133
00:09:29,950 --> 00:09:33,660
screen size, you might have got a little surprise
with your image sticking off the side. And
134
00:09:33,660 --> 00:09:37,600
we'll get to that in a little bit. But we
can see with the container. Now as I grow
135
00:09:37,600 --> 00:09:42,820
or shrink my screen. That container is adjusting
itself automatically, which is pretty cool,
136
00:09:42,820 --> 00:09:47,920
I think. Because we know the containers with
this set to 50%. I know I have 25% on the
137
00:09:47,920 --> 00:09:52,540
left there and 25% on the right leftover.
So that's pretty cool that I can sort of make
138
00:09:52,540 --> 00:09:58,120
this container that adapts to my screen size.
Now the problem is my image. So before we
139
00:09:58,120 --> 00:10:01,310
see how we can actually fix that thing, that's
going With the image and understanding that
140
00:10:01,310 --> 00:10:07,440
what I really want you to understand is what
is this 50% of. So if my container is 50%,
141
00:10:07,440 --> 00:10:12,360
it's always going to be 50% of its parent.
So we have a few different containers here.
142
00:10:12,360 --> 00:10:19,200
As we can see, this container here is 50%
of section one, this one is 50% of my header,
143
00:10:19,200 --> 00:10:25,360
and this one is 50% of section two. Now, my
header, my section one, and my section two
144
00:10:25,360 --> 00:10:31,310
don't have widths on them. And block level
elements, by default have a width of 100%.
145
00:10:31,310 --> 00:10:36,160
So section one, Section two, and my header
are all 100% of my screen size. So that just
146
00:10:36,160 --> 00:10:40,730
means that my container ends up being 50%
of my screen size. Now what would happen if
147
00:10:40,730 --> 00:10:48,300
I came and set a width of 500 pixels on my
header? Can you take a guess, before you come
148
00:10:48,300 --> 00:10:53,170
in, look at what's actually happening on the
page, what do you think has happened to the
149
00:10:53,170 --> 00:10:57,519
container that was inside my header. So let's
go and take a look at it. And you can see
150
00:10:57,519 --> 00:11:05,980
that I've limited my header to 500 pixels,
and this container is 50% of that 500. So
151
00:11:05,980 --> 00:11:12,880
I had 25% there, 50% here, and then another
25% there. So this container is now smaller
152
00:11:12,880 --> 00:11:17,280
than this container on this side. Because
each one is only looking at its parent, and
153
00:11:17,280 --> 00:11:21,150
it's not looking at anything else, then normally,
I'm not gonna have a set width on something,
154
00:11:21,150 --> 00:11:24,420
because that makes that whole thing look pretty
ugly. So we're gonna get rid of that and go
155
00:11:24,420 --> 00:11:30,209
back and take a look at it. And there we go,
we fixed that. So just remember, always, when
156
00:11:30,209 --> 00:11:34,680
you're using a percentage, if that percentage
is always relative to its parent, but a lot
157
00:11:34,680 --> 00:11:39,720
of the time the parent is defaulting to 100%,
we're going to run into situations where maybe
158
00:11:39,720 --> 00:11:43,040
that's a little bit different. Even if you
feel a little bit confused right now, in the
159
00:11:43,040 --> 00:11:46,829
long run, it does actually make our lives
much, much, much easier. I'm going to leave
160
00:11:46,829 --> 00:11:49,899
this video for here. So you can play around
with it a little bit, make sure you really
161
00:11:49,899 --> 00:11:53,699
understand how that's working. If you're a
little bit unclear, try playing with the width
162
00:11:53,699 --> 00:11:57,440
of your header of your section one in your
section two to really see how this affects
163
00:11:57,440 --> 00:12:01,399
it and then maybe even play around with this
width as a percentage, just to really make
164
00:12:01,399 --> 00:12:04,820
sure it's clear. And then once you figure
that out, in the next video, we're going to
165
00:12:04,820 --> 00:12:12,810
look at how we can fix that problem that's
going on with the image. Okay, so we have
166
00:12:12,810 --> 00:12:17,200
our containers that are set at 50% of our
total screen size. But we have this really
167
00:12:17,200 --> 00:12:22,230
awkward problem that's going on with our image,
our image just does not look very good when
168
00:12:22,230 --> 00:12:26,410
it's sticking out the side like that. So how
can we fix it? Can you think of a way that
169
00:12:26,410 --> 00:12:29,899
we could solve that problem? Is there something
that we've looked at so far that would solve
170
00:12:29,899 --> 00:12:33,589
it, because we have all the tools, we need
to be able to fix that. So see if you can
171
00:12:33,589 --> 00:12:37,060
think about it coming to code, try playing
around with something and see if you can solve
172
00:12:37,060 --> 00:12:43,899
the width of the image. So hopefully, what
you thought of is you can actually set a width
173
00:12:43,899 --> 00:12:48,420
on your image. So if we take a look here,
images are a little bit weird. And what you
174
00:12:48,420 --> 00:12:53,160
probably don't remember is when we first were
looking at block and inline, I mentioned that
175
00:12:53,160 --> 00:12:57,990
images are actually an inline element, they
can flow with text, if I put an image in a
176
00:12:57,990 --> 00:13:03,170
paragraph, the text on that line will will
actually flow with a put that image in the
177
00:13:03,170 --> 00:13:06,630
paragraph itself, they're a bit of a special
case, there's things that are a little bit
178
00:13:06,630 --> 00:13:10,030
different with them, but they are technically
an inline element. So they're not defaulting
179
00:13:10,030 --> 00:13:14,400
to 100% when they're defaulting to the size
of themselves what that size of the image
180
00:13:14,400 --> 00:13:19,899
is. So what we can actually do is we can come
in, and I like grouping it sort of here with
181
00:13:19,899 --> 00:13:25,139
all the other things that I'm doing in the
general area instead of the more specific
182
00:13:25,139 --> 00:13:30,620
areas where I'm styling things. And I can
select my images. So IMG. I'm not putting
183
00:13:30,620 --> 00:13:35,350
a dot, I'm not putting anything else because
I'm selecting my image itself. So I'm going
184
00:13:35,350 --> 00:13:39,040
to select my image, I'm gonna give this a
width. Now this width for now, I'm going to
185
00:13:39,040 --> 00:13:43,740
give this a width of 250 pixels. It's a set
unit, we're not going to leave it there. But
186
00:13:43,740 --> 00:13:49,480
just to show you what that does. So look at
that my my image size has shrunk down, the
187
00:13:49,480 --> 00:13:53,320
one thing you have to be really careful with
if you set a width on an image is not to also
188
00:13:53,320 --> 00:13:58,910
set a height to it. Because if I set a height
on this image, which you can do, it will actually
189
00:13:58,910 --> 00:14:02,660
end up stretching the image and distorting
it and making it look really, really ugly.
190
00:14:02,660 --> 00:14:07,050
Whereas if you only put one or the other,
so I could say a height, or I could say a
191
00:14:07,050 --> 00:14:11,930
width, either one is going to work. And if
I if I only have one of them, it's automatically
192
00:14:11,930 --> 00:14:16,019
going to handle the second property. So it's
going to keep it in proportion instead of
193
00:14:16,019 --> 00:14:19,279
stretching it. So you know now that we can
set a width on an image, how do you think
194
00:14:19,279 --> 00:14:25,620
we can get that image to match the size of
the container? So hopefully, you said use
195
00:14:25,620 --> 00:14:30,070
a percentage. And what I want you to do is
set it and see if you picked the right percentage
196
00:14:30,070 --> 00:14:34,420
try and set and actual size on this using
percentage and see if it's fitting the way
197
00:14:34,420 --> 00:14:41,740
you think it would. Alright, so there's two
answers people usually think of one of them
198
00:14:41,740 --> 00:14:46,480
is to give it a width of 100%. And the other
one is a width of 50%. And the reason a lot
199
00:14:46,480 --> 00:14:52,639
of people think a 50% is because on my container,
we gave that a width of 50% here. So if this
200
00:14:52,639 --> 00:15:00,089
has a width of 50% it makes sense to give
the image a width of 50%. But if you did that
201
00:15:00,089 --> 00:15:03,440
You might have noticed it didn't work is pretty
small. But if you shrink this, you'll see
202
00:15:03,440 --> 00:15:07,950
it's it is growing and shrinking with my page.
So the percentage is working, just not what
203
00:15:07,950 --> 00:15:13,500
we thought it was. So we just have to remember
what I said before about how percentages work,
204
00:15:13,500 --> 00:15:18,200
a percentage is always based on the width
of the parent. So if we come in, we look in
205
00:15:18,200 --> 00:15:23,540
our index here, when we set the width of the
container, this was 50%, of the width of section
206
00:15:23,540 --> 00:15:29,009
one, which automatically was the full size
of my screen. So it ends up being 50% of my
207
00:15:29,009 --> 00:15:34,620
screen width. This image, on the other hand,
its parent is the container itself. So this
208
00:15:34,620 --> 00:15:40,800
image is whatever percentage I set for a width
and image will be a percentage of this container
209
00:15:40,800 --> 00:15:47,630
width. So if we come into my styles, now,
my image actually wanted to be 100%. So if
210
00:15:47,630 --> 00:15:52,519
we go and look, again, we can see that it
has been fixed. And now whatever I do here,
211
00:15:52,519 --> 00:15:57,139
my image is going to grow and shrink with
the size of that container, and match everything
212
00:15:57,139 --> 00:16:01,839
that's around it, which just makes the layout
work much better. So if I come down and get
213
00:16:01,839 --> 00:16:06,120
rid of that magenta border, and we go and
look at it again, we can see that it looks
214
00:16:06,120 --> 00:16:11,459
nice and fancy, and it fits well. With the
overall look of the document, the only thing
215
00:16:11,459 --> 00:16:15,579
is a 50% width is a little bit small. So if
I come down to this, everything is getting
216
00:16:15,579 --> 00:16:20,660
a little bit smushed, I'd rather that it's
sticking closer to the sides. And I'm not
217
00:16:20,660 --> 00:16:25,800
getting like this massive, it's almost acting
like padding. You know, look how small that
218
00:16:25,800 --> 00:16:31,089
images, I can barely see it. So it's really
common to not have a width of at 50%. But
219
00:16:31,089 --> 00:16:35,200
to do like a 90% or something like that, because
on small screens, that's going to look a lot
220
00:16:35,200 --> 00:16:39,589
better. That's sort of that that cell phone
type of look that you're probably used to
221
00:16:39,589 --> 00:16:45,199
having and seeing. But as this gets bigger,
we do at one point, now we're getting too
222
00:16:45,199 --> 00:16:51,149
big lines of text going from one side all
the way to the other is really, really awkward.
223
00:16:51,149 --> 00:16:55,171
So we want to try and avoid having text that
stretches from one side to the other. Like
224
00:16:55,171 --> 00:17:02,490
what's happening right now. And the next video,
we're going to look at how we can do that.
225
00:17:02,490 --> 00:17:06,300
We've got our layout working, it's looking
nice and dandy, but it's getting too big.
226
00:17:06,300 --> 00:17:10,630
Now when we're getting up to these big sizes,
we don't want that to happen. What we can
227
00:17:10,630 --> 00:17:13,760
do to do that is a new property, we're not
worrying about a new value. Right now we're
228
00:17:13,760 --> 00:17:17,810
thinking of a new property, it works with
the width. And you probably saw the name of
229
00:17:17,810 --> 00:17:22,599
this lesson was min and max width, so we can
actually set a width and a maximum or minimum
230
00:17:22,599 --> 00:17:27,099
width on an element as well. So I'm going
to come and put that border back on here of
231
00:17:27,099 --> 00:17:33,160
two pixels solid magenta, just so we can really
see what's happening once again. And let's
232
00:17:33,160 --> 00:17:38,300
come and give this we have a width of 90%.
But I'm also going to give it a max width
233
00:17:38,300 --> 00:17:43,260
of 600 pixels. Let's do 620 because that was
our original design. So we'll stick with the
234
00:17:43,260 --> 00:17:48,900
620 that we originally had. So now if we come
and take a look at this, and I refresh, you're
235
00:17:48,900 --> 00:17:53,540
gonna see it's it's working in our small screen
sizes, or containers growing, it's staying
236
00:17:53,540 --> 00:17:59,490
at 90%. But at one point, it's going to get
locked into play. And right around here, it
237
00:17:59,490 --> 00:18:05,200
stops growing, because it's hit its maximum
width. And that means at large screen sizes,
238
00:18:05,200 --> 00:18:09,970
my text and line lengths aren't going to get
too long. But at small screens, everything
239
00:18:09,970 --> 00:18:14,381
works nice and perfectly. So we've sort of
got the best of both worlds going now, we
240
00:18:14,381 --> 00:18:19,211
can set a set value for the maximum size we
want, where we can keep a percentage to let
241
00:18:19,211 --> 00:18:24,130
it shrink when we want it to, we can also
set a min width. So if I came on here and
242
00:18:24,130 --> 00:18:28,200
said min width, I'm going to set it pretty
big of 500 pixels, I wouldn't normally do
243
00:18:28,200 --> 00:18:33,920
this on the container. But just for demonstration
purposes, we have our max, so it's never going
244
00:18:33,920 --> 00:18:39,620
to grow bigger than 620. And if I go this
way, it will never get smaller than 500. So
245
00:18:39,620 --> 00:18:44,040
when I hit 500 pixels, you can see it stops.
And then I get sidescrolling again, which
246
00:18:44,040 --> 00:18:49,260
is why I wouldn't set a min width on my container.
But it does demonstrate how that property
247
00:18:49,260 --> 00:18:52,930
works. So for now, I'm going to take this
off, I just wanted to introduce the idea of
248
00:18:52,930 --> 00:18:56,700
the minimum width in there. But for the max
width, I will leave it on there, when we're
249
00:18:56,700 --> 00:19:01,510
starting to think respond responsively for
the container, this is a really really common
250
00:19:01,510 --> 00:19:06,650
property to set on something to give a maximum
size, that size really depends on the layout
251
00:19:06,650 --> 00:19:10,060
and what you're building. So I'm not going
to say that there's a specific MAX SIZE that
252
00:19:10,060 --> 00:19:13,700
you should be going, you will base it on the
design that you're doing, I will be going
253
00:19:13,700 --> 00:19:19,230
more in depth some best practices for total
length and total sizes in a little bit. Interestingly
254
00:19:19,230 --> 00:19:23,720
enough, if you put your max width above your
width, it's still going to work because there
255
00:19:23,720 --> 00:19:28,200
are two different values max width and width
are two different ones. Same with min width,
256
00:19:28,200 --> 00:19:32,040
you can put them in any order in your CSS
and it won't have an effect, it's going to
257
00:19:32,040 --> 00:19:35,830
work no matter what. So play around with them,
see if you can get used to it or figure it
258
00:19:35,830 --> 00:19:38,870
out. If it's something that you're finding
a little bit confusing, don't stress about
259
00:19:38,870 --> 00:19:42,520
it too much. We're gonna be using these a
lot in the following projects that we're going
260
00:19:42,520 --> 00:19:46,100
to be building, it's just gonna help reinforce
it, the more we use it, so you'll get the
261
00:19:46,100 --> 00:19:54,810
hang of it in no time. So we're moving on
to the M unit. But if you're wanting to get
262
00:19:54,810 --> 00:19:58,230
more practice with percentages, don't worry.
We're going to get a lot we're going to be
263
00:19:58,230 --> 00:20:02,220
using them throughout this course. But there's
two others that we really need to look into.
264
00:20:02,220 --> 00:20:06,050
So a quick recap on what relative units are,
they call them relative units, because they're
265
00:20:06,050 --> 00:20:10,270
relative to something else, they're either
relative to a font size, or to the size of
266
00:20:10,270 --> 00:20:15,120
a viewport. So the M and the ram are both
relative to the font size of other elements.
267
00:20:15,120 --> 00:20:19,820
So M's are always relative to their parents
font size, and the font size is an inherited
268
00:20:19,820 --> 00:20:22,950
property. So if you don't declare it anywhere,
it's getting it from the size that you set
269
00:20:22,950 --> 00:20:26,620
on the body. And if you didn't set it, the
body is actually inheriting it from the root
270
00:20:26,620 --> 00:20:31,770
the HTML element, and that has the the 16
sit on it. Now that I say by default, his
271
00:20:31,770 --> 00:20:36,590
people can override the font size in the browser
in their settings. And so that can actually
272
00:20:36,590 --> 00:20:40,190
change what the default is on that property.
But we're not going to worry about that at
273
00:20:40,190 --> 00:20:46,151
all right now. But let's go and take a look
at how they work. So I've kept the site that
274
00:20:46,151 --> 00:20:49,800
we were already working on, but I've deleted
some stuff. And we're gonna be playing around
275
00:20:49,800 --> 00:20:56,200
with this a little bit. So before we get into
the unit itself, I want you to think way back,
276
00:20:56,200 --> 00:21:00,280
and we're going to create a list. So remember
how lists work, you can do either an ordered
277
00:21:00,280 --> 00:21:03,840
or unordered list, I really don't mind, see
if you can remember how they are. But if you
278
00:21:03,840 --> 00:21:07,680
don't, that's okay, it's been a long time
since we've seen a list. But do your best
279
00:21:07,680 --> 00:21:12,360
to try and remember, before I go and put one
in here and just give it like 234 elements,
280
00:21:12,360 --> 00:21:16,030
make sure there's not just one list item in
there, but there should be multiple list items
281
00:21:16,030 --> 00:21:21,600
in there. Alright, so I'm going to go ahead
and create my own list, I'm going to do an
282
00:21:21,600 --> 00:21:26,150
unordered list. So it's a ul, and I'm going
to close that ul. And I'm going to come into
283
00:21:26,150 --> 00:21:32,250
here and just create a few list items. So
open and close Li and I'm going to put in
284
00:21:32,250 --> 00:21:35,790
a few here. And I'll fast forward while I
put the content inside of these. Alright,
285
00:21:35,790 --> 00:21:40,420
so let's go and take a look quickly at what
my list looks like there. So we have a bulleted
286
00:21:40,420 --> 00:21:45,050
list since I used an unordered list. And we
can start styling things up a little bit.
287
00:21:45,050 --> 00:21:48,790
So let's come over to my CSS file here. And
what I'm going to do is I'm going to set my
288
00:21:48,790 --> 00:21:55,870
URL to have a font size of one M. And when
I do that, nothing's actually going to change
289
00:21:55,870 --> 00:22:00,400
because one means copy the font size of the
parent, now the parent doesn't have a font
290
00:22:00,400 --> 00:22:04,501
size on it. So it's going to go down and down
and down until it finds something that does
291
00:22:04,501 --> 00:22:10,730
have a font size on it. So the font size is
being declared all the way up here on my body.
292
00:22:10,730 --> 00:22:16,680
So the font size is 18 pixels here. So that
means if I change this 18 pixels to say 25
293
00:22:16,680 --> 00:22:22,900
pixels, everything stays the same. So my paragraphs
got bigger, this got bigger because as an
294
00:22:22,900 --> 00:22:26,710
inherited property, it's sort of the same
as setting something as one m, you're saying
295
00:22:26,710 --> 00:22:32,150
match, one M is saying match the font size
of the parent. So it won't actually have an
296
00:22:32,150 --> 00:22:36,682
effect, where it will have an effect is and
I'm going to bring my URL all the way to the
297
00:22:36,682 --> 00:22:43,120
top here, just so I don't have to scroll up
and down. If I change this font size to 1.5,
298
00:22:43,120 --> 00:22:51,890
that's the same as saying that this is so
1.5 m is equal to 150% of the font size of
299
00:22:51,890 --> 00:22:56,480
the parent. So we can go and look at how that
would work. So if I refresh, now, this is
300
00:22:56,480 --> 00:23:03,260
massive. It's now 150%, the size of my paragraphs
here, which are the 25 pixel. So whatever
301
00:23:03,260 --> 00:23:09,510
I change on here, if I change this down to
10 pixels, this will now so it'd be 1.5. m
302
00:23:09,510 --> 00:23:14,490
is 150%. So that means in this case, it would
be equal to 15 pixels. So you can do a quick
303
00:23:14,490 --> 00:23:18,450
math to figure out exactly as you can see,
this is super, super tiny, down here at the
304
00:23:18,450 --> 00:23:24,910
bottom. Where is this list, at least it's
at a readable size. So it's always a relative
305
00:23:24,910 --> 00:23:29,670
unit. But as I said, it's always relative
to its parent. So in this case, it's inside
306
00:23:29,670 --> 00:23:37,520
of section one. So if I said section one has
a font size of 20 pixels, this font size is
307
00:23:37,520 --> 00:23:46,070
now 30 pixels, because it's going to be 1.5
times bigger than the font size of its parent.
308
00:23:46,070 --> 00:23:50,780
So it's always a font size that is relative
to its parent. Now, you may be wondering why
309
00:23:50,780 --> 00:23:55,160
we'd want to do that. But imagine on these,
let's get rid of this for the moment, I'm
310
00:23:55,160 --> 00:23:59,510
going to comment it out because we're going
to need that later. But let's say on my h1
311
00:23:59,510 --> 00:24:04,371
here, instead of setting a font size of 36
pixels, I said this is three M and then I
312
00:24:04,371 --> 00:24:13,130
said this one here is two M. And then I have
my body which is set to say 16 pixels for
313
00:24:13,130 --> 00:24:19,730
now. So if I come and take a look at that,
everything is sized and it's all looking good.
314
00:24:19,730 --> 00:24:24,650
But if I come and change this number, and
I set this to 10 pixels, everything is going
315
00:24:24,650 --> 00:24:29,890
to adjust with that. So now all of those units
have automatically adjusted in size. My headings
316
00:24:29,890 --> 00:24:34,650
are smaller, my list is smaller, my paragraphs
are smaller, my headings have shrunk, everything
317
00:24:34,650 --> 00:24:39,500
is reacting together instead of each being
a completely separate unit. And this can be
318
00:24:39,500 --> 00:24:43,640
really, really handy, where you can change
one font size and have it affect your entire
319
00:24:43,640 --> 00:24:48,210
site. It's very handy. It's very useful, but
there is a big problem with EMS. We're going
320
00:24:48,210 --> 00:24:51,800
to see what that is in the next video. Before
we get there though, if you want to just play
321
00:24:51,800 --> 00:24:56,210
around in here, try different sizes. See if
you can get the hang of it play around maybe
322
00:24:56,210 --> 00:25:01,490
with your h1 and h2 sizes, and then modifying
this type Playing with apparent font sizes
323
00:25:01,490 --> 00:25:05,500
if you want to, and just get a little bit
of a handle of how it's working. Just like
324
00:25:05,500 --> 00:25:09,500
percentages, though, these are units we're
going to be using a lot from now on, I just
325
00:25:09,500 --> 00:25:12,860
want you to get a vague idea of how they're
working before we dive in and start using
326
00:25:12,860 --> 00:25:17,010
them a lot. So even if it's a little bit weird,
right now, it will be something you get used
327
00:25:17,010 --> 00:25:24,170
to a lot faster than you might think. So as
I mentioned, at the end of the last video,
328
00:25:24,170 --> 00:25:28,860
there is a problem with the M unit, M's are
super convenient. For some things, we're going
329
00:25:28,860 --> 00:25:33,590
to see some use cases where I use them all
the time. But when we use them for font size,
330
00:25:33,590 --> 00:25:37,580
it can create this weird cascading effect
where things just get out of control. And
331
00:25:37,580 --> 00:25:42,470
it can be really, really mad. So if we come
and look, I'm just continuing where we left
332
00:25:42,470 --> 00:25:47,780
off, nothing is different from before, what
I'm going to do is up here, I'm going to keep
333
00:25:47,780 --> 00:25:52,070
my font size at 10 pixels. So it's really,
really tiny on my body. But what I'm going
334
00:25:52,070 --> 00:25:58,600
to do on section one is I'm going to give
section one, a font size to two M. So the
335
00:25:58,600 --> 00:26:03,710
font size on my section one is twice as big
as on the rest of it. But if we come and look
336
00:26:03,710 --> 00:26:09,840
at what's actually happened is now this is
an h2 and this is an h2. But this h2 is huge.
337
00:26:09,840 --> 00:26:15,850
And why is it so much bigger, and this is
size 10. This is not 1.5 times bigger than
338
00:26:15,850 --> 00:26:22,950
that this is not 15 pixels, but I have my
list here is set to 1.5 M. So why is it so
339
00:26:22,950 --> 00:26:25,880
gigantic, I mean, what's going on. And to
make matters even worse, why not? You know,
340
00:26:25,880 --> 00:26:30,570
you can make this even crazier. on my list
items themselves, if I decided to set a font
341
00:26:30,570 --> 00:26:37,310
size of 1.5 m just for fun, you know why not?
All of a sudden, they're massive, you know,
342
00:26:37,310 --> 00:26:40,911
this is getting out of control, literally
getting out of control. And if you had other
343
00:26:40,911 --> 00:26:45,680
nested elements, it can get even worse and
worse and worse, because it's looking at the
344
00:26:45,680 --> 00:26:50,730
font size of the parent. So right now my list
item is looking at the font size of my list,
345
00:26:50,730 --> 00:26:56,510
and it's gonna be 1.5 times bigger than my
list. So it's doing this multiplication through
346
00:26:56,510 --> 00:27:01,920
all of these different elements until it finally
you know, multiplies all throwing from 10
347
00:27:01,920 --> 00:27:07,620
times two. So we're at 20 times 1.5, we're
hitting 30. And then we're going to use 1.5.
348
00:27:07,620 --> 00:27:12,800
So you know it's getting massive, it's just
getting out of control big. That's also why
349
00:27:12,800 --> 00:27:18,310
my section one has a font size of two M, my
h2 has a font size of two M. So we're getting
350
00:27:18,310 --> 00:27:23,550
that cascading effect even here. Which is
why if we look here, my h2 at the top here
351
00:27:23,550 --> 00:27:27,910
is a lot bigger than the h2 that's down here,
even though their font size is set to the
352
00:27:27,910 --> 00:27:34,980
same value. And it's because it's this one
is multiplying that two M by the 1.5 m to
353
00:27:34,980 --> 00:27:39,940
get to this total gigantic size. If you're
really good, and you're really know how to
354
00:27:39,940 --> 00:27:43,940
control this stuff, maybe you can do this
on purpose and get away with it. But there's
355
00:27:43,940 --> 00:27:48,690
a solution that just makes our lives so much
easier. So I don't do this, I don't mess around
356
00:27:48,690 --> 00:27:56,070
with AMS for fun sighs so let's go and see
what the solution is. Before I go into the
357
00:27:56,070 --> 00:27:59,960
solution, which is the REM unit, I just don't
want to poop on the M too much. It is a super
358
00:27:59,960 --> 00:28:03,510
useful unit. And after we've seen these two
and we understand what a REM is, I'm going
359
00:28:03,510 --> 00:28:07,790
to go into when we might want to choose which
one and hopefully make all of it a lot more
360
00:28:07,790 --> 00:28:12,160
clear on why both of these are super useful
and super important when we start thinking
361
00:28:12,160 --> 00:28:18,440
responsively. So the REM is an M, but it's
short for root m. And what does that mean?
362
00:28:18,440 --> 00:28:23,010
Well, it means it's always instead of being
relative to the parent like the M is it's
363
00:28:23,010 --> 00:28:27,320
always relative to the root of our document.
And I've used the word route a few times.
364
00:28:27,320 --> 00:28:31,870
And the root of an HTML page is always the
HTML element itself. That's where a lot of
365
00:28:31,870 --> 00:28:35,580
the defaults are coming from, even though
we haven't actually been styling that in our
366
00:28:35,580 --> 00:28:39,210
CSS up until now. So you may be wondering
how does this make our life easier. And let's
367
00:28:39,210 --> 00:28:44,770
go and take a look at how. So remember right
now we get these giant sizes coming in. Even
368
00:28:44,770 --> 00:28:49,170
though this is set to two m and this is set
to two M, this one is getting gigantic, it's
369
00:28:49,170 --> 00:28:55,480
getting out of control, because it's two m
times 1.5 m, and it's scaling up and it's
370
00:28:55,480 --> 00:29:00,870
a compounding factor that's going on. Whereas
if we use root m, we lose that. So on my font
371
00:29:00,870 --> 00:29:05,440
sizes here, I'm going to switch that to an
REM instead of an M. And the same thing here.
372
00:29:05,440 --> 00:29:09,700
And the same thing here. And the same thing
on my headings. And let's go and take a look
373
00:29:09,700 --> 00:29:14,160
at it right away without doing anything else.
And look at that this font size is now the
374
00:29:14,160 --> 00:29:19,320
same as this font size. And this is a lot
bigger than this one. But that's because I
375
00:29:19,320 --> 00:29:24,130
do have my font size set to one and a half
REM here. So this font size will be bigger,
376
00:29:24,130 --> 00:29:28,660
I guess we'll get rid of that comment because
it doesn't really apply anymore. And here
377
00:29:28,660 --> 00:29:32,790
we used to have that double compounding factor
that was going on my list item was compounding
378
00:29:32,790 --> 00:29:37,940
through this which was then compounding again
through that. If I take this off now and we
379
00:29:37,940 --> 00:29:42,830
take a look, it's going to look exactly the
same because it's just set to that one size
380
00:29:42,830 --> 00:29:47,311
that's relative to the HTML element. But you
remember that cool thing with me is when I
381
00:29:47,311 --> 00:29:51,350
change the font size of my body and everything
just worked around that and sort of scaled
382
00:29:51,350 --> 00:29:55,860
up and down with that one unit. So it's almost
like EMS and rems Ramos a creating a scale
383
00:29:55,860 --> 00:30:01,150
instead of creating these set font sizes.
So what we can do is on our tml element, we
384
00:30:01,150 --> 00:30:06,710
can set a font size on here. So I'm gonna
say a font size of 10 pixels. And we go and
385
00:30:06,710 --> 00:30:11,110
take a look at what that's done. Everything
has shrunk down, everything on this page has
386
00:30:11,110 --> 00:30:16,510
gotten a lot smaller. And if I come on the
HTML element here, and I make this 30 pixels,
387
00:30:16,510 --> 00:30:19,620
everything will have gotten much, much, much
bigger except for this paragraph, why hasn't
388
00:30:19,620 --> 00:30:25,310
that paragraph gotten bigger? What's going
on? Can you figure it out? See if Remember,
389
00:30:25,310 --> 00:30:29,380
the paragraph is inheriting its font size,
the section two doesn't have a font size on
390
00:30:29,380 --> 00:30:33,700
it, nothing that is contained except for the
body has it. And this is an absolute unit,
391
00:30:33,700 --> 00:30:38,100
it's not relative to anything, we have this
in the pixel. So this is where it's sitting,
392
00:30:38,100 --> 00:30:43,170
and it will not change. So we've, what we've
managed to do. So if we switch this over from
393
00:30:43,170 --> 00:30:50,230
that to one M, and M by one m, I do mean one
REM for font size, I'm always going to stick
394
00:30:50,230 --> 00:30:55,210
with rems. And you can see here what's happened
is, everything is going to keep that nice
395
00:30:55,210 --> 00:30:59,610
scaling feature where everything is scaling
up or down with something else without the
396
00:30:59,610 --> 00:31:04,450
possibility of running into that compounding
issue. Now the one thing I wouldn't actually
397
00:31:04,450 --> 00:31:09,030
do is set a set font size on my HTML element
like this. Usually, I'm just leaving it at
398
00:31:09,030 --> 00:31:13,670
the default. Or I might use a percentage if
I need to play with it. And you'll see some
399
00:31:13,670 --> 00:31:18,630
people recommend setting the percentage really
low here to shrink things. If you set it to
400
00:31:18,630 --> 00:31:26,130
62.5%. This makes the default, which was 16,
now become 10. So when you instead of having
401
00:31:26,130 --> 00:31:32,190
to think of one rim as 16 pixels, and then
it's hard to do math, like what 16 times 1.5.
402
00:31:32,190 --> 00:31:36,790
It's easy now because this is 10, and then
that becomes 10. So this is 20. This is 15,
403
00:31:36,790 --> 00:31:41,010
it makes it much easier to think that way.
I don't do that I you did for a little while,
404
00:31:41,010 --> 00:31:44,880
because it is easier, I will admit, but after
some time, you really do get used to working
405
00:31:44,880 --> 00:31:49,250
on the scale of 16 pixels. And when you need
to scale this up, and you're gonna see when
406
00:31:49,250 --> 00:31:53,650
we start getting into mobile, when we start
doing different designs you're going to have
407
00:31:53,650 --> 00:31:56,961
on a mobile screen, you're probably gonna
have a smaller font size. And when you get
408
00:31:56,961 --> 00:32:01,730
to a bigger screen, you will up the font size,
you can up the scale on it. But instead of
409
00:32:01,730 --> 00:32:06,250
using the percentage, maybe you just keep
this at 100 as the default and then the bigger
410
00:32:06,250 --> 00:32:11,640
size, you just bumped it up to 110 and everything
or 120. And everything just scales up with
411
00:32:11,640 --> 00:32:17,220
it. So I tend to just not even bother with
this and I leave my rems like that and play
412
00:32:17,220 --> 00:32:20,530
around with it. And I've gotten used to doing
that. And that's how I'm going to be working
413
00:32:20,530 --> 00:32:24,620
throughout the rest of this course. So you
will get a chance to see and I'm going to
414
00:32:24,620 --> 00:32:27,691
explain myself every time I'm using these
units, especially for the next little while,
415
00:32:27,691 --> 00:32:31,960
while we're doing them, including the next
video where I'm going to explain that ends
416
00:32:31,960 --> 00:32:35,480
still do have a purpose. And we're going to
see what the purpose is, and how I decide
417
00:32:35,480 --> 00:32:43,500
between m and REM and what my rule of thumb
for them is. Alright, so we've seen percentages,
418
00:32:43,500 --> 00:32:46,970
we've seen EMS, we've seen RAMs, of course,
we've seen pixels. So how do we decide which
419
00:32:46,970 --> 00:32:52,870
one to use, and in what situation if we go
back to pixels, and when we're using them
420
00:32:52,870 --> 00:32:57,690
a bit of a history lesson before we move forward,
the pixels used to cause some pretty big problems
421
00:32:57,690 --> 00:33:02,360
because they were fixed unit but not in the
same way like a centimeter is because the
422
00:33:02,360 --> 00:33:05,800
centimeter is you take a measure and you can
measure it, whereas a pixel was a.on your
423
00:33:05,800 --> 00:33:11,090
screen. And that's technically what a pixel
really is. But in CSS, the pixel doesn't look
424
00:33:11,090 --> 00:33:15,320
at the dots on the screen anymore. It now
follows what we call the reference pixel.
425
00:33:15,320 --> 00:33:19,840
A reference pixel is a fixed size. And they
had to come up with a solution because the
426
00:33:19,840 --> 00:33:23,990
problem was we started getting these devices
that were different resolutions. So imagine
427
00:33:23,990 --> 00:33:28,310
if you had a retina display and a regular
display, and you set something to 18 pixels,
428
00:33:28,310 --> 00:33:32,180
it looked fantastic on your normal screen.
But on that Retina display, it would be half
429
00:33:32,180 --> 00:33:36,460
that size, and then just be really small.
And so we couldn't set things in pixels at
430
00:33:36,460 --> 00:33:41,300
all. So AMS and Rams verse, you know, we needed
them pretty much. But the reference pixel,
431
00:33:41,300 --> 00:33:45,560
the idea here is they switched the pixel.
So instead of following a doubt on the screen,
432
00:33:45,560 --> 00:33:49,940
it's following a set size just like an inch
or a centimeter would that size, I'm not going
433
00:33:49,940 --> 00:33:54,790
to go too much into it, it's pretty much 196
of an inch and the way they calculated as
434
00:33:54,790 --> 00:34:00,160
the if you're an arm's length away from the
screen on a 96 DPI screen. And I know it's
435
00:34:00,160 --> 00:34:04,440
kind of complicated, it really doesn't matter
for what we're up to right now. But it's just
436
00:34:04,440 --> 00:34:08,909
to say it's a fixed unit. It's not a.on your
screen anymore. It sounds weird. And it sort
437
00:34:08,909 --> 00:34:13,898
of is it's had a lot of benefit and a lot
of really good things. But it also makes my
438
00:34:13,899 --> 00:34:19,170
answer to what unit we should use a little
less concrete than I used to have. And I used
439
00:34:19,170 --> 00:34:24,080
to always say you use EMS for this rems for
this and you just avoid pixels. But you can
440
00:34:24,080 --> 00:34:29,179
get away with using pixels for a lot of things
now, because the fact that a pixel if you
441
00:34:29,179 --> 00:34:34,290
said something to 10 pixels on all the screens,
it should look like it's the same size, regardless
442
00:34:34,290 --> 00:34:38,020
of the resolution of that display. So a lot
of those problems we had with pixels don't
443
00:34:38,020 --> 00:34:42,850
exist anymore. There are other advantages
to using M and REM. So for font size, we're
444
00:34:42,850 --> 00:34:46,679
going to stick with them some of those advantages
we're going to see as we progress through
445
00:34:46,679 --> 00:34:52,460
this course so I am going to be sticking with
them. And my general rule of thumb is for
446
00:34:52,460 --> 00:34:58,040
font size, I'm going to use REM because it
prevents that cascading awkwardness from happening.
447
00:34:58,040 --> 00:35:02,060
And for padding and margin. I'm going to Use
m, and we're going to see why in the next
448
00:35:02,060 --> 00:35:05,850
video, we're going to run through this, we're
going to be using all of those. For width,
449
00:35:05,850 --> 00:35:09,140
I'm either using M or percentage, I mean,
you're going to use an M, when it's a set
450
00:35:09,140 --> 00:35:13,350
size, or I'm going to use a percentage, we
might also use pixels in there to be honest,
451
00:35:13,350 --> 00:35:18,130
it you can sort of get away with on width,
so I'm not too concerned about which one you're
452
00:35:18,130 --> 00:35:23,340
going to be using. So if you're more comfortable
with pixels on widths, that's fine. I tend
453
00:35:23,340 --> 00:35:27,760
to do that a lot. But it is sort of I sort
of like sticking with the same units whenever
454
00:35:27,760 --> 00:35:33,190
I'm using them. So that is my general rule
of thumb. But those are a rule of thumb. And
455
00:35:33,190 --> 00:35:36,830
they're not hard and fast rules. Sometimes
I will set a font size and an M if I have
456
00:35:36,830 --> 00:35:40,360
a good reason for it, because I understand
how they work. And sometimes I will set a
457
00:35:40,360 --> 00:35:44,370
margin or padding using REM, because I want
it to be a set size. And I don't want it to
458
00:35:44,370 --> 00:35:49,720
be relative to whatever I don't want it to
be relative to that font size, I want to be
459
00:35:49,720 --> 00:35:54,000
relative to the root for one reason or another.
This might all seem really theoretical and
460
00:35:54,000 --> 00:35:58,400
confusing and not super clear right now. So
in the next video, we're going to see how
461
00:35:58,400 --> 00:36:02,370
these work with an actual example. And hopefully,
it just helps cement things a little bit.
462
00:36:02,370 --> 00:36:04,990
The next one is just more of an example. And
then we're going to build out a layout. And
463
00:36:04,990 --> 00:36:08,520
we're going to be using all of these. And
we're going to sort of be cementing all the
464
00:36:08,520 --> 00:36:12,870
different concepts that we've covered up until
now, in this how to think responsively module
465
00:36:12,870 --> 00:36:19,550
that's going to be looking at an actual example,
you might recognize this, I wanted to first
466
00:36:19,550 --> 00:36:23,530
run through an example that we've seen before.
So we're not focused too much on the markup,
467
00:36:23,530 --> 00:36:27,350
we're just focused on how the different units
affect different things. And then we're going
468
00:36:27,350 --> 00:36:31,410
to go through and actually build a full layout.
In this, this is the original code that we
469
00:36:31,410 --> 00:36:37,010
sort of left off with when we did a lot of
this in creating our this little card component
470
00:36:37,010 --> 00:36:42,090
thing that we made together. So if we take
a look at it now, one of the reasons I did
471
00:36:42,090 --> 00:36:45,950
choose this is because there's button buttons
in there and buttons are a great example for
472
00:36:45,950 --> 00:36:51,370
lots of things including setting up and using
M's and rems, and when you might want to use
473
00:36:51,370 --> 00:36:55,320
one for one thing and something else for the
other. And what I'm going to do is I'm going
474
00:36:55,320 --> 00:36:59,840
to create a extra class that I can put on
my buttons, it's going to shrink or grow the
475
00:36:59,840 --> 00:37:05,770
font size, because it's really going to illustrate
everything. So let's call it button big enough
476
00:37:05,770 --> 00:37:11,780
that a font size of let's say 1.5 REM, which
is going to give us a pretty big font size.
477
00:37:11,780 --> 00:37:18,710
And then let's come on a button small. And
let's give that one a font size of point seven,
478
00:37:18,710 --> 00:37:23,520
five REM which will be pretty small. So now
I should be able to put those font sizes on
479
00:37:23,520 --> 00:37:27,550
those two buttons. So let's come and do that.
I'm going to give my first one here, the class
480
00:37:27,550 --> 00:37:34,840
of button big. And the second one here, the
class of button small. So this is sort of
481
00:37:34,840 --> 00:37:39,380
my default button class. And then we're modifying
it with these two modifiers, like we did with
482
00:37:39,380 --> 00:37:43,660
the colors before. So if we come and look
at how that's affected things, you can see
483
00:37:43,660 --> 00:37:49,820
it has grown in shrunk the font sizes on those.
And that's awesome. But the button hasn't
484
00:37:49,820 --> 00:37:54,350
really this button was forced to get bigger
because the content inside of it do get bigger.
485
00:37:54,350 --> 00:37:59,070
So we do have the padding that's on these.
The problem is on this big button, the text
486
00:37:59,070 --> 00:38:02,250
is taking up a lot more room than it is on
this small one, this button didn't really
487
00:38:02,250 --> 00:38:06,180
scale up when I change that font size. And
let's let's bring in like a default button
488
00:38:06,180 --> 00:38:14,660
here to actually I'll stick that one right
in the middle. We'll just put default here.
489
00:38:14,660 --> 00:38:17,840
And we won't have any modifier class on that
just so we have a reference point of what
490
00:38:17,840 --> 00:38:22,140
the original button look like, we see our
three button sizes. If you look at this button,
491
00:38:22,140 --> 00:38:26,260
the space on this side looks a lot bigger
than the space on the side it read through
492
00:38:26,260 --> 00:38:30,060
the exact same size. But the problem is my
font size has gotten a lot bigger, my button
493
00:38:30,060 --> 00:38:35,850
really should be scaling up with those sizes.
So remember, I always said I put font sizes
494
00:38:35,850 --> 00:38:40,880
in rim, it stops some weird stuff from happening.
But I like putting my margins and my padding
495
00:38:40,880 --> 00:38:46,560
using AMS. So if we come here where I had
my padding of 15 pixels and 30 pixels, I'm
496
00:38:46,560 --> 00:38:50,800
actually going to change this and I'm going
to change my padding on this on the top and
497
00:38:50,800 --> 00:38:58,120
the bottom 2.5 M and on the left and the right
to 1.25 M. And let's go and take a look at
498
00:38:58,120 --> 00:39:02,790
my buttons. Now. Notice how the shape of them
is much more similar one to the next, learn
499
00:39:02,790 --> 00:39:06,210
more about me, I'm going to change that just
because it looks different. Because it's such
500
00:39:06,210 --> 00:39:10,230
a long amount of text inside the button, it's
going to keep the length of the text more
501
00:39:10,230 --> 00:39:14,680
similar in all of my buttons. And you can
see it just looks like the button is getting
502
00:39:14,680 --> 00:39:19,250
bigger and bigger or smaller and smaller.
Because the padding around it is scaling up
503
00:39:19,250 --> 00:39:23,630
and down with the font size of that button.
Now you might be wondering one thing, why
504
00:39:23,630 --> 00:39:29,390
is it scaling with the font size that I'm
putting on the button itself, because this
505
00:39:29,390 --> 00:39:34,450
it's not paying attention to the parent is
paying attention to the font size of its own
506
00:39:34,450 --> 00:39:40,821
element, right? Like this is my padding here
is point five and 1.25 on the button. And
507
00:39:40,821 --> 00:39:45,550
so if I look at that button, it's paying attention
to the padding that or it's paying attention
508
00:39:45,550 --> 00:39:50,200
to the font size that I put on this class.
So it's looking at this font size. This is
509
00:39:50,200 --> 00:39:55,810
where I mentioned that it's a little bit weird
when you're using EMS, because with EMS, if
510
00:39:55,810 --> 00:40:00,100
you're doing it on the font size property,
it's looking at the parent if you do it on
511
00:40:00,100 --> 00:40:09,540
Any other property, it's no longer looking
at the parent, it's M is relative to the font
512
00:40:09,540 --> 00:40:16,020
of this element should put, say, font size.
So m becomes relative to the font size of
513
00:40:16,020 --> 00:40:20,550
that element of this element here, when it's
put on your padding, or when it's put on your
514
00:40:20,550 --> 00:40:23,630
margins. Or even if you did it on like a width
or height or something like that, you would
515
00:40:23,630 --> 00:40:29,390
be looking at this one size rather than the
parents font size. This is where scaling and
516
00:40:29,390 --> 00:40:32,960
this compounding factor is good because it
won't compound out of control, it's going
517
00:40:32,960 --> 00:40:39,160
to compound or scale according to what's here.
Whereas if I use rems, for this, it becomes
518
00:40:39,160 --> 00:40:44,910
a set value just like when I use pixels. So
if I come back and I set those in REM, this
519
00:40:44,910 --> 00:40:49,060
space is exactly the same as this space, which
is exactly the same as this space, these two
520
00:40:49,060 --> 00:40:53,850
sizes are exactly the same, but because the
font size is bigger, this looks a lot smaller
521
00:40:53,850 --> 00:40:58,750
visually than it does on this one. Let's switch
those back to em just so we can see it again.
522
00:40:58,750 --> 00:41:04,750
And now we can see that it's more of this
like scaling up that's going on rather than
523
00:41:04,750 --> 00:41:11,310
this set size around the text of my button.
So that is how I choose between M's and rems,
524
00:41:11,310 --> 00:41:16,820
when it comes to setting things and why I'm
putting M's for margins and paddings. And
525
00:41:16,820 --> 00:41:21,740
why I'm setting rems, for my font sizes, the
font sizes, it stops that weird cascading
526
00:41:21,740 --> 00:41:27,110
from happening AMS because I can take advantage
and make it relative to the font size that's
527
00:41:27,110 --> 00:41:32,480
in there. This also makes it really easy when
I'm sitting margins on paragraphs or on heading
528
00:41:32,480 --> 00:41:39,160
because if I come and I go, I want to add
I want to change the margin bottom on my h1.
529
00:41:39,160 --> 00:41:46,600
I know my font size is 24 pixels. So if I
came and I said margin bottom is one m, I
530
00:41:46,600 --> 00:41:54,730
know now that my margin bottom is exactly
24 pixels. So that would literally be 24 pixels.
531
00:41:54,730 --> 00:42:03,480
For my margin bottom. If I came in I said
margin bottom is two M, well, then my margin
532
00:42:03,480 --> 00:42:08,510
bottom would actually be 48 pixels, and so
on and so forth. So it's relative to the font
533
00:42:08,510 --> 00:42:13,160
size of that actual element. Now, obviously,
and now I've said I don't like setting pixels
534
00:42:13,160 --> 00:42:17,500
here. So you do have to think about it a little
bit. But that also means if I come in, I set
535
00:42:17,500 --> 00:42:21,350
my font size here to three REM and you don't
know exactly what now we've got a nice big
536
00:42:21,350 --> 00:42:25,810
font size on that. But we don't know exactly
what three REM is, well, it doesn't really
537
00:42:25,810 --> 00:42:29,990
matter, I don't have to worry about exactly
how big that is, I can come and look at my
538
00:42:29,990 --> 00:42:36,050
font size and I go I want the space underneath,
we will have that I can come and say margin.
539
00:42:36,050 --> 00:42:42,590
Bottom is point five m because it's point
five of whatever this font size is. So now
540
00:42:42,590 --> 00:42:47,160
my space is about half of my font size, where
I go, I want it to be bigger than my font
541
00:42:47,160 --> 00:42:52,870
size, I do two M and now my space after is
twice whatever my font size was. So it's always
542
00:42:52,870 --> 00:42:58,130
relative to that element itself, which makes
it really, really easy when you're dealing
543
00:42:58,130 --> 00:43:02,820
with your typography. And the big advantages.
When I change my font size, this will adapt
544
00:43:02,820 --> 00:43:06,260
automatically. And I won't have to change
both of them. Because when we start changing
545
00:43:06,260 --> 00:43:10,450
font sizes, which we will be doing for different
screens, we're gonna have a small screen and
546
00:43:10,450 --> 00:43:14,040
a big screen, the font size has to change
on it. So if you're changing the font size,
547
00:43:14,040 --> 00:43:17,520
it's nice that you don't have to go and change
your margins. Because they've all been set
548
00:43:17,520 --> 00:43:22,650
in em the same way here, when I'm changing
my font sizes, I don't have to go and change
549
00:43:22,650 --> 00:43:26,610
the padding for those sizes, then of course
there are percentages and in general percentages,
550
00:43:26,610 --> 00:43:30,080
I will be using for the width, you could technically
use them on a font size, and they'll work
551
00:43:30,080 --> 00:43:34,870
a lot like m but that also runs into that
scaling and compounding issue. And the same
552
00:43:34,870 --> 00:43:39,730
reason I don't like to use M's on font sizes
is the same reason I wouldn't use a percentage
553
00:43:39,730 --> 00:43:44,630
on a font size, the two of them work extremely
similar to one another. So REM is sort of
554
00:43:44,630 --> 00:43:49,010
the safe bet there now in we're going to be
jumping back into Flexbox. And actually building
555
00:43:49,010 --> 00:43:52,920
out layouts and practicing and using all of
these things that we have learned up until
556
00:43:52,920 --> 00:43:56,910
now plus going back into Flexbox, which we
haven't seen in a really long time since pretty
557
00:43:56,910 --> 00:44:00,310
much the crash course and we're going to be
looking at understanding it and how it works
558
00:44:00,310 --> 00:44:07,930
a little bit better as we learn to start thinking
responsibly. Alright, so let's get into responsive
559
00:44:07,930 --> 00:44:11,270
layout basics using Flexbox. before we actually
start making the layout, which we will be
560
00:44:11,270 --> 00:44:16,550
doing in this video, just a refresher on Flexbox.
So elements normally have a display of block
561
00:44:16,550 --> 00:44:21,370
or display of inline as their default from
the browser. So display block would be are
562
00:44:21,370 --> 00:44:26,620
things like our divs, or header or footer,
or main are each one all the way to h6, our
563
00:44:26,620 --> 00:44:31,200
paragraphs are lists and list items are also
included in that. And we have our inline elements
564
00:44:31,200 --> 00:44:36,770
like are a strong m n span. So those ones
stay in the flow with the items that are around
565
00:44:36,770 --> 00:44:42,130
them. We are going to be using divs for our
columns. And we can't you know because divs
566
00:44:42,130 --> 00:44:45,580
are block they're going 100% of the width.
But they're also even if we change that even
567
00:44:45,580 --> 00:44:49,660
if we say they're 10% width, they're still
going to stack one on top of each other. We
568
00:44:49,660 --> 00:44:55,110
can change this behavior by setting the display
property to flex on the parent element. When
569
00:44:55,110 --> 00:45:00,450
we do that it changes the behavior of all
of its direct children. So if we have something
570
00:45:00,450 --> 00:45:04,750
that looks like this. So this is a a section
of content. And then inside that section,
571
00:45:04,750 --> 00:45:12,350
we have four divs, like this, if we set display
flex on that parent section, the items inside
572
00:45:12,350 --> 00:45:17,950
of it will turn into columns automatically.
So they'll switch and they won't stack, they'll
573
00:45:17,950 --> 00:45:21,610
also no longer be 100% went, they're going
to shrink to fit the content that's inside
574
00:45:21,610 --> 00:45:26,000
of them on the horizontal axis. So it's very,
very different. But it's also very easy to
575
00:45:26,000 --> 00:45:29,920
do. So we're going to practice with this layout
here. It's not the most beautiful layout,
576
00:45:29,920 --> 00:45:33,730
but it's going to bring us into being able
to do some fantastic stuff. Because if you
577
00:45:33,730 --> 00:45:38,120
see here, we are looking at how we can do
this for a big screen. But we're also going
578
00:45:38,120 --> 00:45:42,120
to get to the point where we can make this
work on a small screen as well, we want it
579
00:45:42,120 --> 00:45:46,820
to work on both. There's a lot of interesting
things that are in this layout. So we have
580
00:45:46,820 --> 00:45:51,460
content and stretching the full size. Here
we have three columns, here, we have two columns,
581
00:45:51,460 --> 00:45:56,060
these two have different colored backgrounds
on them, this one is bigger than those two.
582
00:45:56,060 --> 00:46:00,800
And this one's even bigger than that. So how
can we do this? How can we set it all up to
583
00:46:00,800 --> 00:46:04,490
be the right sizes, and to get spacing between
them and get all these different things that
584
00:46:04,490 --> 00:46:08,020
we need in here. So we're gonna be doing all
of this not in this video, but over the course
585
00:46:08,020 --> 00:46:12,250
of the next few videos. But we're going to
sort of set the stage with the HTML in this
586
00:46:12,250 --> 00:46:15,810
one, we're going to be ignoring the mobile
layout for the moment, we're going to focus
587
00:46:15,810 --> 00:46:20,190
on how we're going to set up our columns and
organize it. Because this is the most important
588
00:46:20,190 --> 00:46:24,540
thing now is how is this content organized,
the hardest thing to do with a layout is when
589
00:46:24,540 --> 00:46:28,570
you look at it, just breaking it down in how
you're going to organize it, where do you
590
00:46:28,570 --> 00:46:33,110
need to do Where are all the different pieces
going to fall? It's not super easy. At the
591
00:46:33,110 --> 00:46:37,740
very beginning, the very first thing is, all
of this is being held in the middle of the
592
00:46:37,740 --> 00:46:42,440
screen with a certain size on it. In the last
module, we had three containers because we
593
00:46:42,440 --> 00:46:46,510
needed backgrounds that were full size in
this situation, we don't need that. So we
594
00:46:46,510 --> 00:46:51,130
can have one single container for all of the
content on our page. And that container is
595
00:46:51,130 --> 00:46:55,310
now this light pink background. But what we
also need is we need to create some columns.
596
00:46:55,310 --> 00:46:59,800
So I'm going to put a div of columns here.
And I'm gonna have a div of columns here,
597
00:46:59,800 --> 00:47:03,810
that's going to have these. So once we have
those columns in place, then we need to create
598
00:47:03,810 --> 00:47:10,720
individual the individual columns. So I have
this here is one columns. And then another,
599
00:47:10,720 --> 00:47:14,170
you'll also see these often and there's a
popular framework called bootstrap, that will
600
00:47:14,170 --> 00:47:18,760
say row. So that's a row of content with three
columns inside of it. So we have our you know,
601
00:47:18,760 --> 00:47:23,820
we have a row of content or my columns container,
I'm going to call it columns, because it's
602
00:47:23,820 --> 00:47:29,240
my columns container. And then inside my columns
container, I have three individual columns.
603
00:47:29,240 --> 00:47:32,800
And then over here, I have this big one that's
gonna have display flex, and then it's gonna
604
00:47:32,800 --> 00:47:36,780
have two of them inside of it. So this is
sort of the structure of my site when I'm
605
00:47:36,780 --> 00:47:42,650
breaking it down visually. The reason I know
that I need to have these green boxes, and
606
00:47:42,650 --> 00:47:47,960
then for each individual column, is because
if not, if we didn't have those, and I just
607
00:47:47,960 --> 00:47:54,030
put my all my age twos and my paragraphs directly
in the columns parent, then each individual
608
00:47:54,030 --> 00:47:58,400
paragraph and each h2 would become its own
column, they would each break off into their
609
00:47:58,400 --> 00:48:02,570
own things they wouldn't keep, they wouldn't
stay organized. So when we look at something
610
00:48:02,570 --> 00:48:06,920
like that, we have to visualize where each
individual column is, so we can organize it
611
00:48:06,920 --> 00:48:10,070
properly. And in this case, this is how I'm
going to be organizing it. So I'm going to
612
00:48:10,070 --> 00:48:14,150
leave this here, and I'm going to see if you
can go ahead and do it, I've already set up
613
00:48:14,150 --> 00:48:17,750
the file, I've linked it to a style sheet
that has nothing in it, I've given you all
614
00:48:17,750 --> 00:48:23,360
the text. So just organizing it look at this
picture, and go based on what you see here.
615
00:48:23,360 --> 00:48:26,860
So go ahead and do it. If you don't want to
copy and paste all the text at least make
616
00:48:26,860 --> 00:48:31,680
the structure like you've seen me do in previous
videos, where you're putting in all the elements.
617
00:48:31,680 --> 00:48:35,340
And then I'm going to go through and do it
as well. And I'll bring the text and so if
618
00:48:35,340 --> 00:48:38,710
you don't want to bother copying the text
back and forth, you don't have to. But if
619
00:48:38,710 --> 00:48:42,140
you want to go through the full length, by
all means go for it. I'm only going to do
620
00:48:42,140 --> 00:48:45,560
that in this video. In the next one, we're
going to start applying the CSS to it. But
621
00:48:45,560 --> 00:48:48,890
if you want to jump ahead and just try and
do the whole thing on your own, go for it.
622
00:48:48,890 --> 00:48:53,110
In the next video though, I am sharing the
colors, the exact colors that I'm going to
623
00:48:53,110 --> 00:48:56,570
be using and the font sizes. But if you just
want to estimate and try your best to get
624
00:48:56,570 --> 00:49:00,461
it to work based on what you've learned so
far, go for it by all means. But if you're
625
00:49:00,461 --> 00:49:05,119
not too sure, on the Flexbox thing, it's been
a little while you can wait for me. So let's
626
00:49:05,119 --> 00:49:12,020
jump into it right now. So here in my body,
as I said, I'm going to start with a div with
627
00:49:12,020 --> 00:49:17,119
a class of container, which is just going
to hold all of my content. Now we could in
628
00:49:17,119 --> 00:49:21,670
this case, actually set a width on the body,
I tend to try and avoid doing stuff like that,
629
00:49:21,670 --> 00:49:25,670
because all of a sudden, somebody wants to
come in and add like a new section to your
630
00:49:25,670 --> 00:49:30,740
site that's actually full width. And then
you go Oh man, I have to change. So much content
631
00:49:30,740 --> 00:49:35,480
had to change on my markup. So I like having
a container or a wrapper that's going to contain
632
00:49:35,480 --> 00:49:40,070
all of my content and not touch the width
on my body. personal preference there. But
633
00:49:40,070 --> 00:49:43,900
I like thinking ahead and thinking things
are always changing. So I don't want to run
634
00:49:43,900 --> 00:49:50,260
into any problems in the long run. In my container,
I need my h1 and I need my image. So that's
635
00:49:50,260 --> 00:49:55,770
gonna have an SRC on it and an Alp on it.
And then we can come down and start doing
636
00:49:55,770 --> 00:50:00,680
the rest of it to need our two parent column
containers. So that was it. What I said I
637
00:50:00,680 --> 00:50:07,750
would call columns. So div class equals columns,
close div. And we're gonna have two of those.
638
00:50:07,750 --> 00:50:11,280
So you can copy and paste that or just write
it all out, depending on how fast you can
639
00:50:11,280 --> 00:50:19,619
type. And there we go, we have the basic structure.
Now inside of this column, I'm going to have
640
00:50:19,619 --> 00:50:25,500
three actual columns. So I'm going to do a
div class equals just co L, because it's faster,
641
00:50:25,500 --> 00:50:30,850
right. And we can close that div. And I'm
going to take that, and we need three of them
642
00:50:30,850 --> 00:50:34,860
inside of here. And I'm going to take that
same thing here. And I'm going to have two
643
00:50:34,860 --> 00:50:40,620
of them over there. So that is sort of the
basic like actual structure of my site. Right
644
00:50:40,620 --> 00:50:45,120
now, the different pieces are in place, obviously,
I need to put the content inside of those
645
00:50:45,120 --> 00:50:50,160
columns. But from a structural point of view,
this is all of my layout, stuff like this
646
00:50:50,160 --> 00:50:55,810
is my main layout items that I put into place.
Now it's just adding the content to those
647
00:50:55,810 --> 00:51:00,930
to the layout parts of my markup. So let's
go through and do that really quickly. So
648
00:51:00,930 --> 00:51:08,720
here, it would be an h2, followed by a paragraph,
I have the same thing in the next one. Except
649
00:51:08,720 --> 00:51:12,740
in this case, we actually end up with two
paragraphs. And then my last one, we just
650
00:51:12,740 --> 00:51:17,920
have a single paragraph all on its own, which
is the exact same thing we have here. And
651
00:51:17,920 --> 00:51:25,550
we can copy this one and bring it down there.
Because that is what we have, we have h2 paragraph,
652
00:51:25,550 --> 00:51:30,710
this is an h2 with two paragraphs. This is
just one big long paragraph, and h2 with a
653
00:51:30,710 --> 00:51:35,900
paragraph and then our individual paragraph
there. So now we not only have the structure
654
00:51:35,900 --> 00:51:41,310
of it, but we have all of the content elements
in place, we just have to place the content
655
00:51:41,310 --> 00:51:45,250
actually in there, I'm not going to do that
in this video. When you start the next video,
656
00:51:45,250 --> 00:51:49,440
all the content will already be there, all
of the colors and font sizes will be on a
657
00:51:49,440 --> 00:51:53,360
slide in that video. So if you want to jump
to there, now, you'll be able to try and do
658
00:51:53,360 --> 00:52:00,510
all the styling, and all of the content will
already be in place for you. It's time to
659
00:52:00,510 --> 00:52:04,370
make the columns in this layout into actual
columns instead of stacking one on top of
660
00:52:04,370 --> 00:52:08,300
each other. So as promised, I've put all the
content in here and I want you to give it
661
00:52:08,300 --> 00:52:12,820
a go. So we have everything we need in place,
we have all my paragraphs, all my content
662
00:52:12,820 --> 00:52:19,010
is in here, we just need to actually get this
to be columns instead of stacking one on top
663
00:52:19,010 --> 00:52:24,240
of each other. So if you want to go ahead
and go for it, just as a quick reminder, we
664
00:52:24,240 --> 00:52:29,630
want these two parents to be the display flex,
and then everything should more or less fall
665
00:52:29,630 --> 00:52:33,280
into place a little bit. I've also given you
the colors that we're going to be using and
666
00:52:33,280 --> 00:52:38,700
the font sizes. So I'm going to start this
one off by putting in the columns. And then
667
00:52:38,700 --> 00:52:43,390
I'll also throw in the colors for my text
and setting up the font sizes. But first,
668
00:52:43,390 --> 00:52:47,020
I'm just gonna set up my columns to make sure
they're working to make sure we understand
669
00:52:47,020 --> 00:52:50,410
that, then I'm going to run through and set
up all my colors except for the background
670
00:52:50,410 --> 00:52:54,020
color on these two, because I'm going to look
at that in the next video as a quick refresher,
671
00:52:54,020 --> 00:52:57,950
which is going to get us ready to set the
different sizes on these two middle columns
672
00:52:57,950 --> 00:53:01,740
here. So you have the right starting point,
do as much as you can on your own before you
673
00:53:01,740 --> 00:53:05,400
watch me do it. See if you can get the whole
thing done. Even if you get stuck anywhere,
674
00:53:05,400 --> 00:53:09,100
of course, come and see how I did it or when
you're done, come and see if we did it in
675
00:53:09,100 --> 00:53:16,270
the same way. Alright, so I'm gonna jump over
to my CSS file here. And as I said, I'm going
676
00:53:16,270 --> 00:53:20,060
to start with my container normally and start
with my body. But let's just get the lay of
677
00:53:20,060 --> 00:53:24,180
stuff working first. So let's actually come
up here and make a comment called layout.
678
00:53:24,180 --> 00:53:31,360
And I'll come here and my container, I said,
I want it to have a maximum width of 980 pixels.
679
00:53:31,360 --> 00:53:34,710
Now if we left it like that, when we come
and look at it, if we make our screen big
680
00:53:34,710 --> 00:53:39,820
enough, we're gonna see that it's, it's nothing's
gonna grow outside of that space. So I could
681
00:53:39,820 --> 00:53:46,160
set my max width of 980. And then I could
come on here and set the margin of zero auto
682
00:53:46,160 --> 00:53:51,160
to center it on the screen. And now it's looking
pretty good. And this is one of those rare
683
00:53:51,160 --> 00:53:55,540
times because we don't have a background color
that's going anywhere one side to the other.
684
00:53:55,540 --> 00:53:59,210
That default margin on the body, maybe it's
not such a bad thing, because it's preventing
685
00:53:59,210 --> 00:54:03,330
our text from touching the side there, it's
getting a little bit too close. For me, I
686
00:54:03,330 --> 00:54:07,450
like keeping things a little bit further off
than that. So I am also going to give this
687
00:54:07,450 --> 00:54:13,550
a width of about 90%. So it will always keep
a little bit more distance off the sides than
688
00:54:13,550 --> 00:54:18,100
what we had before. It's not perfect, but
I like that a little bit better. So I'm going
689
00:54:18,100 --> 00:54:22,700
to stick with that maybe even 95 we could
get away with let's bump that up to 95. And
690
00:54:22,700 --> 00:54:27,670
keep going. The more fun part and the part
that you have been waiting for is coming onto
691
00:54:27,670 --> 00:54:33,360
my call and then on here, setting this up.
So on my columns here, we do a display of
692
00:54:33,360 --> 00:54:38,450
flex. And just like that, we should be able
to come into here and see I have three columns.
693
00:54:38,450 --> 00:54:43,440
And if I scroll down, I get my two columns
there. Now it doesn't look exactly like the
694
00:54:43,440 --> 00:54:47,550
layout that we had because this one is much
longer than those two. And it really depends
695
00:54:47,550 --> 00:54:51,770
on just how the screen is and how it is set
up. Plus this column is supposed to be wider
696
00:54:51,770 --> 00:54:55,230
than the other ones. So when we do that it
should fix everything we want. Now you'll
697
00:54:55,230 --> 00:54:58,660
notice there's something weird happening down
here where it's sort of already falling into
698
00:54:58,660 --> 00:55:03,590
line, but this one is much Smaller are narrower
than this one. So we do have some work to
699
00:55:03,590 --> 00:55:08,310
do. Now we are having a big issue, which is
with my image, it is causing some side scrolling.
700
00:55:08,310 --> 00:55:11,720
So the first thing I'm gonna ask you to do
right now is go ahead and fix that issue with
701
00:55:11,720 --> 00:55:17,400
the side scrolling. If you remember how I
did it last time. Somebody come here, I'm
702
00:55:17,400 --> 00:55:21,090
gonna stick under layout, because images are
part of my layout most of the time, and I'm
703
00:55:21,090 --> 00:55:25,350
going to give this a max width of 100%. Now,
you probably did a width of 100%, which is
704
00:55:25,350 --> 00:55:30,470
perfectly fine. And what you want to be doing
anyway, the only difference between giving
705
00:55:30,470 --> 00:55:35,420
it a width of 100% or a maximum width of 100%,
is it means my image can never get bigger
706
00:55:35,420 --> 00:55:39,759
than it was supposed to be. So if my max width
here was actually like 1200, and I made this
707
00:55:39,759 --> 00:55:45,800
much bigger than what we had before, my image
one stop growing when it gets to its native
708
00:55:45,800 --> 00:55:52,880
size of 980 pixels, whereas it will still
shrink to fit the content. If my its area
709
00:55:52,880 --> 00:55:57,250
is smaller than it read, the only reason I
would do that is if an image goes beyond or
710
00:55:57,250 --> 00:56:01,780
bigger than it originally was, it will start
losing a little bit of quality. So because
711
00:56:01,780 --> 00:56:06,120
of that, I'm going to stick with a max width
of 100%, instead of just having a width of
712
00:56:06,120 --> 00:56:10,970
100%. And letting it grow. It's not too noticeable
now. But if it really does get a lot bigger
713
00:56:10,970 --> 00:56:14,780
than it was intended to be, it's gonna get
really, really blurry and nasty looking. So
714
00:56:14,780 --> 00:56:19,830
I'm going to stick with a max width there.
And we'll bring this down to 980. Just like
715
00:56:19,830 --> 00:56:25,470
that. And we have our nice three columns that
are coming into place. So that is nice and
716
00:56:25,470 --> 00:56:29,090
done. So we are well on the way, the next
thing I'm going to do is just to go through
717
00:56:29,090 --> 00:56:33,030
and fix up some of these colors, except I'm
going to save these two background colors
718
00:56:33,030 --> 00:56:36,750
for the next video, like I had already mentioned.
So let's go and do that. I'm going to come
719
00:56:36,750 --> 00:56:41,290
up to the top here. And we're going to look
at this slide really fast. And I'm just going
720
00:56:41,290 --> 00:56:45,420
to be running through all of the things we
see here. So I'm going to set the font size
721
00:56:45,420 --> 00:56:49,280
and my colors. And then that's it for now.
So that's all in place when we jump into the
722
00:56:49,280 --> 00:56:54,020
next one. So on the body itself, I'm going
to come up here and we had the font size that
723
00:56:54,020 --> 00:56:59,580
I said would be 1.125 rim, the next thing
we want is the color because the color throughout
724
00:56:59,580 --> 00:57:04,340
the entire design, except for those areas
that are on the white background and the h1
725
00:57:04,340 --> 00:57:09,610
are using that 7070 color. So I'm going to
set that right there, I'm also going to go
726
00:57:09,610 --> 00:57:13,420
and put the margin to zero just because I
tend to do that in every design, even this
727
00:57:13,420 --> 00:57:20,420
one where it's not essential to have. Now
we can get into our type biography. And I'll
728
00:57:20,420 --> 00:57:26,070
come into here and start writing a little
bit. So my h1, which has a font size of three
729
00:57:26,070 --> 00:57:34,859
rim, and also has that color of 3126 14, I'm
going to leave the margin alone, I think for
730
00:57:34,859 --> 00:57:39,090
this, in this case, I don't think we really
need to change it. And I'm going to come on
731
00:57:39,090 --> 00:57:45,420
my h2 and give that font size of 1.5 rim.
And I think that's all we really need to do.
732
00:57:45,420 --> 00:57:50,000
Let's go and just take a quick look. And the
one thing I did forget actually is that span
733
00:57:50,000 --> 00:57:54,454
in the middle. So let's set that up, I'm going
to come into my index, and you want me to
734
00:57:54,454 --> 00:57:57,530
do I'm going to give you a little mini challenge.
I'm going to put a span here, but I'm not
735
00:57:57,530 --> 00:58:01,240
going to put a class on it. Now this isn't
something I would normally do. But it's not
736
00:58:01,240 --> 00:58:06,210
terribly uncommon actually to see this with
spans. Because spans are always nested inside
737
00:58:06,210 --> 00:58:10,050
of an element. So a lot of the time that span
will be nested in titles all the time. So
738
00:58:10,050 --> 00:58:14,920
you have a span that's always in an h1 and
h2 or h3, and that span is always doing the
739
00:58:14,920 --> 00:58:19,190
exact same thing. Instead of taking time to
give it a class people will make a compound
740
00:58:19,190 --> 00:58:24,050
selector. So using a compound selector, see
if you can change the color of that, instead
741
00:58:24,050 --> 00:58:33,980
of giving it a class. So what we can do is
my h1, then there we go. I spell it right.
742
00:58:33,980 --> 00:58:40,450
And on that we can give that one the color
to overwrite. So that would be B seven 832
743
00:58:40,450 --> 00:58:46,600
F, just like that. And let's go take a look.
And there we go, Oh, I just one last thing
744
00:58:46,600 --> 00:58:53,280
that I forgot on there is just the text align
center text align, center that I can put on
745
00:58:53,280 --> 00:58:56,670
that as well. So everything is in place. In
the next video, as I said, we're going to
746
00:58:56,670 --> 00:58:59,740
give these their dark background color. And
then after that, we'll see how we can actually
747
00:58:59,740 --> 00:59:07,590
get these columns to start behaving properly.
Alright, so our layer is falling into place.
748
00:59:07,590 --> 00:59:11,400
Now we want to add the background color to
these two. So before we do that, I'm going
749
00:59:11,400 --> 00:59:14,720
to give you a hint. And I'm going to see if
you can solve it if you haven't already. And
750
00:59:14,720 --> 00:59:18,740
that is we're going to do this in a very similar
way to how we did our buttons, where we have
751
00:59:18,740 --> 00:59:23,541
a main class that's controlling our button.
And then we had a secondary class that we
752
00:59:23,541 --> 00:59:28,410
would use to modify that to add colors or
change the colors of our button. So with that
753
00:59:28,410 --> 00:59:31,120
hint to see if you can figure out how to add
that background color and a little bit of
754
00:59:31,120 --> 00:59:36,130
padding to those two divs. And once you get
it or if you get stuck, I'll show you how
755
00:59:36,130 --> 00:59:41,900
I would do it. Alright, so I'm gonna go back
into my index to do this. And I'm going to
756
00:59:41,900 --> 00:59:46,350
find the divs in question, which is this one
is the first one we need because it's the
757
00:59:46,350 --> 00:59:52,550
third column inside of that first section
there. And on that call, I'm going to give
758
00:59:52,550 --> 00:59:57,830
this a call BG class. Now it could just be
background. It could be pretty much anything
759
00:59:57,830 --> 01:00:02,720
you want. The reason I'm starting it with
the C Yo L is because I'm modifying a column.
760
01:00:02,720 --> 01:00:08,030
The specific reason for this is to act as
a column modifier. So I'm putting called BG,
761
01:00:08,030 --> 01:00:12,410
to modify my column, it just helps me stay
a little bit more organized, could you do
762
01:00:12,410 --> 01:00:16,970
it in another way, 100%, you might have another
name that you came up with, which was amazing.
763
01:00:16,970 --> 01:00:21,160
And it probably is, there's not one naming
convention that you have to use or follow.
764
01:00:21,160 --> 01:00:26,260
In fact, there's tons of really good and well
thought out naming conventions out there,
765
01:00:26,260 --> 01:00:29,550
that all look at things in a little bit of
a different way. The important thing is that
766
01:00:29,550 --> 01:00:32,880
you do have a naming convention. And there's
a little bit of logic to how you're doing
767
01:00:32,880 --> 01:00:36,170
it, because then other people can figure it
out. Or when you come back to a project six
768
01:00:36,170 --> 01:00:39,869
months later, you understand what you were
doing. So I'm going to put called BG there.
769
01:00:39,869 --> 01:00:44,640
And I'm going to come down here and do a call
BG on this one as well. And then I'm going
770
01:00:44,640 --> 01:00:50,260
to come up into my styles where I set up my
columns, I will do my call bg. And I'll give
771
01:00:50,260 --> 01:00:54,540
that the background color that we need. So
I'll write background, and let's get that
772
01:00:54,540 --> 01:00:58,970
dark color that we want. And let's give it
a little bit of padding. So I'm gonna give
773
01:00:58,970 --> 01:01:03,660
it padding of 8.5 M, because I don't want
a lot. And as I said, I'm usually using M's
774
01:01:03,660 --> 01:01:09,000
for my padding. Again, I'm thinking my font
size is 16 pixels, half of that sounds pretty
775
01:01:09,000 --> 01:01:12,690
good. Maybe I want one, but I'm going to look
at it and see what it actually looks like.
776
01:01:12,690 --> 01:01:17,109
And then I can decide if I thought if I think
it looks alright, they're stuck together right
777
01:01:17,109 --> 01:01:20,660
now, which is a little bit of an issue. So
let's actually come on to my columns here
778
01:01:20,660 --> 01:01:25,800
and just give us a bit of a margin of like
one m top and bottom and zero on the left
779
01:01:25,800 --> 01:01:30,840
and right, just to help give us a little bit
of space between things. And we can see that
780
01:01:30,840 --> 01:01:34,820
the padding doesn't look too bad, probably
a little bit small. Actually, because I'm
781
01:01:34,820 --> 01:01:38,750
looking at the two sides there, I can see
that the top and bottom is about what I want.
782
01:01:38,750 --> 01:01:43,230
But that's including that margin that's on
my text by default. So let's go and boost
783
01:01:43,230 --> 01:01:48,850
that up to maybe a one at the end. And I think
that looks a little bit better. So over here,
784
01:01:48,850 --> 01:01:53,310
I'm going to take off the margin that's on
that text, especially on the top. So we're
785
01:01:53,310 --> 01:01:59,240
just going to go into my typography section
here and add in my paragraph and give that
786
01:01:59,240 --> 01:02:05,730
a margin top of zero. And there we go, it
is working this bottom one will end up with
787
01:02:05,730 --> 01:02:09,119
a little bit of extra space. As you can see,
actually right now they're stretching, we're
788
01:02:09,119 --> 01:02:12,150
going to look at how we can fix this stretching
behavior eventually as well. And it will leave
789
01:02:12,150 --> 01:02:16,890
a little bit of extra space on the bottom.
But it isn't the end of the world. Oh, and
790
01:02:16,890 --> 01:02:21,270
looking at this, this text is a little bit
hard to read. So on that call BG anytime a
791
01:02:21,270 --> 01:02:26,050
column has a background color, we can also
have it come and get an actual color too.
792
01:02:26,050 --> 01:02:30,750
And we'll give it the FFF or just white keyword
would be fine as well. So at least we can
793
01:02:30,750 --> 01:02:34,840
read our text a little bit better, super.
So our layout is coming together, it's working,
794
01:02:34,840 --> 01:02:39,070
it is responsive, it's changing in size, it
will work in different screens. That's pretty
795
01:02:39,070 --> 01:02:43,720
exciting, right? It's not set at one screen
now. But our column widths are all screw with
796
01:02:43,720 --> 01:02:48,540
and we want to change those I did the background
color first on these on purpose, because it's
797
01:02:48,540 --> 01:02:53,880
the same technique that we're going to use
to actually change the size of the other ones,
798
01:02:53,880 --> 01:02:58,100
we're gonna use a modifier class that can
control the size of our columns. So I'm going
799
01:02:58,100 --> 01:03:01,630
to try and go ahead and do that right now
on this one, and whether you get it or not,
800
01:03:01,630 --> 01:03:05,740
we'll see in the next video, how I am going
to approach it, the one thing not to worry
801
01:03:05,740 --> 01:03:10,460
about yet is this spacing between them, it's
just thinking about the logic behind it. And
802
01:03:10,460 --> 01:03:13,170
then we can go through and worry about how
to create those spaces, because we're actually
803
01:03:13,170 --> 01:03:20,359
going to see a new property to be able to
do that. Alright, so let's fix the width on
804
01:03:20,359 --> 01:03:23,880
our columns here to get them to be the sizes
that we want them to be. So if you remember
805
01:03:23,880 --> 01:03:27,530
I said that I'm gonna use a modifier class
once again. Now you don't have to necessarily
806
01:03:27,530 --> 01:03:31,510
use a modifier class, but we're going to get
really used to using modifier classes. So
807
01:03:31,510 --> 01:03:35,020
I want you to sort of get in that mindset.
Now you originally I was going to look at
808
01:03:35,020 --> 01:03:40,891
it was we can use our call, which would be
this would just be one width, and we could
809
01:03:40,891 --> 01:03:44,470
have a call two and a call three. But I'm
going to set up the same idea. But I might
810
01:03:44,470 --> 01:03:48,180
have a call one call to call three and there
could technically I guess be a call for that
811
01:03:48,180 --> 01:03:51,960
would stretch the whole width. Now I am going
to keep this slide. I didn't keep this slide
812
01:03:51,960 --> 01:03:56,640
here though, before I thought of that, because
I did want to look at the idea of why I'm
813
01:03:56,640 --> 01:04:01,510
calling it call two and why I'm calling it
column three. And the way I'm looking at it
814
01:04:01,510 --> 01:04:07,180
is this is a four column layout I have, if
I divided this into equal spaces, I have four
815
01:04:07,180 --> 01:04:11,590
if I took the smallest column, I could have
four of them across the entire width of this
816
01:04:11,590 --> 01:04:16,470
layout. So it's a four column layout. This
one is double the width of this one, and this
817
01:04:16,470 --> 01:04:21,830
is three times the width of my sort of default
or my smallest column here. So I have my column
818
01:04:21,830 --> 01:04:25,030
two, which is going to be double the size
and this one which is going to be triple the
819
01:04:25,030 --> 01:04:28,130
size. So what I want you to do is if you didn't
do it on the last video, when I said you have
820
01:04:28,130 --> 01:04:31,890
a chance because you weren't really sure what
to do, try giving it a go now that I've explained
821
01:04:31,890 --> 01:04:35,140
a little bit more, and then I'm going to look
at sort of the trickiest thing was how do
822
01:04:35,140 --> 01:04:42,090
you decide exactly how big they should be?
Alright, so I hope you got it. So what I'm
823
01:04:42,090 --> 01:04:47,170
gonna do now is I'm gonna come over here,
and I'm going to come in actually to my index
824
01:04:47,170 --> 01:04:51,470
here first, and we have to add those class
columns to here. So this is a column and it's
825
01:04:51,470 --> 01:04:56,599
going to have the width of a column one. Then
I'm going to have this one have the column
826
01:04:56,599 --> 01:05:05,380
two and this one is also going Maybe a column
one. Down here, I'm gonna have a column three.
827
01:05:05,380 --> 01:05:11,970
And this last one will be a column one. So
if I come over to my styles now, and I come
828
01:05:11,970 --> 01:05:20,200
and create some styles for those, so we're
gonna have a call one, a call to, and a call
829
01:05:20,200 --> 01:05:26,400
three. And what unit do you think would make
the most sense for setting the sizes on these?
830
01:05:26,400 --> 01:05:29,950
Like, if you were going to do what's the easiest
way you can decide the width that one of these
831
01:05:29,950 --> 01:05:34,220
would be? You know, pixels would be a nightmare?
Just because you don't? How many pixels big?
832
01:05:34,220 --> 01:05:37,010
Should it be the screens always changing.
And then well, then it's not going to work
833
01:05:37,010 --> 01:05:41,770
at all the screen sizes, M's, and Rams Same
deal. It just it's not going to function.
834
01:05:41,770 --> 01:05:47,300
This is where percentages really come into
play. So my call one, I can give this a width.
835
01:05:47,300 --> 01:05:51,010
The question is, how big do I make it? Well,
I just said when we're looking at that last
836
01:05:51,010 --> 01:05:56,030
slide, we're going to divide this up into
four. So if I made this 25%, then I know that
837
01:05:56,030 --> 01:06:03,460
this one should be a width of 50%. And I know
that this one here should be a width of 75%.
838
01:06:03,460 --> 01:06:08,930
So let's come and look and see how that worked
on my layout. And look at that. Everything
839
01:06:08,930 --> 01:06:12,190
is lining up. This is a call one and this
is a call one. So now they're actually the
840
01:06:12,190 --> 01:06:16,480
same size as one another, they're working
out the way we'd wanted them to work out before
841
01:06:16,480 --> 01:06:20,170
they're matching each other. That's that's
perfect right before this was bigger, but
842
01:06:20,170 --> 01:06:25,180
it was a lot bigger. Now everything is lining
up with one another. The only problem we have
843
01:06:25,180 --> 01:06:29,981
now is there's no space between our columns.
And there's a lot of different ways we can
844
01:06:29,981 --> 01:06:35,290
approach this lack of space, a lot of popular
ways are using margins and padding to create
845
01:06:35,290 --> 01:06:39,460
space. But then this first column needs a
different style, because you can't have any
846
01:06:39,460 --> 01:06:42,690
margin on the left or this one needs a different
style because it can't have anything on the
847
01:06:42,690 --> 01:06:47,109
right side. And then you know the same thing
here, you start getting into a little bit
848
01:06:47,109 --> 01:06:51,790
of issues or problems with it. And luckily,
Flexbox actually has a really good way to
849
01:06:51,790 --> 01:06:59,210
solve this problem. We're gonna see that solution
in the next video. Alright, so everything
850
01:06:59,210 --> 01:07:02,980
in our layout is starting to come together.
But the problem now is our columns are stuck
851
01:07:02,980 --> 01:07:07,720
together. So as I mentioned in the last video,
we can fix this by adding some margin to them.
852
01:07:07,720 --> 01:07:10,760
But then you have the problem, how much margin
do you add, and then stuff doesn't really
853
01:07:10,760 --> 01:07:15,130
fit as well. So luckily, Flexbox has a way
to make it a little bit easier. And it's something
854
01:07:15,130 --> 01:07:19,190
called justified content. And this is a new
property that we're going to be using. We've
855
01:07:19,190 --> 01:07:23,280
already seen when we have Flexbox. When we
do display flex, this is what's happening,
856
01:07:23,280 --> 01:07:28,920
right, the parent gets display flex, and we
get columns. Now we can add a new thing called
857
01:07:28,920 --> 01:07:33,340
justify content. And there's a few different
properties on justify content, but one of
858
01:07:33,340 --> 01:07:37,400
them is called space between. And what that's
going to do is it's going to take the extra
859
01:07:37,400 --> 01:07:40,460
space that we had, and it's going to put it
between all the elements. So we look here
860
01:07:40,460 --> 01:07:45,290
as an example, we had all this extra space
that was left over on the left side. So when
861
01:07:45,290 --> 01:07:49,660
we add this justify content space between
it's taking that extra space, and it's putting
862
01:07:49,660 --> 01:07:53,990
it in between the columns, instead of leaving
it over on the right side. So what I'm going
863
01:07:53,990 --> 01:07:57,900
to do is first I'm going to exaggerate that
a lot, where I'm going to change all these
864
01:07:57,900 --> 01:08:05,040
numbers, but let's make them like pretty small,
I'm gonna say it's 1020, and 30%. And as you
865
01:08:05,040 --> 01:08:08,590
can see, we get all this leftover space and
it's just floating over here on the side of
866
01:08:08,590 --> 01:08:13,890
our page, we get all this empty space like
that. So what I can do is on where I have
867
01:08:13,890 --> 01:08:17,479
display flex, so it's always on the parent
in the same place that you declared display
868
01:08:17,479 --> 01:08:25,019
flex, we can then come down and you are just
d phi d phi content. So it's just like that
869
01:08:25,020 --> 01:08:29,399
two words, but they're hyphenated all properties,
they'll always just like we've started seeing
870
01:08:29,399 --> 01:08:34,108
max width is max width with a hyphen in it.
So justify content is the same. And then it
871
01:08:34,109 --> 01:08:37,880
will be space between there are two other
vowels you can use. And we're going to look
872
01:08:37,880 --> 01:08:41,299
at those in a second. But this is the one
we're going to be focusing on for now, which
873
01:08:41,299 --> 01:08:45,410
is space between. So now if we go and look
at our design, we can see that we have this
874
01:08:45,410 --> 01:08:49,399
giant space between them because it's taken
all that space that was left over on the right
875
01:08:49,399 --> 01:08:54,608
side. And it's evenly distributed it between
our columns now, which is awesome. Now in
876
01:08:54,609 --> 01:08:59,300
this exact situation, it isn't the best, but
it is pretty cool. Now the other two options
877
01:08:59,300 --> 01:09:04,839
you do have between other than space between
your space around. So what space around is
878
01:09:04,839 --> 01:09:09,330
going to do is it's also going to put the
space on the left and the right space between
879
01:09:09,330 --> 01:09:12,609
make sure that the item that's farthest to
the left and the item that's farthest to the
880
01:09:12,609 --> 01:09:17,500
right stay all the way on the sides. We're
a space around we'll put space around each
881
01:09:17,500 --> 01:09:21,850
item. Now the thing that's a little bit weird
is the way evenly distributes that space,
882
01:09:21,850 --> 01:09:27,210
it's taking the space and it's evenly putting
some on the right side of our element here
883
01:09:27,210 --> 01:09:30,430
and on the left side, and then it's putting
some on the right side of this one and on
884
01:09:30,430 --> 01:09:34,759
the left side and the right and the left.
So what that does is it does create this thing
885
01:09:34,759 --> 01:09:40,839
where the right space and the left space are
always smaller than the spaces in between,
886
01:09:40,839 --> 01:09:44,870
because it's doubled. Since this one you're
getting equal spacing on each side of each
887
01:09:44,870 --> 01:09:49,680
element. So these get bigger spaces than on
the two ends. So more recently, they've come
888
01:09:49,680 --> 01:09:54,840
up with one that to fix that problem. And
that one is spaced evenly. And what space
889
01:09:54,840 --> 01:09:59,860
evenly does is it tries to make it visually
look like it's balanced. This despite width
890
01:09:59,860 --> 01:10:05,520
display. than anything else, it will make
all the spaces be even, instead of doing that
891
01:10:05,520 --> 01:10:09,380
weird space around things, so space seemingly
is a really nice solution. But for now we're
892
01:10:09,380 --> 01:10:13,469
going to stick with space between and it's
probably the one that you're going to be using
893
01:10:13,469 --> 01:10:18,219
the most often. So what we can do now is we
can fix the actual width we had on here. Now
894
01:10:18,219 --> 01:10:24,820
Originally, we had this as 2550, and 75. But
the problem with that is, that doesn't leave
895
01:10:24,820 --> 01:10:30,340
any space for our space between to redistribute
because when we add all of those up, we're
896
01:10:30,340 --> 01:10:35,730
always hitting 100% 25 and 25 is 50 plus 50,
is 100. And if we come and look down at the
897
01:10:35,730 --> 01:10:41,380
bottom, we have 75 plus 20 fives, we have
100% space there as well. And so for simplicity,
898
01:10:41,380 --> 01:10:45,220
now, I'm just going to reduce a lot, we're
gonna take 5% off each one of these, so this
899
01:10:45,220 --> 01:10:50,500
will become 45. And this one will become 70,
we take 5% off on all of them, it's going
900
01:10:50,500 --> 01:10:54,370
to leave us a whole bunch of extra space that
this space between can now redistribute in
901
01:10:54,370 --> 01:11:00,820
between our different items. So if we go and
take a look, we have our nice big gaps in
902
01:11:00,820 --> 01:11:05,210
between all of them. Now, everything should
be lining up pretty well. And it is working
903
01:11:05,210 --> 01:11:10,900
out nicely when we go on bigger or smaller
screens. Now it's not 100% perfect, because
904
01:11:10,900 --> 01:11:15,560
our padding is making these columns a little
bit bigger than what they were. But for the
905
01:11:15,560 --> 01:11:19,500
purposes of what we're up to right now, I
do think it is good enough, and it is working
906
01:11:19,500 --> 01:11:26,590
really well. So I am really happy with it.
In the last one, we saw how we can control
907
01:11:26,590 --> 01:11:30,540
our columns on the horizontal and we can space
things out on the horizontal axis, which is
908
01:11:30,540 --> 01:11:35,280
our main axis. In this video, we're going
to be seeing the Align items property, which
909
01:11:35,280 --> 01:11:39,920
works with Flexbox, just like justify content
does. And what this does is it allows us to
910
01:11:39,920 --> 01:11:43,980
control our items on the vertical axis instead
of the horizontal. So when we do our display
911
01:11:43,980 --> 01:11:48,020
flex, we get all those different block level
elements, which turned into columns and stacked
912
01:11:48,020 --> 01:11:51,739
next to each other when they become flex items.
And one of the things they do when this happens
913
01:11:51,739 --> 01:11:55,989
is they actually stretch the whole height
of the div and the height of the div is generally
914
01:11:55,989 --> 01:11:59,890
controlled by the item which has the biggest
height. So this a lot of time is actually
915
01:11:59,890 --> 01:12:03,440
a good thing. It's something that we wanted
in CSS forever, because it used to be almost
916
01:12:03,440 --> 01:12:07,370
impossible to match heights of different items.
And now we can actually do it really easily.
917
01:12:07,370 --> 01:12:11,270
But it's not something we always want to do.
Sometimes we want things to align to the top.
918
01:12:11,270 --> 01:12:16,010
And so we can use align items, and we use
the value of flex start to be able to do it
919
01:12:16,010 --> 01:12:20,440
where they'll all shrink and be just dependent
on the height of whatever is inside of them.
920
01:12:20,440 --> 01:12:24,010
And this is one of the ones you'll probably
use the most often. The next one you can do
921
01:12:24,010 --> 01:12:27,880
is Center, which is also really, really handy
vertically centering in CSS used to be an
922
01:12:27,880 --> 01:12:31,680
absolute nightmare. And a lot of the time
you want to be able to vertically center stuff,
923
01:12:31,680 --> 01:12:35,210
you can do it with Flexbox, which is super
nice. And if you want to align things all
924
01:12:35,210 --> 01:12:40,360
on the bottom, you can do it with flex. And
there's also the stretch, which is the default.
925
01:12:40,360 --> 01:12:44,340
And just if you ever need to reset and go
back to the way things were if to overwrite
926
01:12:44,340 --> 01:12:47,550
something, there's also another one called
baseline that I'm not really going to get
927
01:12:47,550 --> 01:12:52,150
into too much. Now. It's the one that people
don't use very often it deals with the text
928
01:12:52,150 --> 01:12:56,800
inside the elements. And it's a little bit
weird, but there is the baseline one as well.
929
01:12:56,800 --> 01:13:00,370
So to take a look at an actual layout, what
I've done is I've taken the layout that we
930
01:13:00,370 --> 01:13:03,540
were working on before and they've eliminated
a bunch of the content just so we can focus
931
01:13:03,540 --> 01:13:07,719
on these three columns here, I put a blue
border on our columns container just so we
932
01:13:07,719 --> 01:13:13,030
can see it. And I've put the pink border or
the magenta border here on our columns, all
933
01:13:13,030 --> 01:13:17,170
of these borders are just to help illustrate
what's happening with all of it. So as I mentioned,
934
01:13:17,170 --> 01:13:21,380
when we do a display flex, everything turns
into a column. And by default, they stretch
935
01:13:21,380 --> 01:13:24,620
to match the height of their parent and the
height of the parent. In this case, if you
936
01:13:24,620 --> 01:13:29,510
remember, any block level element, by default
will be a height of zero, but grow to fit
937
01:13:29,510 --> 01:13:33,100
the content that's inside of them. This is
the one that has the biggest height on it.
938
01:13:33,100 --> 01:13:36,510
So our parent is growing to fit this middle
container. And that means these other ones
939
01:13:36,510 --> 01:13:40,950
are stretching to match its height. Sometimes
that's a good thing. But it's kind of weird
940
01:13:40,950 --> 01:13:44,951
that this brown box on the right side is stretching
to fit the height there, I find that really,
941
01:13:44,951 --> 01:13:48,080
really awkward. So what I'm gonna do is I'm
actually gonna put this on the side. So we
942
01:13:48,080 --> 01:13:53,180
can take a look at it while we're working
and really see things live while I'm editing
943
01:13:53,180 --> 01:13:59,300
some code here. So let's come down on to where
we have display flex, and we have our justify
944
01:13:59,300 --> 01:14:04,310
content. So again, that's for the main axis,
or generally the horizontal, we can switch
945
01:14:04,310 --> 01:14:08,190
that and we're gonna see that a little bit
later on. But for now justify content is on
946
01:14:08,190 --> 01:14:14,450
the horizontal axis and then align items,
we'll be dealing with the vertical axis, or
947
01:14:14,450 --> 01:14:19,140
you're going to start hearing me say across
axis a lot more. So up and down at the current
948
01:14:19,140 --> 01:14:23,570
moment. So what I can do on this is I can
do a flex start. And when I do that, you'll
949
01:14:23,570 --> 01:14:28,140
see here, everything has shrunk to fit the
content of what's inside of it. And this is
950
01:14:28,140 --> 01:14:32,871
sort of the behavior that you might expect
to be the default. And it's the one that you
951
01:14:32,871 --> 01:14:36,780
as I said, you probably if you want to override
the default, this is the one you'll probably
952
01:14:36,780 --> 01:14:42,730
use the most often. If I turn off the border,
which is right here, you won't really see
953
01:14:42,730 --> 01:14:46,460
you won't actually see a difference on those
first two columns when I do it, it's just
954
01:14:46,460 --> 01:14:51,451
that brown column that's jumping to really
long or shrinking down. In reality, this one
955
01:14:51,451 --> 01:14:55,080
is doing it to it just because there's no
background and there's no border on it. It
956
01:14:55,080 --> 01:14:57,640
doesn't actually make a big difference. So
if you don't have any background colors or
957
01:14:57,640 --> 01:15:01,390
any borders, you probably won't have to worry
about This too much. But as soon as you have
958
01:15:01,390 --> 01:15:05,750
something that has a border has a background
color has a shadow on it, which we'll be exploring
959
01:15:05,750 --> 01:15:10,239
a bit later, all of those things will affect
what's going on. So that's where you might
960
01:15:10,239 --> 01:15:13,910
want to bring in your flex start to make sure
everything is shrinking down to where you
961
01:15:13,910 --> 01:15:17,440
want it to be, we also saw that we have a
flex end. So that's going to push everything
962
01:15:17,440 --> 01:15:22,380
to sit along the bottom might seem a little
bit weird it is. But you might be wondering
963
01:15:22,380 --> 01:15:27,440
when I would use it, not terribly often, probably,
but it is something that could come up. And
964
01:15:27,440 --> 01:15:31,680
then we have our center, which you'll use
more often than you might think. And it can
965
01:15:31,680 --> 01:15:38,060
be really, really handy. As I also mentioned
there is the baseline, you'll notice that
966
01:15:38,060 --> 01:15:43,250
the way the baseline one works is it's taking
this first line of text and it's making this
967
01:15:43,250 --> 01:15:46,970
is a bigger font size than this one, it's
making sure all the text on that first line
968
01:15:46,970 --> 01:15:51,370
is actually sitting on like there's this imaginary
line that goes the whole way across under
969
01:15:51,370 --> 01:15:56,110
the first line of text and every box. So if
we actually came and just for one, change
970
01:15:56,110 --> 01:16:02,380
the h2 font size here, let's just double it
up to three, it's pushed my brown box further
971
01:16:02,380 --> 01:16:08,250
down. So everything is matching this. The
first line is lorem ipsum. Right at the top,
972
01:16:08,250 --> 01:16:12,060
the bottom of those letters is lined up with
the bottom of this, the baseline is dealing
973
01:16:12,060 --> 01:16:16,910
with the bottom of the first line of the text,
you probably won't use it very often. But
974
01:16:16,910 --> 01:16:21,900
I figure I'll bring it up because you might
run into it at one point or another. So that
975
01:16:21,900 --> 01:16:27,710
is how the Align items works. Let's go back
to flex start. Now. The one thing that does
976
01:16:27,710 --> 01:16:31,989
drive me a little nuts is its flex start flex
and of course center and flex center. I don't
977
01:16:31,989 --> 01:16:36,090
know how they decided that or why they decided
it. But that's what it is. And we do have
978
01:16:36,090 --> 01:16:42,420
to live with it. For any module, the course
is all about starting to think responsively.
979
01:16:42,420 --> 01:16:47,040
And one of the most important things to building
a responsive layout is understanding media
980
01:16:47,040 --> 01:16:51,800
queries. So we've been looking at this big
screen layout. But we want to be able to make
981
01:16:51,800 --> 01:16:56,090
this work at small screens. And to be able
to do that we need to know how media queries
982
01:16:56,090 --> 01:17:00,840
work. So you might be asking what is a media
query? Well, it's this feature in CSS that
983
01:17:00,840 --> 01:17:05,600
lets us add new styles that target only specific
conditions. So the basic syntax of a media
984
01:17:05,600 --> 01:17:09,180
query looks something like this. But there
are a few other things that we do need to
985
01:17:09,180 --> 01:17:14,660
include in here for it to actually do something.
So the first one is the media type. And we
986
01:17:14,660 --> 01:17:19,830
can also include media features. So media
features are certain things about the media
987
01:17:19,830 --> 01:17:23,850
type that we're looking at. So we can be very
specific with the situations that we're trying
988
01:17:23,850 --> 01:17:28,970
to target to put in additional CSS, the media
type itself, it lets us target different types
989
01:17:28,970 --> 01:17:33,330
of media. As the name implies, we have a screens,
we can target our screens specifically. So
990
01:17:33,330 --> 01:17:38,150
I can read at media screen, we also have print,
and I said there was a third one. So the third
991
01:17:38,150 --> 01:17:43,980
one is speech. Under media conditions. Those
let us target specific conditions within that
992
01:17:43,980 --> 01:17:48,770
media type be include width, so you can do
something like that media, min width 600 pixels,
993
01:17:48,770 --> 01:17:53,880
orientation. So you can actually say like
I want an orientation is landscape or portrait.
994
01:17:53,880 --> 01:17:58,290
You can also look for specific features of
that device like hover, can that user's primary
995
01:17:58,290 --> 01:18:02,920
input device actually hover? So where are
they using a mouse? Or are they not you might
996
01:18:02,920 --> 01:18:07,630
be on a tablet, and then the browser actually
will know that you're not using a mouse and
997
01:18:07,630 --> 01:18:12,150
that you can't really hover. So you can actually
put write specific CSS that targets only devices
998
01:18:12,150 --> 01:18:15,930
where you have that or maybe where you don't
have that ability. So that's really, really
999
01:18:15,930 --> 01:18:20,330
cool that we can do that. Both media types
and conditions are optional. So you don't
1000
01:18:20,330 --> 01:18:24,140
have to include both all the time. But you
do need to have one or the other. Because
1001
01:18:24,140 --> 01:18:28,350
if you don't have a type or condition, it's
kind of useless, then we're not targeting
1002
01:18:28,350 --> 01:18:32,110
anything. So we do want to always have one
or the other. So for example, we can target
1003
01:18:32,110 --> 01:18:37,040
only screens. So I can say at media screen
and have some some styles there, or maybe
1004
01:18:37,040 --> 01:18:41,120
more commonly would be at media print. And
you might be going well, why why would you
1005
01:18:41,120 --> 01:18:44,750
target print, we're building a website. And
you're right, but let's say you had a recipe
1006
01:18:44,750 --> 01:18:47,660
website, and you wanted to make it. So if
somebody hit command p, they can actually
1007
01:18:47,660 --> 01:18:52,390
print out the recipe directions really well,
I'm sure you've also seen these recipe websites,
1008
01:18:52,390 --> 01:18:56,690
where it's like 10,000 words, before you actually
see the recipe you can hold up, you can actually
1009
01:18:56,690 --> 01:19:01,140
like literally make all of that through CSS
disappear, and only have the recipe itself
1010
01:19:01,140 --> 01:19:04,820
show up. And you can format it perfectly to
print on the page. And people would love you
1011
01:19:04,820 --> 01:19:10,090
for that. So something really cool you could
do through a media query and some CSS, we
1012
01:19:10,090 --> 01:19:13,719
can also choose only a condition such as the
width of the viewport. So if I don't include
1013
01:19:13,719 --> 01:19:18,719
the media type, and I just put the condition,
it's actually defaulting to a media type of
1014
01:19:18,719 --> 01:19:23,190
all so this is gonna look at all media that
have a minimum width of 960 pixels. In this
1015
01:19:23,190 --> 01:19:27,270
case, the one thing that's really important
is if you want to combine a type and the condition
1016
01:19:27,270 --> 01:19:31,550
with it, you actually have to use the word
and so we would write something like this
1017
01:19:31,550 --> 01:19:37,489
at media screen, and min width of 960 pixels
really quickly. While we're here, you might
1018
01:19:37,489 --> 01:19:41,520
also see times where there's the only word
in there, don't worry about it. It was for
1019
01:19:41,520 --> 01:19:44,950
old browsers, we don't have to worry about
it too much. These days, we can literally
1020
01:19:44,950 --> 01:19:50,020
just write screen. Another example here would
be screen and orientation portrait. For now
1021
01:19:50,020 --> 01:19:53,930
we're really going to be focused on the sizes
so we're not going to worry too much about
1022
01:19:53,930 --> 01:19:57,600
some other stuff. We're all going to take
a look at orientation in this video as well
1023
01:19:57,600 --> 01:20:03,300
though, but for this course, the focus As
on min and max width and making sure we understand
1024
01:20:03,300 --> 01:20:06,930
those, because those are the ones that we'll
be using the most often. And let's start with
1025
01:20:06,930 --> 01:20:11,930
a really, really, really basic example. And
this is not a realistic example. But it's
1026
01:20:11,930 --> 01:20:16,580
the type of example that sort of hammers home
exactly how these actually work. So let's
1027
01:20:16,580 --> 01:20:21,800
give this a background that is pink. And we
can take a look at it. Well, now my my website
1028
01:20:21,800 --> 01:20:26,860
has a pink background. And that's it. That's
all right. But let's come in here and write
1029
01:20:26,860 --> 01:20:33,210
a media query. So I'm going to do at media,
I'm going to do my opening, close parentheses.
1030
01:20:33,210 --> 01:20:37,590
And then I'm going to do my squiggly braces.
So we come into here, and I'm going to use
1031
01:20:37,590 --> 01:20:43,270
my min width, min width of 400 pixels, which
is pretty small. But again, this is just a
1032
01:20:43,270 --> 01:20:47,750
really basic example. So if you remember,
this is the same as saying all and minimum
1033
01:20:47,750 --> 01:20:51,969
width of 400 pixels, we really don't need
to bother with that. So we can just have our
1034
01:20:51,969 --> 01:20:58,000
media condition here of 400 pixels for all
of our media types. And let's change our background
1035
01:20:58,000 --> 01:21:03,400
color. Now, one thing, I do this all the time,
but I'll just write background here. But this
1036
01:21:03,400 --> 01:21:08,480
doesn't work, and then go whoops. The reason
that doesn't work is because we need to tell
1037
01:21:08,480 --> 01:21:11,210
it well, what are we changing the background
of so you literally have to come and write
1038
01:21:11,210 --> 01:21:15,050
your selector again. And this looks a little
bit weird when you're not used to it that
1039
01:21:15,050 --> 01:21:19,940
we have this like nesting inside of CSS and
HTML, we're used to seeing nesting, but in
1040
01:21:19,940 --> 01:21:23,739
CSS, it can look a little strange. Just have
to get used to it, though, because that's
1041
01:21:23,739 --> 01:21:28,020
how it works. So we have my media query opening
close curly braces, and then I have my body
1042
01:21:28,020 --> 01:21:33,880
selector inside of there. And I can say that
the background here is let's change it over
1043
01:21:33,880 --> 01:21:38,630
to purple. So now if I come and take a look
at small screens, it will be pink. And then
1044
01:21:38,630 --> 01:21:43,210
when they pass a certain width, it will be
purple. So what's happening is this here is
1045
01:21:43,210 --> 01:21:51,020
saying from a minimum width of 400 pixels
and bigger from that size and bigger because
1046
01:21:51,020 --> 01:21:55,210
it's starting at that minimum width. And we
can do another one here, let's say an app
1047
01:21:55,210 --> 01:22:05,130
media, minimum width 650 pixels. And we can
say on this one, my body has a background
1048
01:22:05,130 --> 01:22:11,210
of orange. So let's go take a look again,
let's go smaller, so it really small screens,
1049
01:22:11,210 --> 01:22:14,590
it's going to our default pink, that's just
like, Well, when I say default pink, I just
1050
01:22:14,590 --> 01:22:18,570
mean like the original style on my body of
pink, then as we make it bigger, oh, we're
1051
01:22:18,570 --> 01:22:22,300
getting over to that minimum with the 400
pixels. And then as we keep getting bigger,
1052
01:22:22,300 --> 01:22:27,540
we're going to hit there's my 650 pixels,
and then it will stay that color for as long
1053
01:22:27,540 --> 01:22:32,830
as we're there. So that is the basics of how
it works. Now one thing that's really important
1054
01:22:32,830 --> 01:22:40,590
here is, let's bring this comment down here
and put 650. Because the order of these is
1055
01:22:40,590 --> 01:22:43,949
really, really important. And this goes back
to a little bit the same way. If you remember
1056
01:22:43,949 --> 01:22:49,440
when we were looking at the pseudo classes
for links, a link, a hover a visited a active,
1057
01:22:49,440 --> 01:22:54,320
all of those, you could actually be in more
than one of those states at a time. Because
1058
01:22:54,320 --> 01:22:58,570
if you're clicking on something, it's active,
but you're also hovering over it. So the order
1059
01:22:58,570 --> 01:23:03,800
that you put those selectors in changed, if
what you actually wanted would would kick
1060
01:23:03,800 --> 01:23:09,550
in, right. So it's the same thing here. So
if I move this one, up to here, it's just
1061
01:23:09,550 --> 01:23:14,730
always gonna be purple. So let's go take a
look. It's purple. And it's purple, and it's
1062
01:23:14,730 --> 01:23:19,420
purple. And then it's pink, this completely
gets skipped over. Because it's looking at
1063
01:23:19,420 --> 01:23:25,380
this and it's saying from a minimum width
of 650 pixels and bigger. But well, this condition
1064
01:23:25,380 --> 01:23:30,460
matches, you know, this is 400, and bigger.
So 400, and bigger includes 650, and bigger.
1065
01:23:30,460 --> 01:23:35,420
So it goes here, but it goes Oh, well. It's
the same as if I had here, I paragraphs should
1066
01:23:35,420 --> 01:23:44,770
be red color, red. And then I said my paragraphs
should be color. yellow, yellow is going to
1067
01:23:44,770 --> 01:23:49,320
win because yellow is second here. So if we
come and look, my paragraphs are yellow, which
1068
01:23:49,320 --> 01:23:53,840
we don't want to do. But it's the same concept
that's coming here. This is true. And this
1069
01:23:53,840 --> 01:23:58,739
is true. So I'm going to take the second one.
So the order is really, really important.
1070
01:23:58,739 --> 01:24:01,670
Now one thing you can actually do, which we
didn't see in the slides, you can combine
1071
01:24:01,670 --> 01:24:06,650
two different media conditions as well. So
I could also write an ad here and say a max
1072
01:24:06,650 --> 01:24:17,620
width of 649 pixels. So now we've this CSS
will only work between 400 pixels, and 649
1073
01:24:17,620 --> 01:24:23,030
pixels. So now if we go and take a look, we
will still get our purple, but we will also
1074
01:24:23,030 --> 01:24:31,651
get our orange afterwards. Because this no
longer works. Once we get to above 649. max
1075
01:24:31,651 --> 01:24:37,890
width is always from zero Intel. This is a
maximum width of. So that's also really, really
1076
01:24:37,890 --> 01:24:47,780
important. So from a minimum of 400 pixels,
up to a width of 649 pixels. I'm going to
1077
01:24:47,780 --> 01:24:51,460
do one more I'm not going to delete this.
I'm just going to comment it out. And I do
1078
01:24:51,460 --> 01:24:53,650
want to look at this, but I'm gonna change
the number in here because it's going to make
1079
01:24:53,650 --> 01:24:58,860
it a little bit easier to play with. So let's
just bring this down to 500 pixels. So right
1080
01:24:58,860 --> 01:25:03,340
now we have the pink background which we'll
switch over to orange when we hit that specific
1081
01:25:03,340 --> 01:25:07,930
screen size. So pink over to orange, I said,
we're going to focus on a min and max width,
1082
01:25:07,930 --> 01:25:12,130
but I just do want to look at orientation
a little bit. So orientation. And I'm going
1083
01:25:12,130 --> 01:25:17,210
to make this one landscape. So a landscape
orientation when something is some when something
1084
01:25:17,210 --> 01:25:22,400
is wider than it is tall, and you have portrait,
which is when it's taller than it is wide.
1085
01:25:22,400 --> 01:25:26,070
So if we have the orientation of landscape
on there, we can see it's pink, it's pink,
1086
01:25:26,070 --> 01:25:31,260
it's pink, oh, well, now we have it as orange,
because you can see that it's wider than it
1087
01:25:31,260 --> 01:25:37,010
is tall. But that's fine, that little ground
here. So here, you can see actually, when
1088
01:25:37,010 --> 01:25:41,300
I'm switching only the height and not the
width, that it's actually switching between
1089
01:25:41,300 --> 01:25:45,050
the two of them, because right now it's wider
than it is tall. And now it's taller than
1090
01:25:45,050 --> 01:25:50,480
it is wide. So we can actually have CSS that
looks at the viewport height and width, and
1091
01:25:50,480 --> 01:25:54,670
applies certain rules too, which can be really,
really interesting. So it can also help when
1092
01:25:54,670 --> 01:25:58,940
you're dealing with like tablets or phones.
And when people are moving things around in
1093
01:25:58,940 --> 01:26:03,150
the orientation, you can even look at specific
aspects ratios, there's a whole bunch of extra
1094
01:26:03,150 --> 01:26:07,080
stuff that I didn't even really mention that
I'll link to in the notes of this lesson,
1095
01:26:07,080 --> 01:26:10,100
it's on the MDM page, I don't really want
you to take a deep dive into that, because
1096
01:26:10,100 --> 01:26:13,690
it can seem awfully confusing. But I do want
to make you aware that media queries, you
1097
01:26:13,690 --> 01:26:16,150
can do a whole bunch of stuff with it, it's
actually really, really powerful. But I'd
1098
01:26:16,150 --> 01:26:20,550
really encourage you to do now is to play
around a little bit with what we have here.
1099
01:26:20,550 --> 01:26:26,410
And I'm going to take this one off, actually,
and alternate this one back on and play around
1100
01:26:26,410 --> 01:26:30,170
with this, we're going to be using media queries
a lot in the project we're working on from
1101
01:26:30,170 --> 01:26:34,050
now on. But I'd really like you to play around
with it a little bit to make sure that you're
1102
01:26:34,050 --> 01:26:38,230
comfortable with them, because they're super,
super important to understand. And when you're
1103
01:26:38,230 --> 01:26:40,810
feeling a bit more comfortable with it, you
can jump into the next video where we're going
1104
01:26:40,810 --> 01:26:48,790
to be applying all of this into the project
that we've been working on. Our layout is
1105
01:26:48,790 --> 01:26:52,020
already a little bit responsive, because when
we grow it is working. But when we shrink
1106
01:26:52,020 --> 01:26:55,400
it a will shrink with our site. But we run
into this problem that we have it just getting
1107
01:26:55,400 --> 01:26:59,100
way too narrow at one point. And we do end
up with a bit of side scrolling, just because
1108
01:26:59,100 --> 01:27:04,250
the text doesn't have enough room to live
and to work. So we want to make it fully responsive.
1109
01:27:04,250 --> 01:27:08,480
How can we do that? Right, we want to make
it so at one point, these columns break and
1110
01:27:08,480 --> 01:27:12,560
it turns into them stacking on top of each
other instead. To do this, we actually we've
1111
01:27:12,560 --> 01:27:17,380
already started using display flex. And so
when we use display flex, it creates columns.
1112
01:27:17,380 --> 01:27:20,670
And that's because there's something called
flex direction and it's set to row. This is
1113
01:27:20,670 --> 01:27:25,340
the default behavior. So when we say row width
means that the parent is a row. So that means
1114
01:27:25,340 --> 01:27:29,449
all the children become columns within that
row, this is the default. So if you don't
1115
01:27:29,449 --> 01:27:33,720
declare this, it's just going to be there.
So you don't have to declare it a flex direction
1116
01:27:33,720 --> 01:27:37,890
row. It's just that's the way it's going to
work. But we can switch that flex direction
1117
01:27:37,890 --> 01:27:42,180
from row two column, this switch is the main
axis and that I'm going to be talking about
1118
01:27:42,180 --> 01:27:45,740
the main axis a lot in the next video, we're
just going to see a little bit of how we can
1119
01:27:45,740 --> 01:27:49,739
work for our layout in this one. But basically
what it means is the parent has become a column,
1120
01:27:49,739 --> 01:27:54,970
so all of the children inside of it have become
rows. So if we have our display flex, it's
1121
01:27:54,970 --> 01:28:00,010
doing this where all the children have become
columns. And when we add flex direction column,
1122
01:28:00,010 --> 01:28:04,120
it's making the parent now a column so the
parent is going up and down and all of the
1123
01:28:04,120 --> 01:28:07,470
children become rows. And you might say this
looks a little bit like the default when we
1124
01:28:07,470 --> 01:28:10,890
don't even have display flex. And you'd be
right. But there's reasons that we'd want
1125
01:28:10,890 --> 01:28:14,140
to do this. So let's go and give it a try
with our layout and see how it can work. We're
1126
01:28:14,140 --> 01:28:18,091
going to want to do this with a media query
as well. So let's just come to here where
1127
01:28:18,091 --> 01:28:22,680
we have our display flex. And as I said, the
default on that is already a flex direction
1128
01:28:22,680 --> 01:28:27,410
of row. So we don't need to declare that because
it's already there. If you want to, you always
1129
01:28:27,410 --> 01:28:33,140
can. But we don't need to. But what I want
to do is come and do a media query. So if
1130
01:28:33,140 --> 01:28:37,140
you're feeling really comfortable with media
queries, and you're sort of got the hang of
1131
01:28:37,140 --> 01:28:40,280
it, when you're playing around in the last
video, I'd encourage you to go ahead now and
1132
01:28:40,280 --> 01:28:44,390
create a media query, we're going to target
a screen size of about 600 pixels. And because
1133
01:28:44,390 --> 01:28:48,340
we've already set it up for big screens, we're
going to use max width. So remember, max width
1134
01:28:48,340 --> 01:28:54,100
is meaning from small Intel that maximum size.
So for the small screens, I'm going to target
1135
01:28:54,100 --> 01:28:57,800
a max width of about 600 pixels, and we're
going to switch the flex direction on it.
1136
01:28:57,800 --> 01:29:01,141
So if you want to give that a try, you think
you can do it, go ahead and do that in a few
1137
01:29:01,141 --> 01:29:08,410
seconds. I'll do it myself. Let's go and make
my media query now. So remember, it is always
1138
01:29:08,410 --> 01:29:12,800
add media, then we always have our parentheses.
And then we have our curly braces, I'm going
1139
01:29:12,800 --> 01:29:17,000
to push return to give myself the space. But
I'm going to come in here and set my max width.
1140
01:29:17,000 --> 01:29:23,240
So max width 600 pixels. And then we can come
into here. Now one thing and I do this too,
1141
01:29:23,240 --> 01:29:27,130
and I've been writing media queries for a
long time, is I'll just start writing the
1142
01:29:27,130 --> 01:29:31,200
properties I want. So I'll come in here and
do a flex direction. So if you did this and
1143
01:29:31,200 --> 01:29:35,190
it didn't work, it's because we have to choose
our selector again. So it's a little weird
1144
01:29:35,190 --> 01:29:39,400
that we have like these nested selectors inside
immediate queries, but that is how we are
1145
01:29:39,400 --> 01:29:44,280
going to be working. So I'm going to do a
dot columns to select my columns and then
1146
01:29:44,280 --> 01:29:50,540
make a opening closing curly braces and now
I can come in here and do a flex direction.
1147
01:29:50,540 --> 01:29:55,989
And my flex direction will be calling. So
let's go and see if this works. So everything
1148
01:29:55,989 --> 01:30:00,870
is looking great on the big sizes. And then
when we shrink down and we hit 600 pics Boom,
1149
01:30:00,870 --> 01:30:05,410
look at that everything is stacking on top
of each other. Now, it's not perfect, right?
1150
01:30:05,410 --> 01:30:09,060
It's not great, but everything is stacking,
which is what we want it to happen to begin
1151
01:30:09,060 --> 01:30:13,930
with. So that is really, really good. But
what's the problem? Why are these so not taking
1152
01:30:13,930 --> 01:30:19,860
up all the space like we want them to? Well,
if you remember, we set widths on all of these.
1153
01:30:19,860 --> 01:30:23,630
So that is where the problem is coming in
right now. So what we can do is create a new
1154
01:30:23,630 --> 01:30:29,290
media query that is going to change all of
those to give them all a width of 100%. So
1155
01:30:29,290 --> 01:30:33,410
what I'd encourage you to do now is actually
to go ahead and try doing that, and seeing
1156
01:30:33,410 --> 01:30:36,750
if you can get it to work. So we can do it
all with one selector. But I want you to go
1157
01:30:36,750 --> 01:30:39,900
ahead and try doing that. Now that you've
seen how I've done it, we want to target the
1158
01:30:39,900 --> 01:30:43,710
exact same screen size. And once you've done
it, I do want to look at a bit of a best practice
1159
01:30:43,710 --> 01:30:51,270
of using media queries as well. Right, so
what we can do is I'm going to copy this media
1160
01:30:51,270 --> 01:30:54,690
query that we already have right here, and
I'm going to paste it down at the bottom.
1161
01:30:54,690 --> 01:30:59,270
And we can delete this here. If you tried
redefining these columns inside this media
1162
01:30:59,270 --> 01:31:03,350
query, it wouldn't have worked. The reason
it wouldn't have worked is because first we'd
1163
01:31:03,350 --> 01:31:07,030
be doing the media query, and then we'd be
following it up with these. And these would
1164
01:31:07,030 --> 01:31:10,670
overwrite the media query, because this would
only be looking at a max width. But this is
1165
01:31:10,670 --> 01:31:15,590
looking at all situations. So just like we
saw in the last video, the order of things
1166
01:31:15,590 --> 01:31:19,940
really matter. Media Queries should always
come after the default selector that you already
1167
01:31:19,940 --> 01:31:24,660
have. So we can come into here. And you could
either have done just call like that, because
1168
01:31:24,660 --> 01:31:29,930
all of my columns have the also have the call
selector on them. So I can say call width
1169
01:31:29,930 --> 01:31:39,301
100%. And it will work. Or if you went and
you did call one call to and call three, and
1170
01:31:39,301 --> 01:31:43,430
gave them the width of 100%. That would also
work. I actually prefer this even though it's
1171
01:31:43,430 --> 01:31:47,410
a little bit longer, just because we've set
the sizes here. And then we're explicitly
1172
01:31:47,410 --> 01:31:51,390
setting the sizes here. So it makes it really
obvious that we're resetting these specifically.
1173
01:31:51,390 --> 01:31:55,510
Whereas if you went with that call selector
just to see Oh, well, it might not be as obvious
1174
01:31:55,510 --> 01:31:59,890
that you're targeting these ones specifically.
But either way, I think it is perfectly fine.
1175
01:31:59,890 --> 01:32:03,910
So let's go and take a look and see if that
worked. And look at that it is working. Oh
1176
01:32:03,910 --> 01:32:08,770
my goodness, isn't that cool? Isn't that really
fun, that everything is pretty much falling
1177
01:32:08,770 --> 01:32:13,790
into place. And our whole layout is changing,
like boom, just like that, the whole thing
1178
01:32:13,790 --> 01:32:18,690
comes and just it works, which is really,
really handy. And really, really fun and cool.
1179
01:32:18,690 --> 01:32:23,400
Now, one thing, before we leave this video,
we do have that padding issue, I'm not going
1180
01:32:23,400 --> 01:32:26,940
to worry about that one, right now we're going
to worry about that in a future video. The
1181
01:32:26,940 --> 01:32:30,420
one thing that you are noticing now is actually
if two media queries, and you could simplify
1182
01:32:30,420 --> 01:32:37,010
things by having just one media query that
has everything in it. And a lot of people
1183
01:32:37,010 --> 01:32:40,430
will do this, where they're gonna have all
their styles. And then at the very, very,
1184
01:32:40,430 --> 01:32:44,130
very bottom of their style sheet, they're
gonna put all their media queries so that
1185
01:32:44,130 --> 01:32:47,830
way, they don't have to put like 10 media
queries that are all targeting the same size,
1186
01:32:47,830 --> 01:32:52,500
they can just have one media query. So even
this called eg I could bring up to here, just
1187
01:32:52,500 --> 01:32:57,170
to clean it up. And then I have my media query
at the bottom that's making the changes that
1188
01:32:57,170 --> 01:33:02,610
I need to, it does make for you writing less
CSS, but sometimes when you have a really
1189
01:33:02,610 --> 01:33:06,670
complicated stylesheet, personally, I find
it complicates matters a little bit. And while
1190
01:33:06,670 --> 01:33:11,490
it will make your CSS file a little bit heavier
and a little bit bigger, I've seen some there
1191
01:33:11,490 --> 01:33:16,580
have been some tests done on when you're repeating
yourself a lot with media queries, how big
1192
01:33:16,580 --> 01:33:21,890
of an impact it has, and it's really not that
bad. So if you prefer keeping your media like
1193
01:33:21,890 --> 01:33:25,640
your columns, and then your media query for
your column here, and then your these and
1194
01:33:25,640 --> 01:33:29,020
then the media query for those there, there's
no problem with it. That's actually the way
1195
01:33:29,020 --> 01:33:33,840
I prefer to work, I find it much easier when
I want to make changes, all my columns, styles
1196
01:33:33,840 --> 01:33:37,430
are grouped together. And then all of these
are grouped together. But if you want to work
1197
01:33:37,430 --> 01:33:45,370
one way or another way, that is completely
fine. So let's take a look at how flex directions
1198
01:33:45,370 --> 01:33:50,510
actually working. And what's really going
on with this. So when we have a display flex,
1199
01:33:50,510 --> 01:33:54,620
we've seen the decree its columns, the reason
it's creating columns is because the flex
1200
01:33:54,620 --> 01:33:58,430
direction on it is row. And that's the default
behavior. So if you don't declare wrote this,
1201
01:33:58,430 --> 01:34:02,239
it will be row and there's nothing you really
have to do there. So that's where it makes
1202
01:34:02,239 --> 01:34:05,600
columns. And it's doing that because it's
treating the parent or the flex container,
1203
01:34:05,600 --> 01:34:10,500
like a row of content. So that means inside
of it, all the flex items, or all the direct
1204
01:34:10,500 --> 01:34:14,790
children are going to turn into individual
columns. Now what we can do is we can change
1205
01:34:14,790 --> 01:34:19,300
our flex directions, we can say flex direction
is column. And what that's doing, is it switching
1206
01:34:19,300 --> 01:34:23,790
the main axis. What do I mean by that? If
we have a something that has a display flex
1207
01:34:23,790 --> 01:34:28,390
on it, it looks something like this, we have
our flex container, it's a row. So we have
1208
01:34:28,390 --> 01:34:33,660
our columns of children inside of it. But
if I change my flex direction to column, now
1209
01:34:33,660 --> 01:34:38,650
the parent is becoming the column. And these
are becoming rows inside of it. And this sort
1210
01:34:38,650 --> 01:34:42,531
of makes it look like the original default
behavior. So you might be going well what's
1211
01:34:42,531 --> 01:34:47,630
the real point of this? It's really important
to understand you're switching the main axis.
1212
01:34:47,630 --> 01:34:53,040
So you're keeping all of the Flexbox properties,
all the amazing things that you can do. Now
1213
01:34:53,040 --> 01:34:58,650
we've rotated our main axis from being horizontal
to being vertical. Why does that matter? Well,
1214
01:34:58,650 --> 01:35:01,640
let's say we have something that looks like
this. We've done our display flex on it's
1215
01:35:01,640 --> 01:35:05,960
we've made our columns, we know we can use
justify content space between and that's going
1216
01:35:05,960 --> 01:35:09,470
to space all of them out. It takes all the
empty space that we had that was left over
1217
01:35:09,470 --> 01:35:13,920
here, and it redistributes it in between each
one of my columns. And that's just super handy.
1218
01:35:13,920 --> 01:35:19,380
Well, if I take my display flex, but I go
in and add a flex direction of column on it
1219
01:35:19,380 --> 01:35:24,750
with my justify content space between now
it's going to redistribute the space that
1220
01:35:24,750 --> 01:35:30,170
was down here between each one of them, because
justify content is always working on the main
1221
01:35:30,170 --> 01:35:34,660
axis. And we've switched the main axis it
was going left to right, but now it's working
1222
01:35:34,660 --> 01:35:39,350
vertically, it's working up and down. So if
I wanted redistribute the space, I can use
1223
01:35:39,350 --> 01:35:43,780
my justify content vertically now. So that's
really cool. So always remember, when I change
1224
01:35:43,780 --> 01:35:48,090
my flex direction, justify content will now
work vertically, and align items will now
1225
01:35:48,090 --> 01:35:53,300
work horizontally, because we switch them
in axis. justify content always works on the
1226
01:35:53,300 --> 01:35:58,300
main axis align items always works on the
cross axis. So a few reasons you might want
1227
01:35:58,300 --> 01:36:02,469
to do something like that are examples of
how things change. So we have my flex container
1228
01:36:02,469 --> 01:36:06,429
over here, and the line items flex start,
they'll usually line up at the top like that,
1229
01:36:06,429 --> 01:36:09,910
instead of stretching to their whole height.
If I switch the flex direction, they're going
1230
01:36:09,910 --> 01:36:13,929
to do something like this, where they're all
getting sucked to the flex start, which is
1231
01:36:13,929 --> 01:36:19,300
on the left side. Now, my flex end would be
on the opposite side over there. We know that
1232
01:36:19,300 --> 01:36:23,760
we can center items vertically, which is super
amazing with Flexbox. Well, now we can center
1233
01:36:23,760 --> 01:36:28,300
them like this. And of course, you can combine
that with your justify content. So it's not
1234
01:36:28,300 --> 01:36:32,969
the line items is centering it horizontally,
and then by justified content space between
1235
01:36:32,969 --> 01:36:36,910
is spacing them out vertically, as long as
the container is big enough to have empty
1236
01:36:36,910 --> 01:36:41,090
space on the vertical axis, they're always
remember, when you use flex direction, you're
1237
01:36:41,090 --> 01:36:46,719
switching the main axis align items now works
horizontally and justified content now works
1238
01:36:46,719 --> 01:36:53,739
vertically. Element because the now it's time
to look at how we can create a navigation
1239
01:36:53,739 --> 01:36:57,920
for a website. And all this flex stuff really
comes into play when we're styling a responsive
1240
01:36:57,920 --> 01:37:01,739
navigation for a site. Before we get into
the CSS, we need to know the markup behind
1241
01:37:01,739 --> 01:37:06,390
them. Traditionally speaking, we use an unordered
list and the unordered list will be placed
1242
01:37:06,390 --> 01:37:10,060
in another element because the nav will be
telling the browser that this is the main
1243
01:37:10,060 --> 01:37:14,400
navigation for our site. So it will look something
like this where we have a nav inside the nav,
1244
01:37:14,400 --> 01:37:18,150
we have the UL which is our unordered list.
And then we have our list items which are
1245
01:37:18,150 --> 01:37:22,061
links, there is some debate these days on
whether or not we really need it to be in
1246
01:37:22,061 --> 01:37:26,960
the list. The reason that we have traditionally
done it this way is for accessibility reasons.
1247
01:37:26,960 --> 01:37:31,739
And because it is a list of the different
pages that are on our site. These days, there
1248
01:37:31,739 --> 01:37:35,050
is some discussion about whether we need to
or if we could just have a nav with a bunch
1249
01:37:35,050 --> 01:37:40,190
of links in it. Some people do this, but most
sites you ever work on will be set up this
1250
01:37:40,190 --> 01:37:44,810
way. And this is still by far the most popular
and common way that you will see navigations
1251
01:37:44,810 --> 01:37:48,840
created. So it's really important that we
understand how to style a navigation when
1252
01:37:48,840 --> 01:37:52,949
it's set up like this, if you can do it this
way, it's much simpler if you didn't have
1253
01:37:52,949 --> 01:37:56,800
the list items. So I do want to show you the
more complicated way because again, it is
1254
01:37:56,800 --> 01:38:00,810
the one that you will run into in the real
world. So I want you able to do that. Once
1255
01:38:00,810 --> 01:38:04,179
you're done in this course through the next
bunch of videos, this is what we're going
1256
01:38:04,179 --> 01:38:07,600
to be working on which will be the navigation
for the bigger site that we will be working
1257
01:38:07,600 --> 01:38:11,780
on. And we're going to start with this one
here, then we're going to move into making
1258
01:38:11,780 --> 01:38:15,040
it look like this instead. And then we're
going to make this the responsive version
1259
01:38:15,040 --> 01:38:19,100
of this one right here. I'm going to go back
to this slide and leave this one here for
1260
01:38:19,100 --> 01:38:23,780
now and encourage you just to try and write
it all up and set it all up. So here are all
1261
01:38:23,780 --> 01:38:26,660
the colors and all the different things that
I will be using. And just to give you a little
1262
01:38:26,660 --> 01:38:31,670
bit of just see how I visualize this, when
I'm looking at it, I put these pink boxes
1263
01:38:31,670 --> 01:38:36,780
in to say I have my big, I have this big thing
that's going to be the whole size here, then
1264
01:38:36,780 --> 01:38:41,900
I'm going to have an element here. And that's
going to have my h1 and a paragraph. And then
1265
01:38:41,900 --> 01:38:46,110
I'm gonna have another one here, which is
the nav with the honor list. And the reason
1266
01:38:46,110 --> 01:38:50,430
that I'm setting it up like this is this is
going to be my header. And I'm, I need to
1267
01:38:50,430 --> 01:38:54,699
keep these two things grouped together, this
is just going to be a div called site title
1268
01:38:54,699 --> 01:38:57,830
or whatever you want to call it, it could
be called logo, it could be site title, or
1269
01:38:57,830 --> 01:39:02,460
just title, which is the main sort of title
of my actual website. It's almost like a logo,
1270
01:39:02,460 --> 01:39:06,600
but we're just using some text for it. And
then as I said, we need to have our NAB. So
1271
01:39:06,600 --> 01:39:09,870
that's what this is going to be for. If you
want to start off and do it on your own before
1272
01:39:09,870 --> 01:39:13,170
you watch me do it. In this video, I'm only
going to be doing the markup you can see I
1273
01:39:13,170 --> 01:39:17,140
have given you everything you need here to
do it. And I've also already linked to the
1274
01:39:17,140 --> 01:39:21,990
Google Font and given you the two font families
listed right here. So if you want to go ahead
1275
01:39:21,990 --> 01:39:25,830
and do more, by all means, see if you can
get the whole thing working. In this video
1276
01:39:25,830 --> 01:39:28,989
though, I'm only doing the markup. And then
the next one, I'm going to start doing the
1277
01:39:28,989 --> 01:39:34,782
CSS for it. Alright, so let's jump right into
it. So I'm gonna go in my body. As I mentioned,
1278
01:39:34,782 --> 01:39:40,690
I'm gonna have my header and close header.
And let's get inside of there. And we can
1279
01:39:40,690 --> 01:39:45,090
start putting some stuff. So I had that first
part that had my title in it. And I said,
1280
01:39:45,090 --> 01:39:48,551
I'm going to group that in a div. So let's
give that a div class. And I'm going to close
1281
01:39:48,551 --> 01:39:53,360
that div. And then we can give our class a
name. So let's just call this site title.
1282
01:39:53,360 --> 01:39:57,710
And in there, I'm going to have an h1 because
it's really the title of my entire page or
1283
01:39:57,710 --> 01:40:02,239
my entire site, and I'll come down and also
put a paragraph now my paragraph I will give
1284
01:40:02,239 --> 01:40:10,410
a class to have some title, and close paragraph,
I'm not using an h2 because h2 is really aren't
1285
01:40:10,410 --> 01:40:14,340
meant to be subtitles, they're meant to be
titles for different sections of the website,
1286
01:40:14,340 --> 01:40:19,570
we build out the full site, hope we're gonna
see them, we're gonna have a few h2 and threes
1287
01:40:19,570 --> 01:40:25,160
in the larger scale site once we get to that.
So for now, I'm just doing a p class of subtitles.
1288
01:40:25,160 --> 01:40:29,050
So I can style that different from my other
paragraphs that I will have within this site,
1289
01:40:29,050 --> 01:40:33,739
once we get to a bigger one. After that, I'm
going to come and give myself my nav, and
1290
01:40:33,739 --> 01:40:41,210
close nav. And we can come into here. And
I'll have my ul, and close ul. So that's my
1291
01:40:41,210 --> 01:40:48,300
unordered list. And then I need my list items.
So Li, and inside my Li, I do need a link.
1292
01:40:48,300 --> 01:40:57,070
So a href is equal to and close a, and let's
just take this whole thing and copy it, paste
1293
01:40:57,070 --> 01:41:00,640
them there. And now I can come through and
fill this out. I'm just gonna put hashtags
1294
01:41:00,640 --> 01:41:03,610
for now because we don't have anywhere to
go. Once we build up the whole site for this
1295
01:41:03,610 --> 01:41:06,870
rectory I have a three page sites, we're gonna
have to put in real links in here eventually.
1296
01:41:06,870 --> 01:41:13,560
But for now, we'll put the placeholder, this
is my home ism in life. There we go, there
1297
01:41:13,560 --> 01:41:17,050
is all my content. And you can see it doesn't
look at all like what we want it to. So in
1298
01:41:17,050 --> 01:41:20,929
the next video, we are going to start styling
this up and making it look better, we have
1299
01:41:20,929 --> 01:41:24,969
to deal with some extra spacing, we have these
bullet points we need to disappear, there
1300
01:41:24,969 --> 01:41:27,450
is a whole bunch of stuff that we need to
do here. So we're gonna see how we get rid
1301
01:41:27,450 --> 01:41:30,700
of those bullet points, and then how we can
bring in Flexbox, and how it's going to work
1302
01:41:30,700 --> 01:41:34,989
for all of this and how it makes our life
much easier in setting up everything, how
1303
01:41:34,989 --> 01:41:41,300
many bullet points, we've got everything set
up, but it doesn't look so nice right now.
1304
01:41:41,300 --> 01:41:44,070
So let's go and take a look at how we can
do it, there is something new that we need
1305
01:41:44,070 --> 01:41:47,620
to look at is how do we even get rid of those
bullet points, which is kind of interesting.
1306
01:41:47,620 --> 01:41:50,220
So for this one, I'm going to leave this on
the side here. So we can at least see the
1307
01:41:50,220 --> 01:41:54,970
changes that I'm making happen live, we're
going to jump over to my styles. Now for now
1308
01:41:54,970 --> 01:41:58,250
we have all these fancy designs and the colors
and everything, I'm not going to worry about
1309
01:41:58,250 --> 01:42:03,219
those for now. Because I really want you to
be focused just on how Flexbox works. And
1310
01:42:03,219 --> 01:42:07,610
doing the overall styling and setting this
up. I don't want to distract with other CSS.
1311
01:42:07,610 --> 01:42:11,120
But we will be building out this whole thing
for an actual website. So we will be getting
1312
01:42:11,120 --> 01:42:15,250
into all of the different styles that we need
to do for this eventually, because I'm not
1313
01:42:15,250 --> 01:42:19,690
worried about it, I'm not going to be terribly
concerned with him organizing my CSS. So let's
1314
01:42:19,690 --> 01:42:24,690
start with my nav. And I don't have a lot
to do on that. Now you'll notice here that
1315
01:42:24,690 --> 01:42:29,550
I have my nav and a ul Li and I have my a
and we need to style all of these, there's
1316
01:42:29,550 --> 01:42:33,760
stuff that we need to do on all of them. But
what I what you will see some people do is
1317
01:42:33,760 --> 01:42:37,330
you will see people give classes to this.
And I actually do this on a regular basis
1318
01:42:37,330 --> 01:42:42,190
where you'll have a nav list. And then this
would be a all three of these would be a class
1319
01:42:42,190 --> 01:42:50,550
of nav list item, or nav Li and then my links
themselves could have a class on them of nav
1320
01:42:50,550 --> 01:42:54,910
link or something like that. And I have done
many projects like this, I think it makes
1321
01:42:54,910 --> 01:42:59,580
a lot of sense, it does make your CSS a little
bit more organized, or maybe not more organized,
1322
01:42:59,580 --> 01:43:03,870
but a little bit easier to read. So if you'd
prefer to take that approach, by all means
1323
01:43:03,870 --> 01:43:08,380
go for it. For now, though, I do want to show
that it is not the end of the world use compound
1324
01:43:08,380 --> 01:43:12,929
selectors. And this is a really common time
to use it, where I'll take my nav ul, we're
1325
01:43:12,929 --> 01:43:17,600
gonna have some styles on that, I'm gonna
have my nav Li, I'm gonna have some styles
1326
01:43:17,600 --> 01:43:22,659
on that. I'm gonna have my nav a, and have
some styles on that. And of course, my nav
1327
01:43:22,659 --> 01:43:30,400
a hover and have some stuff on there as well.
Now, what I will not do is have my nav, ul
1328
01:43:30,400 --> 01:43:34,640
Li and you will see tutorials online that
do this. And then here it would be my nav,
1329
01:43:34,640 --> 01:43:40,190
ul Li a. In the old days, it was a performance
issue, the more complicated your selectors,
1330
01:43:40,190 --> 01:43:43,679
the browser would take longer to read that
selector, because it would have to read Oh,
1331
01:43:43,679 --> 01:43:47,110
I got all my links. Oh, but now I have to
find the ones only in list items that are
1332
01:43:47,110 --> 01:43:52,580
only in my unordered lists that are only in
my nav and it would actually slow the rendering
1333
01:43:52,580 --> 01:43:56,360
of your CSS down a little bit. But browsers
have gotten really, really good and really,
1334
01:43:56,360 --> 01:44:01,540
really fast at reading CSS. So it's less of
a performance issue. It does hit on specificity
1335
01:44:01,540 --> 01:44:06,880
a little bit in that this is becoming more
specific for nothing. And it's just makes
1336
01:44:06,880 --> 01:44:10,340
it complicated to read and takes a bit more
of a cognitive load. When you're looking at
1337
01:44:10,340 --> 01:44:14,110
it, you got to think for half a second when
you don't really want to be thinking whereas
1338
01:44:14,110 --> 01:44:17,790
if I just leave it like this, it keeps it
nice and simple. So personally, I like to
1339
01:44:17,790 --> 01:44:22,660
keep it like that. And most people were advocate
if you are going to have compound selectors,
1340
01:44:22,660 --> 01:44:26,020
which are already sort of frowned upon, keep
them really, really simple when you do use
1341
01:44:26,020 --> 01:44:28,969
them. Before I jump in, I'm going to fast
forward I'm actually going to put a border
1342
01:44:28,969 --> 01:44:33,300
on all of these just so we can really easily
visualize what's actually happening. Alright,
1343
01:44:33,300 --> 01:44:36,660
so there we go. We can see all of my elements.
I didn't put one on the hover because I don't
1344
01:44:36,660 --> 01:44:42,620
think we need it. But we can see my ul my
Li and my a so the big pink box is the UL
1345
01:44:42,620 --> 01:44:48,200
the dotted orange box is my Li and then these
green boxes there are the links themselves
1346
01:44:48,200 --> 01:44:52,480
which are the AE and we can see that the UL
and the Li are block level elements because
1347
01:44:52,480 --> 01:44:56,679
even though the text is really short, those
are stretching the full size of what's happening.
1348
01:44:56,679 --> 01:45:01,910
But you will notice that my L eyes are starting
here. There's this big empty space next to
1349
01:45:01,910 --> 01:45:06,410
it, that's because of the way the URL is set
up to give us room for those dots. So the
1350
01:45:06,410 --> 01:45:11,910
first thing I'm going to do is turn off those
dots. And there is a list style that we haven't
1351
01:45:11,910 --> 01:45:15,800
really looked at, I'm just gonna put list
style to none, which will make those dots
1352
01:45:15,800 --> 01:45:20,699
disappear, I just can't forget my semi colon,
there we go. And now my list style of none,
1353
01:45:20,699 --> 01:45:24,380
it turns off the dots, there are other list
styles that you can go through. But for now,
1354
01:45:24,380 --> 01:45:27,740
we're just going to switch them off because
we don't need them. Now, if we think about
1355
01:45:27,740 --> 01:45:32,560
this, I have this ul, which is the big pink
box. And then inside of there, I have these
1356
01:45:32,560 --> 01:45:37,860
three orange dotted boxes. And those are my
allies. These are block level elements, how
1357
01:45:37,860 --> 01:45:41,550
can we make block level elements that are
one on top of each other switch and be one
1358
01:45:41,550 --> 01:45:46,860
next to each other instead, hope you said
display flex. So I can come on this ul and
1359
01:45:46,860 --> 01:45:51,850
I can use the display flex, and all of a sudden,
they shrink down to the content that's inside
1360
01:45:51,850 --> 01:45:55,530
of them. So these dotted orange boxes are
now the same size as my green one, we can
1361
01:45:55,530 --> 01:45:59,080
barely see those orange dots anymore, because
there's a little bit of overlap going on,
1362
01:45:59,080 --> 01:46:03,480
and they've gone next to one another. So that's
fantastic and really good. Now with display
1363
01:46:03,480 --> 01:46:08,660
flex, we've seen that we can do a justify
content and do a space either around or between
1364
01:46:08,660 --> 01:46:12,230
or evenly. So I'm going to do that really
fast. And you can see it space things out.
1365
01:46:12,230 --> 01:46:16,660
But we have this weird empty space left here
on the side, still, all of our paragraphs
1366
01:46:16,660 --> 01:46:21,880
and our headings have a default margin, top
and bottom. Because that we know erage because
1367
01:46:21,880 --> 01:46:25,620
the list normally has bullets or numbers on
the side, they have that default margin, top
1368
01:46:25,620 --> 01:46:30,630
and bottom. But they also have a default padding.
So it's really common to say padding zero,
1369
01:46:30,630 --> 01:46:34,060
that's going to get rid of that extra space
on the left sides, you can control things
1370
01:46:34,060 --> 01:46:38,929
properly. Now the problem with using space
between like this is it spreads things out
1371
01:46:38,929 --> 01:46:43,110
as far as we can get them to go. So depending
on the size of the window, this could actually
1372
01:46:43,110 --> 01:46:49,370
cause some problems. Or you can come in and
give this a width of 350 pixels. And now I'm
1373
01:46:49,370 --> 01:46:53,340
starting to get the spacing that I want. And
it looks nice. But now what happens if I add
1374
01:46:53,340 --> 01:46:58,040
a fourth item or a fifth item, and well, your
page when you first are creating it might
1375
01:46:58,040 --> 01:47:02,989
only have three pages later on, you might
create more whether it's a personal site for
1376
01:47:02,989 --> 01:47:07,570
you or a client site, then this number has
to be changed, or you have to change a media
1377
01:47:07,570 --> 01:47:12,330
query or it's a nightmare. So instead of doing
that, I'm going to remove the width from here,
1378
01:47:12,330 --> 01:47:16,780
and I'm going to remove my justify content.
And what I'm going to do is go into the list
1379
01:47:16,780 --> 01:47:19,980
items themselves. And I'm going to add a little
bit of margin to push them away from each
1380
01:47:19,980 --> 01:47:25,460
other. So in here, I'm going to do a margin
of zero for the top and the bottom. And when
1381
01:47:25,460 --> 01:47:29,820
I'm for the left and the right, the reason
I'm doing left and the right is because eventually
1382
01:47:29,820 --> 01:47:34,030
this will be a centered layout. And I want
the equal space on the left and the right.
1383
01:47:34,030 --> 01:47:37,360
If it was a left aligned or right aligned
text, we'd have to look at it differently.
1384
01:47:37,360 --> 01:47:40,660
And we're going to see that in a little bit.
But for a center to align one, I want that
1385
01:47:40,660 --> 01:47:44,560
margin on the left, and on the right now I
do have the problem that they're not centered.
1386
01:47:44,560 --> 01:47:50,000
And one thing people often will try is to
do a text align center. And it doesn't work.
1387
01:47:50,000 --> 01:47:55,090
The reason this doesn't work is because text
align center will send your text within its
1388
01:47:55,090 --> 01:47:59,890
parent. So if we look at this living social
life that's in my header, so if I come to
1389
01:47:59,890 --> 01:48:06,469
my header, and I do a text align, center,
it's centering Alright, actually, it's inside
1390
01:48:06,469 --> 01:48:11,890
the h1. So it's centering in that h1, which
is full width. And this paragraph, it's this
1391
01:48:11,890 --> 01:48:16,410
text here is centering within that paragraph,
which is full width. The problem here is home
1392
01:48:16,410 --> 01:48:21,360
is centered, but it's centered within its
Li and the lie is super small. So it's it's
1393
01:48:21,360 --> 01:48:27,360
super small because of our display flex here.
So I can't use a text align center on these
1394
01:48:27,360 --> 01:48:30,699
to actually move them to the middle. And I
won't lie I have been holding out on you.
1395
01:48:30,699 --> 01:48:35,260
We can use justify content for this. So the
same way we saw with a line items, we have
1396
01:48:35,260 --> 01:48:40,530
a flex and flex start and the center, we actually
have the same thing here, I can do flex end
1397
01:48:40,530 --> 01:48:45,219
and push things all the way to the end, or
flex start and keep things all the way, this
1398
01:48:45,219 --> 01:48:50,840
is the default. And it keeps things just starting
from the left side. Or I can do a center,
1399
01:48:50,840 --> 01:48:55,410
and it will center it exactly on the page.
So with that done, if I come through, and
1400
01:48:55,410 --> 01:48:58,260
I remove all these annoying borders, because
we don't really need them right now. So I'm
1401
01:48:58,260 --> 01:49:01,910
gonna leave this one here. If you want to
try and put additional styles or finish styling
1402
01:49:01,910 --> 01:49:05,640
it go for that. Or if you just want to play
around with the positioning and play around
1403
01:49:05,640 --> 01:49:09,160
with flex and the different things you can
do with it, by all means jump ahead and have
1404
01:49:09,160 --> 01:49:12,410
some fun with it. And then in the next videos,
after that, we're going to look at how we
1405
01:49:12,410 --> 01:49:19,390
can modify it a little bit and then start
making feet through taking off where we left
1406
01:49:19,390 --> 01:49:23,199
off. And we're gonna make this look a little
bit more like the actual design that we want
1407
01:49:23,199 --> 01:49:26,780
to have. So let's start from the top and sort
of work our way down. So I already have my
1408
01:49:26,780 --> 01:49:30,860
header there, but this doesn't need a background
on it. So let's add the background. And the
1409
01:49:30,860 --> 01:49:36,140
background for that one is the f8 f8 f8, which
is a really light color and you can't really
1410
01:49:36,140 --> 01:49:39,489
see it too well. So I'm going to make it a
bit darker for now. Just make it pink so we
1411
01:49:39,489 --> 01:49:44,940
can see it and we do see we have a bit of
a problem with the it's not touching the sides
1412
01:49:44,940 --> 01:49:49,719
of our page. And while we're here let's just
give this a padding on the top and bottom.
1413
01:49:49,719 --> 01:49:54,530
I'm going to put two m n zero just as a rough
estimate and we can always modify that but
1414
01:49:54,530 --> 01:49:58,370
I think it will work nicely. The reason I'm
doing two M is just through experience. I
1415
01:49:58,370 --> 01:50:03,800
know that 16 one M is 16 bits To me is going
to be 32 pixels. That sounds about right to
1416
01:50:03,800 --> 01:50:07,630
me. It's one of those things that I practice
with, I try and just use round numbers on
1417
01:50:07,630 --> 01:50:12,040
my M's. One thing and one piece of advice
I will give you in giving padding to things
1418
01:50:12,040 --> 01:50:15,690
is try not to go too small, but we're based
on a design and I think two M is going to
1419
01:50:15,690 --> 01:50:19,300
match my design more or less, I'm not aiming
to make it pixel perfect. I'm just making
1420
01:50:19,300 --> 01:50:24,360
me to make it look as close as I can. But
Sorry, I got sidetracked, we have this, this
1421
01:50:24,360 --> 01:50:27,510
problem of the space around. So how can I
fix that I want you to go and do it before
1422
01:50:27,510 --> 01:50:34,380
I do. So hopefully you came up under here
and you did, you're not making your body and
1423
01:50:34,380 --> 01:50:40,150
put in a margin of zero on there. At the same
time while I'm here. If I look at this, and
1424
01:50:40,150 --> 01:50:44,800
I also know the whole design, but I have this
subtitle here. And this is using Ubuntu. and
1425
01:50:44,800 --> 01:50:50,000
only the title is using Laura. So what I'm
actually going to do, and I also I you haven't
1426
01:50:50,000 --> 01:50:53,090
seen it, but I've seen the whole design for
this, I'm also going to take the Ubuntu font
1427
01:50:53,090 --> 01:50:57,450
family and put it on the entire thing. So
I don't have to read Eclair it throughout
1428
01:50:57,450 --> 01:51:00,610
any of these other things, the font size,
I'm going to leave alone the color for now
1429
01:51:00,610 --> 01:51:04,710
I'm going to leave alone as well. But maybe
when we get to the full site and we see the
1430
01:51:04,710 --> 01:51:08,360
whole layout, we can worry about adding a
color on the body for the header itself. I
1431
01:51:08,360 --> 01:51:13,890
think that is good, except we want to switch
this now to our f8 f8 f8 f8. Now we want to
1432
01:51:13,890 --> 01:51:16,960
start doing some type. As I said, I usually
do my type after my body. So I'm going to
1433
01:51:16,960 --> 01:51:21,480
come here, I'm going to make this a pretty
big section. So when I say big section, I
1434
01:51:21,480 --> 01:51:25,330
just put this big thing at the top and I'm
right type type for a word, I say all the
1435
01:51:25,330 --> 01:51:30,170
time, I have a lot of trouble saying it. There
we go, okay biography. And I'm going to come
1436
01:51:30,170 --> 01:51:35,120
down and we can start styling that up. So
I have my h1. And for some reason, everything
1437
01:51:35,120 --> 01:51:43,760
here is indented. So let's fix that. We go,
and it's everything in nothing. So my h1 and
1438
01:51:43,760 --> 01:51:48,090
let's give this the font family of Laura,
actually, we should just copy and paste to
1439
01:51:48,090 --> 01:51:53,260
be a little bit faster. Now, one thing you
might notice, or you might not have noticed,
1440
01:51:53,260 --> 01:51:58,040
but it is it might be showing as bold for
you. It's definitely I see this is bold. And
1441
01:51:58,040 --> 01:52:02,880
the reason it's showing as bold is I installed
Laura on my computer. And as we know, all
1442
01:52:02,880 --> 01:52:08,140
the headings, by default are bold, but I don't
want it to be bold, and I didn't even install
1443
01:52:08,140 --> 01:52:13,950
the bold version, I only have a Laura, I only
took the link to Google fonts for the regular.
1444
01:52:13,950 --> 01:52:18,440
But because I have the bold on my computer,
I see it, but other people visiting this site
1445
01:52:18,440 --> 01:52:22,730
might not. So I am going to explicitly say
I want the font weight to be 400. In this
1446
01:52:22,730 --> 01:52:26,070
case, I did not put that here, but I didn't
list bold, I probably should have written
1447
01:52:26,070 --> 01:52:31,700
lower regular or lower 400. And I didn't so
but I'm gonna change my font weight there.
1448
01:52:31,700 --> 01:52:35,640
And while we're here, we can set the color.
So the color for this one is the dark blue,
1449
01:52:35,640 --> 01:52:44,370
which is 143 774. And of course my font size,
which was which is to ram, I'm going to come
1450
01:52:44,370 --> 01:52:50,900
down now to my subtitle. So my subtitle is
a the font family is already Okay, the font
1451
01:52:50,900 --> 01:52:55,540
weight in this case, if you are bold, because
I said to be bold in my instructions here,
1452
01:52:55,540 --> 01:53:01,190
awesome. It works. If you noticed that in
my link, it was 700 all the better. But either
1453
01:53:01,190 --> 01:53:06,340
one is perfectly fine. I'm going to put 700
because that is what we want to get used to
1454
01:53:06,340 --> 01:53:11,140
writing, designers will often say bold or
black or extra bold because in the design
1455
01:53:11,140 --> 01:53:14,900
software, it doesn't use the numbers it gives
the weight, it just gives like a light or
1456
01:53:14,900 --> 01:53:18,659
a bold or things like that developers who
work a lot with coders might give you the
1457
01:53:18,659 --> 01:53:22,429
number, but there are some that won't. So
just something to keep in mind along the way.
1458
01:53:22,429 --> 01:53:25,429
If you wrote bold here, though, it's going
to give you the exact same result. So don't
1459
01:53:25,429 --> 01:53:32,400
worry too much about it. We'll also do the
color, which is 1792 D two, don't forget the
1460
01:53:32,400 --> 01:53:36,810
hashtag at the beginning or it won't work.
And last but not least my font size because
1461
01:53:36,810 --> 01:53:41,960
it needs to be pretty small, which is point
seven, five. And it's tiny, tiny. Now, the
1462
01:53:41,960 --> 01:53:45,870
one thing I want to do is I want to pull it
up, we have way too much space between these.
1463
01:53:45,870 --> 01:53:51,430
So can you fix that, see if you can fix it
and get rid of the space that's on there.
1464
01:53:51,430 --> 01:53:55,100
So I'm guessing the very first thing you did
was put a margin of zero on here and nothing
1465
01:53:55,100 --> 01:54:00,850
changes. So why did nothing change, I'll give
you a second to think about it. Now maybe
1466
01:54:00,850 --> 01:54:03,821
you already figured it out. And you did it
when I first asked you to. And if you did
1467
01:54:03,821 --> 01:54:08,180
amazing, that's awesome. The reason nothing
changed though is while this had a margin,
1468
01:54:08,180 --> 01:54:11,980
top and bottom that we just took off. This
also has a margin top and bottom, which is
1469
01:54:11,980 --> 01:54:16,890
still there. And this also has a margin top
and bottom on it, which is still there. So
1470
01:54:16,890 --> 01:54:21,640
this big space underneath is coming from my
h1. And this space underneath is coming from
1471
01:54:21,640 --> 01:54:27,949
my ul here. So on my subtitle, my margin zero
is helping but I'm an h1, I'm also going to
1472
01:54:27,949 --> 01:54:32,370
put a margin of zero on that to suck everything
up. It's also going to balance out that top
1473
01:54:32,370 --> 01:54:36,320
part I had a little bit better. Now there
are a couple of things, the text in this one
1474
01:54:36,320 --> 01:54:40,420
is all caps. And it is spread out a little
bit. I'm not going to worry about that quite
1475
01:54:40,420 --> 01:54:44,340
yet. We're going to get into that eventually.
The same with these with their all cap and
1476
01:54:44,340 --> 01:54:47,239
they're spread out I'm not going to stress
about that. I just want to set up the basics
1477
01:54:47,239 --> 01:54:51,409
of this for now we're going to explore typography
a whole lot more in the next module, which
1478
01:54:51,409 --> 01:54:55,620
is stepping up our style. But for now we're
just worried about responsiveness. I don't
1479
01:54:55,620 --> 01:54:59,210
want to overwhelm with too many new properties.
So let's get into this navigation because
1480
01:54:59,210 --> 01:55:03,630
we definitely need that To look a little bit
better, I tend because I need to change the
1481
01:55:03,630 --> 01:55:08,860
color of my nav a, and I need to remove the
text decoration of my nav a, I tend to put
1482
01:55:08,860 --> 01:55:14,030
all of my typography styles for my navigation
in the A here. So let's go and do that. I'm
1483
01:55:14,030 --> 01:55:18,650
going to say that their text decoration, since
we just mentioned that decoration is none,
1484
01:55:18,650 --> 01:55:26,230
we can set the color of it, which is the 70
7070, I can set my font weight to 700. And
1485
01:55:26,230 --> 01:55:30,600
of course, we want our nav a hover here. So
this is going to have a color on it. And I'm
1486
01:55:30,600 --> 01:55:34,770
just gonna use the bright blue. So it's really
obvious when we're on top of something, and
1487
01:55:34,770 --> 01:55:38,810
it really changes but I made a mistake. Oh,
my goodness, what's the mistake that I made,
1488
01:55:38,810 --> 01:55:46,429
I forgot something. Whenever we have a hover,
we should also have a focus state. So I'm
1489
01:55:46,429 --> 01:55:52,980
going to add that on there as well. Now, putting
the focus on here is not 100% necessary, because
1490
01:55:52,980 --> 01:55:59,260
when we focus, we're going to get the browser's
default to having a focus state already. So
1491
01:55:59,260 --> 01:56:03,929
you, I get like this glowing box that shows
up on something as well as my hover color
1492
01:56:03,929 --> 01:56:08,890
right now. But I prefer always making sure
that I have a focus state styled, that adds
1493
01:56:08,890 --> 01:56:14,100
more visual impact than what just the default
is. It's not 100% necessary, but don't turn
1494
01:56:14,100 --> 01:56:17,590
off that glove box, I'm not even going to
tell you how to do it right now. And there's
1495
01:56:17,590 --> 01:56:21,770
one last trick and that last trick is the
underlying that's on here, can you think of
1496
01:56:21,770 --> 01:56:26,120
a way to do it, it does involve adding another
class and everything else i think you know
1497
01:56:26,120 --> 01:56:29,820
how to do. So I'm going to let you see if
you can figure out how to do that. And in
1498
01:56:29,820 --> 01:56:36,900
the next video will give you the solution.
I'm going to come in. So not all websites
1499
01:56:36,900 --> 01:56:40,650
will include something like this. But it is
quite common to have something that shows
1500
01:56:40,650 --> 01:56:44,650
you what page you're actively on, am I on
the homepage, the about page, the Recent Posts
1501
01:56:44,650 --> 01:56:49,330
Page, or something like that. And as I mentioned,
it does involve an extra class. So I'm going
1502
01:56:49,330 --> 01:56:53,730
to come over here into my index. And on my
home, I'm going to come in and I'm gonna add
1503
01:56:53,730 --> 01:57:00,020
a class and we'll call it current page, you
will often see people call this active. So
1504
01:57:00,020 --> 01:57:05,929
this is the active page. The problem I have
with that is the active we have it's on a
1505
01:57:05,929 --> 01:57:09,810
link. And we active is a pseudo class for
our link for when we're clicking on it. So
1506
01:57:09,810 --> 01:57:13,850
people get really mixed up or they think they
can style the active state of a page by using
1507
01:57:13,850 --> 01:57:17,010
that pseudo class. And it's not at all how
it works the active if you remember, it's
1508
01:57:17,010 --> 01:57:22,450
when you're clicking on it. So I like either
using current or current page, I'm gonna use
1509
01:57:22,450 --> 01:57:27,110
current page because I think it's super obvious
what it is. And I'm going to keep that in
1510
01:57:27,110 --> 01:57:30,840
my navigation stuff here. And actually, I
put a big typography comment there. And I
1511
01:57:30,840 --> 01:57:35,699
never kept those going. So while we're here,
let's just really quickly do that. This would
1512
01:57:35,699 --> 01:57:41,080
be layout. And my nav is sort of a sub component
of the layout. So for that, I'm just going
1513
01:57:41,080 --> 01:57:46,780
to do navigation like this, instead of having
it as a big section. So we're gonna have our
1514
01:57:46,780 --> 01:57:51,780
navigation. And inside of my navigation styles,
this is part of it, we have my current page,
1515
01:57:51,780 --> 01:57:55,080
sometimes you'll see the current page is styled
as a different color. So you can literally
1516
01:57:55,080 --> 01:57:59,290
at this point come in and say color, and change
the color of it. And you can see that that
1517
01:57:59,290 --> 01:58:03,429
is now red, but it's going to keep that hover
color, but we have my color. And we can change
1518
01:58:03,429 --> 01:58:07,580
that. In this case, we don't want to change
the color, what I want to do is I want to
1519
01:58:07,580 --> 01:58:11,400
add an underline underneath, there's two different
ways of doing it. One of them is with something
1520
01:58:11,400 --> 01:58:15,290
called a pseudo element. And that just complicates
matters a little bit. And we're going to get
1521
01:58:15,290 --> 01:58:19,040
into them much later on, because they're super
useful for decoration. But we can get away
1522
01:58:19,040 --> 01:58:25,000
with just using a border to border I can say
it's a one pixel solid, and I can set the
1523
01:58:25,000 --> 01:58:29,120
current color that we're using to make it
the same as my text. Whoops, I made a mistake,
1524
01:58:29,120 --> 01:58:32,670
though, it's on all the sides. And we haven't
done a lot with borders. So I'm going to show
1525
01:58:32,670 --> 01:58:37,600
this one to you is because you might have
forgotten that we can just do a border bottom.
1526
01:58:37,600 --> 01:58:41,950
And now it's only going to put that underline
on the bottom. Now if you find it's a little
1527
01:58:41,950 --> 01:58:46,900
bit too close to the text itself, you can
also come through and add a little bit of
1528
01:58:46,900 --> 01:58:51,190
padding, the one thing I wouldn't do is only
add the padding to the current page, I would
1529
01:58:51,190 --> 01:58:55,880
add it to all the pages. And this is in general
a good idea for your navigation anyway. Because
1530
01:58:55,880 --> 01:58:59,420
if somebody is on a mobile version of your
site, they have to click with their fingers.
1531
01:58:59,420 --> 01:59:03,449
padding makes your button a little makes that
nav link a little bit bigger and it makes
1532
01:59:03,449 --> 01:59:08,420
it easier to click on. So if I come on here,
I might do padding, I went to five M and zero
1533
01:59:08,420 --> 01:59:11,740
on the left and the right. You don't have
to do this here on the left and the right.
1534
01:59:11,740 --> 01:59:16,850
The only problem is this border grows to match
that padding on the left and the right side.
1535
01:59:16,850 --> 01:59:21,010
For the mobile reason that I just explained,
it's probably better. But for now, I'm just
1536
01:59:21,010 --> 01:59:25,909
going to leave that as a zero. So the underlying
matches, and it does still give us a little
1537
01:59:25,909 --> 01:59:29,870
bit of extra room for what we can click on.
And the last thing that I'm going to look
1538
01:59:29,870 --> 01:59:33,800
at right now, though, is we want something
like this to show that it's an interactive
1539
01:59:33,800 --> 01:59:38,230
element. This is technically an interactive
element because it's a link to my homepage
1540
01:59:38,230 --> 01:59:42,720
still, but I'm already on this page. So why
would I click on it again. So even though
1541
01:59:42,720 --> 01:59:46,909
it's still gonna stay as a link, I don't really
want it to look like it's a link like I want
1542
01:59:46,909 --> 01:59:55,730
these two to look. So what I can do is actually
say that my current page, hover has a color
1543
01:59:55,730 --> 02:00:00,969
that is back to my default color because I
don't want it to change And if I do that,
1544
02:00:00,969 --> 02:00:04,890
now, when I'm hovering on top, it's not changing.
I know in the scrim of video, you just see
1545
02:00:04,890 --> 02:00:08,700
it as like a blue point your arrow. But if
you're looking at it in your own, it would
1546
02:00:08,700 --> 02:00:13,200
be a hand cursor. So it is people will still
know it's interactive, but it's sort of double
1547
02:00:13,200 --> 02:00:16,640
hinting at them that we probably don't want
to click on that, because we're already there.
1548
02:00:16,640 --> 02:00:20,350
So it's like an extra hint along the way.
Whereas these ones, it's really obvious that
1549
02:00:20,350 --> 02:00:25,000
those are things that we might want to click
on and visit. So with that done, I think it's
1550
02:00:25,000 --> 02:00:29,180
looking pretty good. In the next video, let's
look at how we can actually make this on the
1551
02:00:29,180 --> 02:00:32,930
left side and throw this over onto the right
side. And then after that, we can actually
1552
02:00:32,930 --> 02:00:40,060
make the whole thing off. So let's go into
we want to take this nice navigation we did
1553
02:00:40,060 --> 02:00:42,830
and I think it already looks pretty good.
But we want to up the game of it a little
1554
02:00:42,830 --> 02:00:47,270
bit and make it look like this, which is quite
common on sites that you see these days where
1555
02:00:47,270 --> 02:00:51,220
we have the navigation on the right and probably
a logo or something else on the left side.
1556
02:00:51,220 --> 02:00:56,110
And we can just keep going using what we know
about Flexbox to pull this off. So let's go
1557
02:00:56,110 --> 02:01:00,449
and take a look, what I'm gonna do is it will
be a bit wider. So I'm going to leave this
1558
02:01:00,449 --> 02:01:04,390
at a large size like this just for now. So
it doesn't mean we have to shrink and open
1559
02:01:04,390 --> 02:01:07,430
it. But that's okay. So before we get into
it, what I want to take a look at is how I'm
1560
02:01:07,430 --> 02:01:10,970
going to structure it. So we have already
my header which has that light gray background
1561
02:01:10,970 --> 02:01:16,120
on it and some padding on the top and the
bottom. Then I have already this div for my
1562
02:01:16,120 --> 02:01:21,560
site title. And I have my nav over here that
has my ul in it. But I need something that's
1563
02:01:21,560 --> 02:01:25,280
going to hold all of my content in the middle
of the page just to stop it from stretching
1564
02:01:25,280 --> 02:01:29,740
from one extreme end to the other. So for
that, you can probably guess the name of it
1565
02:01:29,740 --> 02:01:35,450
already. I'm going to call that div class
equals container. And I can come all the way
1566
02:01:35,450 --> 02:01:41,370
after my nav here, and I can close that container.
And I'll put a comment here, close container
1567
02:01:41,370 --> 02:01:45,510
just so I can remember what that is, if ever
I you know, I'm not sure why I have this random
1568
02:01:45,510 --> 02:01:49,780
div floating around. And because all of this
is nested inside of that container, I'm going
1569
02:01:49,780 --> 02:01:54,179
to select it all and push tab on my keyboard,
and it will just push it all over. So I can
1570
02:01:54,179 --> 02:01:59,830
see through the nesting and through my spacing
here that I'm inside of my container. I'll
1571
02:01:59,830 --> 02:02:03,929
jump back over to my style sheet now. And
we can start styling this. So I might say
1572
02:02:03,929 --> 02:02:08,199
biography, I'm going to come here to layout.
And the container is something very generic.
1573
02:02:08,199 --> 02:02:11,980
So here's my header, I'm going to put because
it's more generic, I'm going to do this right
1574
02:02:11,980 --> 02:02:16,810
at the top, I'm going to say container, let's
give it a width of let's say 90%, because
1575
02:02:16,810 --> 02:02:21,890
that's sort of what we've been doing and a
max width. And I'll stick with E, I'm going
1576
02:02:21,890 --> 02:02:26,170
to do 900 pixels. For now, we can always play
with this a little bit later to make it bigger
1577
02:02:26,170 --> 02:02:29,650
if we need to. And just so we can really see
it for now I'm going to give it a border of
1578
02:02:29,650 --> 02:02:34,989
one pixel solid magenta, just like we've been
doing up until now. So there it is, we just
1579
02:02:34,989 --> 02:02:39,659
need it to be centered on the page. Now, because
we can see it is limiting to that max width.
1580
02:02:39,659 --> 02:02:44,340
And it is shrinking when we're going to the
smaller sizes. So I'm going to let you center
1581
02:02:44,340 --> 02:02:50,130
it on the screen before I go ahead and do
it. I know I've had you do this one a lot.
1582
02:02:50,130 --> 02:02:53,800
But it is one of those things that people
forget with the margin auto on the left and
1583
02:02:53,800 --> 02:02:57,719
the right, especially early on when they're
writing a lot of CSS, they use a text align
1584
02:02:57,719 --> 02:03:01,990
and it doesn't work. And eventually they remember
and it sort of segments in so I'm trying to
1585
02:03:01,990 --> 02:03:06,640
submit it in as fast as I can by getting you
to do it as often as possible. So you can
1586
02:03:06,640 --> 02:03:09,620
see here now that it is working, and it's
centering on the screen, and because of my
1587
02:03:09,620 --> 02:03:14,450
max width, it does limit it to the total size
there. But now we want to take this and put
1588
02:03:14,450 --> 02:03:19,120
it on that side and take this and put it on
this side, we don't have the rest of our content.
1589
02:03:19,120 --> 02:03:23,070
And normally I would write all of my HTML
first. And then I would come through and write
1590
02:03:23,070 --> 02:03:26,650
my CSS. But we're not doing it this time,
just because we're focusing on just the navigation
1591
02:03:26,650 --> 02:03:31,469
here. So I wouldn't want to put a display
flex on a container if that container is going
1592
02:03:31,469 --> 02:03:37,550
to be reused in many places. So like I've
been talking about before, I like having modifier
1593
02:03:37,550 --> 02:03:43,580
classes, I'm going to call it container nav.
And we can come back in. And now I can edit
1594
02:03:43,580 --> 02:03:49,370
that. So I'm container, I would come down
right below that and add a container nav and
1595
02:03:49,370 --> 02:03:54,300
give this a display of flex. If you did this
ahead of time, and you were just sort of jumping
1596
02:03:54,300 --> 02:03:58,270
ahead because you wanted to practice and you
thought you know, and you give it a different
1597
02:03:58,270 --> 02:04:02,300
name, or you put it directly on the container,
whatever that div that you gave in, that's
1598
02:04:02,300 --> 02:04:07,000
completely fine. Or if you just had some sort
of like nav box and you put all of these styles
1599
02:04:07,000 --> 02:04:11,940
on it, it's okay, I just know I'm going to
be reusing the width, the max width and my
1600
02:04:11,940 --> 02:04:17,739
margin zero auto a few times on this site.
So I figure having a default container that
1601
02:04:17,739 --> 02:04:21,770
I can reuse multiple times makes a lot of
sense. And then if I need to change it, I
1602
02:04:21,770 --> 02:04:27,440
can so display a flex it makes our columns
we come and take a look. There we go. We have
1603
02:04:27,440 --> 02:04:31,159
two columns. Now. Now there are a few things
that we want to change. The easy way to fix
1604
02:04:31,159 --> 02:04:35,490
is this is getting centered in here. And we
don't want anything to be centered. That was
1605
02:04:35,490 --> 02:04:41,130
in my heading header header textilene Center,
which we don't need to have anymore, so we
1606
02:04:41,130 --> 02:04:46,780
can remove that and at least it will fix that
problem. And this part is perfectly fine.
1607
02:04:46,780 --> 02:04:50,830
But I want to move these all the way over
to the right side. Can you think of a way
1608
02:04:50,830 --> 02:04:58,500
we can do that that we've already looked at.
So if you remember this pink box here is my
1609
02:04:58,500 --> 02:05:01,920
container and it's also my container. Our
nav and on the container nav, I did display
1610
02:05:01,920 --> 02:05:07,330
flex, and have all this empty space left over
on this side. And how can redistribute empty
1611
02:05:07,330 --> 02:05:12,940
space to put it in between things we can use
justify content space between, so justify
1612
02:05:12,940 --> 02:05:18,929
content, space between. And there's only two
items in this case. So it just means all that
1613
02:05:18,929 --> 02:05:23,190
empty space gets put here in the middle. And
one last thing, as you can see, there is a
1614
02:05:23,190 --> 02:05:26,530
bit of a gap here. And you might be thinking
that's not a big deal, and probably isn't
1615
02:05:26,530 --> 02:05:30,400
the end of the world. But because I know I'm
going to be using a container and other content
1616
02:05:30,400 --> 02:05:34,590
here. And I want things to line up really
nicely. little differences like this make
1617
02:05:34,590 --> 02:05:38,210
the difference between someone who's a good
coder or a good designer, and someone who's
1618
02:05:38,210 --> 02:05:42,550
a little bit sloppy, and people who are hiring
are paying attention to details. So you do
1619
02:05:42,550 --> 02:05:45,990
need to learn how to be detail oriented and
look for these little things where things
1620
02:05:45,990 --> 02:05:50,639
aren't lining up. It's not as obvious when
you don't have a border on something. But
1621
02:05:50,639 --> 02:05:55,390
you'd still notice that it's not perfectly
lined up. So if you remember what I did, when
1622
02:05:55,390 --> 02:05:59,800
I created this, because it was center aligned,
I said, we can do a margin on the left and
1623
02:05:59,800 --> 02:06:03,140
the right side and everything would be fine,
because it's centered. And that means it's
1624
02:06:03,140 --> 02:06:07,239
Eve, there'll be equal margins on the left
and the right, which will keep it centered.
1625
02:06:07,239 --> 02:06:11,510
Now we have it on the right side. So that
means I only want my margins on the left.
1626
02:06:11,510 --> 02:06:15,190
This is one of the few times when I won't
use the shorthand. And I'll just say margin
1627
02:06:15,190 --> 02:06:20,590
left. In this case, I'll do two n. And we
can take a look. And now we've gotten rid
1628
02:06:20,590 --> 02:06:25,670
of that space. But I've kept everything here,
I did two M instead of one because before
1629
02:06:25,670 --> 02:06:31,219
I had one m on home and one m on about me
here. So one plus one, I was getting two on
1630
02:06:31,219 --> 02:06:35,929
the side. And I was getting two on this side
here as well. Whereas now, I'm only putting
1631
02:06:35,929 --> 02:06:40,010
march on the left, so I'm putting it as to
M that does mean there's a two M margin on
1632
02:06:40,010 --> 02:06:42,920
this side here. But that's fine. That's not
getting in the way of anything, it's just
1633
02:06:42,920 --> 02:06:46,510
giving us a little bit of breathing room.
And if anything, it's going to stop us when
1634
02:06:46,510 --> 02:06:51,070
we're shrinking from hitting that the the
social life tech sits right there. So it's
1635
02:06:51,070 --> 02:06:55,800
going to prevent us from smacking into that.
And that gives us the room that we need. Now
1636
02:06:55,800 --> 02:06:58,992
it's starting to look pretty ugly when I do
this, though. So the first thing I'm going
1637
02:06:58,992 --> 02:07:04,130
to do right now is I'm going to turn off this
border of magenta, because we don't want that
1638
02:07:04,130 --> 02:07:08,800
on there anymore, which makes it look a little
bit better. And in the next video, we're going
1639
02:07:08,800 --> 02:07:13,280
to add in a media query to prevent this weirdness
from happening. And we're going to add it.
1640
02:07:13,280 --> 02:07:17,040
So this actually falls underneath. And we
have a few different changes going on, we'll
1641
02:07:17,040 --> 02:07:23,590
get some practice with media queries. We want
to make our navigation responsive. And we
1642
02:07:23,590 --> 02:07:28,560
have to do that using a media query. So this
is what we currently have. And we want to
1643
02:07:28,560 --> 02:07:32,200
make it look like this when it reaches small
screen sizes, I'm gonna give you a little
1644
02:07:32,200 --> 02:07:38,800
bit of a hint right now I'm going to use the
breakpoint of 675 pixels when I do it. And
1645
02:07:38,800 --> 02:07:42,370
everything we need to be able to do this we
have learned now media queries we haven't
1646
02:07:42,370 --> 02:07:46,040
done a lot with. So if you're not super comfortable
with them, that's cool. Watch me and see how
1647
02:07:46,040 --> 02:07:50,090
I do it. But I'm going to encourage you to
see if you can figure it out. If you make
1648
02:07:50,090 --> 02:07:54,260
a mistake, that's fine, I'd even say go and
watch the video on media queries, and then
1649
02:07:54,260 --> 02:07:58,110
come back and do this because I want you to
make mistakes, because making mistakes is
1650
02:07:58,110 --> 02:08:00,770
how you're going to learn cuz you're gonna
get stuck on something and you're gonna watch
1651
02:08:00,770 --> 02:08:04,389
me do it. And then it's going to be like,
Oh, that's the stupid thing I was missing.
1652
02:08:04,389 --> 02:08:07,540
And then you're going to be able to do it,
you're going to do it, and it's going to reinforce
1653
02:08:07,540 --> 02:08:11,640
it. So try if you get stuck, go and watch
the media query video, if you still can't
1654
02:08:11,640 --> 02:08:15,280
do it, then you can watch me do it. Or once
you've got it, you can see how I do it, just
1655
02:08:15,280 --> 02:08:19,429
to see if we're on the same page or not. And,
of course, I will try and explain things in
1656
02:08:19,429 --> 02:08:23,400
as much detail as possible on how I'm doing
things. And again, the breakpoint I'm going
1657
02:08:23,400 --> 02:08:32,429
to be using is a max width of 675 pixels.
Alright, so the very first thing I'm going
1658
02:08:32,429 --> 02:08:35,630
to do is I'm going to come to my container
nav here, because this is where we have my
1659
02:08:35,630 --> 02:08:43,680
display of flex. And we know that if I do
a flex direction of column, it's going to
1660
02:08:43,680 --> 02:08:47,159
switch things. So now these are stacking one
on top of each other. Whereas before, when
1661
02:08:47,159 --> 02:08:52,150
we turn that off, they're going one next to
each other like that. So this is what I want
1662
02:08:52,150 --> 02:08:56,030
to be able to toggle on and off. So I mentioned
to max width, we're gonna stick with that
1663
02:08:56,030 --> 02:09:01,050
for now. And I'm going to create my media
query. So add media, I'm gonna put a space,
1664
02:09:01,050 --> 02:09:07,139
put my parentheses, put my my curly braces
and put a empty space. And I can come in and
1665
02:09:07,139 --> 02:09:13,600
put in my max width of 675 pixels. Now I got
that number it was through a little bit of
1666
02:09:13,600 --> 02:09:17,580
experimentation, and be talking about how
you can figure out what numbers you want here.
1667
02:09:17,580 --> 02:09:21,390
Not in this video, though. But when we start
working on the bigger layout. So in here,
1668
02:09:21,390 --> 02:09:26,429
I want to select once again, my container
now. And this is one of the mistakes I still
1669
02:09:26,429 --> 02:09:30,030
make, as I mentioned before, where I forget
that I have to redo my selector because I'm
1670
02:09:30,030 --> 02:09:33,739
looking here. So if that was the mistake you
made, just always remember when your intermediate
1671
02:09:33,739 --> 02:09:37,570
query, you still need your selectors, just
like as if you were outside of it. The other
1672
02:09:37,570 --> 02:09:41,410
thing is always the media query after your
selector and not before it or it will not
1673
02:09:41,410 --> 02:09:44,550
work. In this case, it might because we're
not overriding something, but still always
1674
02:09:44,550 --> 02:09:51,620
try and keep your media queries after your
selector. So we can in here do our flex direction
1675
02:09:51,620 --> 02:09:57,760
of column. And so now if we come back and
take a look at it, at large screens, it's
1676
02:09:57,760 --> 02:10:02,170
looking normal but when I hit that 675 Which
is really close to when the text there, you
1677
02:10:02,170 --> 02:10:06,070
can see it, the whole thing hops down. So
this is a good start. But now I also want
1678
02:10:06,070 --> 02:10:09,630
to change the direction, I want to bring these
to be stacking on one on top of each other.
1679
02:10:09,630 --> 02:10:14,210
And I want everything to be centered. So let's
see if we can do that. So here is where I
1680
02:10:14,210 --> 02:10:18,170
have my header. So we need another media query
for it. If you're going well, I just made
1681
02:10:18,170 --> 02:10:21,179
a media query, I didn't want to write the
whole thing out. And I did say before, you
1682
02:10:21,179 --> 02:10:24,679
can always keep them grouped together to make
it a little bit easier. You could also say
1683
02:10:24,679 --> 02:10:29,530
I'm in my layout, I'm going to put all my
layout ones together at the bottom. If you
1684
02:10:29,530 --> 02:10:33,810
didn't separate media query, that's completely
fine. You're not bloating, your CSS file too
1685
02:10:33,810 --> 02:10:38,409
much. Maybe it is, we talked about dry, and
it's not super dry, always writing them over.
1686
02:10:38,409 --> 02:10:43,020
And they are kind of long to write. So there's
nothing wrong with say grouping all my layout
1687
02:10:43,020 --> 02:10:47,870
ones together here. So still inside the media
query, and I'm paying attention like this
1688
02:10:47,870 --> 02:10:52,790
is the end of my media query. So I'm coming
inside my media query, and I'll select my
1689
02:10:52,790 --> 02:10:58,949
header. And on here, I'm going to do my text
align center. So that takes care of this.
1690
02:10:58,949 --> 02:11:03,000
And it centers it because if you remember
before, we've switched that we originally
1691
02:11:03,000 --> 02:11:06,489
had it on there, and we turned it off. So
now I'm adding that text align center back
1692
02:11:06,489 --> 02:11:10,420
in to center this and it goes back to almost
that original layout that we had the first
1693
02:11:10,420 --> 02:11:15,870
time now. But the cool thing is here, it's
like that. And then as we shrink down, we
1694
02:11:15,870 --> 02:11:20,520
switch from left align to center, and they
pop one on top of each other. So it's a really
1695
02:11:20,520 --> 02:11:24,699
good start. The next thing that I want to
do though, is I do want these to stack one
1696
02:11:24,699 --> 02:11:28,360
on top of each other as well, because we want
it to work at really small screens, and we
1697
02:11:28,360 --> 02:11:33,560
get to this tiny screen size, this looks pretty
terrible. So for that I have all my navigation
1698
02:11:33,560 --> 02:11:37,659
stuff, let's come all the way to the bottom
of all of that, I can put my media query,
1699
02:11:37,659 --> 02:11:42,810
I'm just pasting it because I already had
it copied. And I want to keep the same breakpoint,
1700
02:11:42,810 --> 02:11:46,320
you will have set you will have times we have
multiple breakpoints, but try not to have
1701
02:11:46,320 --> 02:11:51,390
them like 676. And then this other one 679.
If you have something at 675, just keep them
1702
02:11:51,390 --> 02:11:56,560
all at 675. And just so you don't get a whole
bunch of weird jumps going on, it makes your
1703
02:11:56,560 --> 02:12:01,949
life a lot easier as well to know when things
will be changing. We already have a display
1704
02:12:01,949 --> 02:12:08,280
flex on my nav ul. So I see my nav ul display
flex is making them go next to each other.
1705
02:12:08,280 --> 02:12:13,909
So that means the same way we did before I
can select that nav ul. And I can put a flex
1706
02:12:13,909 --> 02:12:20,080
direction on there, of column. And now we
can see that they're stacking one on top of
1707
02:12:20,080 --> 02:12:25,520
each other, but they're not centered. That's
weird. Why aren't they centered. That's because
1708
02:12:25,520 --> 02:12:30,580
of this margin left that I put on my nav Li.
So that means I have to come through, I have
1709
02:12:30,580 --> 02:12:37,179
to come down here and go to my nav, Li and
I want to redefine my margin. Now in this
1710
02:12:37,179 --> 02:12:41,710
case, they're really stuck close to each other
up and down. But the margin is breaking in
1711
02:12:41,710 --> 02:12:45,719
the left and right. So on my margin shorthand
here, I'm going to give it like a point 5am
1712
02:12:45,719 --> 02:12:50,270
on the top and the bottom, and on the left
in the right, I'm going to set it to zero.
1713
02:12:50,270 --> 02:12:54,840
But if we just did a point five on all sides,
it would probably be fine. And we can come
1714
02:12:54,840 --> 02:12:59,540
take a look. And look at that it is looking
awesome. And it's working at small screen
1715
02:12:59,540 --> 02:13:05,860
sizes, and it's working at big screen sizes,
and everything is great. And somewhere along
1716
02:13:05,860 --> 02:13:09,860
the way, I did lose my underlines if you want
a bit of practice, you could go and add that
1717
02:13:09,860 --> 02:13:13,510
back in yourself if you feel like it. But
right now I'm super happy with that you've
1718
02:13:13,510 --> 02:13:18,270
made a ton of progress navigations for one
of the simpler and smaller elements on a page,
1719
02:13:18,270 --> 02:13:22,010
they're super complicated, there's so many
different pieces to them through the header.
1720
02:13:22,010 --> 02:13:24,820
So we always have our header, we have something
on the left, we have something on the right,
1721
02:13:24,820 --> 02:13:28,400
then we have to get our navigational pieces
to go on the left and the right of each other.
1722
02:13:28,400 --> 02:13:34,940
And oh, for something that's really small,
and they they do take a lot of styling, though
1723
02:13:34,940 --> 02:13:38,670
you just did this, you just did one of the
more complicated parts of most websites. So
1724
02:13:38,670 --> 02:13:44,260
a bit of a pat on the back, probably a nice
time to take a little bit of a break. If you
1725
02:13:44,260 --> 02:13:47,510
feel like you want to revisit media queries
a little bit and go back through them do that
1726
02:13:47,510 --> 02:13:52,260
now before we move on, because we will be
using them a lot that we're going to start
1727
02:13:52,260 --> 02:13:55,780
building a whole layout. And I think it'd
be a good time to take a break now just to
1728
02:13:55,780 --> 02:14:00,280
help let everything absorb and sort of sink
in a little bit, before we go into the full
1729
02:14:00,280 --> 02:14:03,280
big layout that we're going to be building,
which is just going to be taking everything
1730
02:14:03,280 --> 02:14:06,850
we've learned so far and giving us a lot of
practice on all of that to help reinforce
1731
02:14:06,850 --> 02:14:10,800
things even more. But it will take us a while
to get through that layout, because it is
1732
02:14:10,800 --> 02:14:17,730
a pretty big thing that we will be building
out with lots of different pieces. We're doing
1733
02:14:17,730 --> 02:14:20,080
the whole thing, we're doing some to build
out the rest of the site. And we're doing
1734
02:14:20,080 --> 02:14:23,980
the whole thing, we're doing three whole pages
for this, it's really going to help reinforce
1735
02:14:23,980 --> 02:14:27,889
everything. And it's gonna also give you a
bit of an idea of how it works when you're
1736
02:14:27,889 --> 02:14:31,080
doing a whole site. I'm going to try and go
through naming conventions a little bit, as
1737
02:14:31,080 --> 02:14:35,530
well as just seeing how there's a lot of similarity
between the different pages. So once you've
1738
02:14:35,530 --> 02:14:39,469
done the homepage, you're actually really
close to being done, which is always really
1739
02:14:39,469 --> 02:14:42,660
nice. And we're also gonna be seeing how we
can make it responsive. So we're going to
1740
02:14:42,660 --> 02:14:46,830
be doing the small screens and the big screens,
I have all three of them done for the big
1741
02:14:46,830 --> 02:14:50,700
screens only two of them for the small screens
just because they're really similar to one
1742
02:14:50,700 --> 02:14:55,310
another the homepage and this Recent Posts
Page are almost identical so I didn't bother
1743
02:14:55,310 --> 02:14:59,969
doing a design for it. On the small screens
for there. We are actually going to be building
1744
02:14:59,969 --> 02:15:03,680
You know, from the small screens to the big
screens, which is the opposite of what we've
1745
02:15:03,680 --> 02:15:08,260
done so far, but it is the more common way
to work. It's called mobile first. And it's
1746
02:15:08,260 --> 02:15:11,949
much more common to work that way, it's a
little bit harder to share these in depth
1747
02:15:11,949 --> 02:15:15,620
designs through screen, but I'm gonna have
screenshots of them, I'm gonna be highlighting
1748
02:15:15,620 --> 02:15:18,870
the different things that I'm working on to
try and explain things as clearly as possible.
1749
02:15:18,870 --> 02:15:23,010
So we have a visual to go along with what
we're working on. But you can also come to
1750
02:15:23,010 --> 02:15:28,159
this link. This is I designed all of this
using Adobe XD, and this link will give you
1751
02:15:28,159 --> 02:15:32,560
all the design specs, and it's going to make
it really easy for you to get the text and
1752
02:15:32,560 --> 02:15:36,610
any information you need. So when you first
click on that link, it will bring you to a
1753
02:15:36,610 --> 02:15:39,640
page that looks a little bit like this, it's
a little bit bigger, and you can choose which
1754
02:15:39,640 --> 02:15:43,199
one of the designs you want to start looking
at. And you can click on it, and it will bring
1755
02:15:43,199 --> 02:15:49,260
you into that design. Once you're in the design,
it will probably be on the comment section.
1756
02:15:49,260 --> 02:15:52,889
And what we want to do is we want to click
where that big arrow is, which is to get into
1757
02:15:52,889 --> 02:15:57,130
the assets and to start seeing all the different
pieces that are in there. So once you're in,
1758
02:15:57,130 --> 02:16:00,429
you can get all the different colors I've
used. So I am going to list out the colors,
1759
02:16:00,429 --> 02:16:04,800
I'm gonna, I'm gonna have this as an available
slide, but with the actual hex codes written
1760
02:16:04,800 --> 02:16:07,781
out. But if you're in here and you click on
a color, it's automatically going to copy
1761
02:16:07,781 --> 02:16:12,850
it into your clipboard. So you can just paste
it right into the editor afterwards. And there
1762
02:16:12,850 --> 02:16:15,960
is all the font sizes and everything that
I've used here and all the different fonts
1763
02:16:15,960 --> 02:16:18,960
that I've used. So you can get all the different
character styles, it gives you the font weight,
1764
02:16:18,960 --> 02:16:23,410
the font color, the font size, all of that
stuff. The only problem is it also gives it
1765
02:16:23,410 --> 02:16:27,060
all in pixels. If you want to work in pixels,
because it's going to be easier, by all means
1766
02:16:27,060 --> 02:16:30,060
I'm going to do it with REM. But if you want
to do it in pixels, there's nothing wrong
1767
02:16:30,060 --> 02:16:34,869
with using pixels, like there used to be with
font sizes. So if you want to go that route,
1768
02:16:34,869 --> 02:16:38,119
there's no issue with it, when you want to
get the text, what you want to do is actually
1769
02:16:38,119 --> 02:16:41,568
click on one of those boxes. So if I click
on this, it's going to show me the size, don't
1770
02:16:41,568 --> 02:16:45,688
worry too much about the exact sizes of things,
it's going to give you spacing, again, I didn't
1771
02:16:45,689 --> 02:16:49,909
make this a pixel perfect design. So if the
spacing in your final one isn't exactly the
1772
02:16:49,909 --> 02:16:53,659
same, that is completely fine. But when you
click on a box, it's actually going to give
1773
02:16:53,659 --> 02:16:58,029
you all the text that's in there. Now the
only problem is it does not include line breaks.
1774
02:16:58,029 --> 02:17:02,949
So the continue reading and the title of it
will sort of be all jammed up in one big paragraph.
1775
02:17:02,949 --> 02:17:05,549
But it makes it a lot easier that you can
sort of click through and get the different
1776
02:17:05,549 --> 02:17:10,658
pieces of text. That way, I'm also going to
have a file in a scramble in the next video
1777
02:17:10,659 --> 02:17:15,409
where you can get the text from if you don't
want to be using the Adobe XD thing here.
1778
02:17:15,409 --> 02:17:19,010
If you're on a page and you want to get back
out of there, you want to go see one of the
1779
02:17:19,010 --> 02:17:22,439
other pages, you can navigate through them,
you can't see it at the bottom of the page,
1780
02:17:22,439 --> 02:17:25,308
you can there's a little navigation to go
through the different pages at the bottom.
1781
02:17:25,308 --> 02:17:29,158
Or you can just click up here where it says
the living living the simple life and it'll
1782
02:17:29,159 --> 02:17:32,898
bring you back to that grid that you started
on. So then you can choose which other page
1783
02:17:32,898 --> 02:17:39,749
you want to go and visit. So in a little more
detail, here are the three pages. For desktops.
1784
02:17:39,750 --> 02:17:43,669
When I'm writing my markup, I'm always focused
on looking at the most complicated part of
1785
02:17:43,669 --> 02:17:48,260
the design when I do my CSS, um, as I mentioned,
we're going to start mobile first. But when
1786
02:17:48,260 --> 02:17:51,629
it comes to the markup, we need to really
see the structure of the website when all
1787
02:17:51,629 --> 02:17:54,849
the different pieces are in the places that
they're going to end up at. And it's always
1788
02:17:54,849 --> 02:17:59,689
a more complicated layout when we're on a
desktop screen. So when I start writing HTML,
1789
02:17:59,689 --> 02:18:03,808
I'm going to be looking at these designs.
And then when I start my CSS, I might actually
1790
02:18:03,808 --> 02:18:07,518
be looking at the small screens, and then
we're gonna move on up to these bigger screens.
1791
02:18:07,519 --> 02:18:10,388
So in the next video, what I'm going to do
is I'm gonna break down how I analyze the
1792
02:18:10,388 --> 02:18:13,188
homepage, and I'm gonna start reading the
markup for that, and we're gonna make our
1793
02:18:13,189 --> 02:18:16,109
way and write the markup for that, we're gonna
get the whole thing down, we're gonna make
1794
02:18:16,109 --> 02:18:18,829
it responsive, it's gonna look great. And
then we're gonna move on to those other two
1795
02:18:18,829 --> 02:18:21,999
pages, because as I mentioned, they're going
to go pretty quickly, once we've finished
1796
02:18:21,999 --> 02:18:25,799
everything else here, I'm really looking forward
to this, I think it's gonna be so much fun.
1797
02:18:25,799 --> 02:18:31,638
So looking forward to seeing in the next video
where we can start calling. Guess on certain
1798
02:18:31,638 --> 02:18:36,388
things. Okay, so we're going to be focusing
on starting the basic structure. For our homepage,
1799
02:18:36,388 --> 02:18:40,558
I'm going to be doing the homepage, just the
markup over a few videos just to break it
1800
02:18:40,558 --> 02:18:43,198
up a little bit, because it's going to make
it a bit easier for you to find the parts
1801
02:18:43,199 --> 02:18:47,179
that you want or to focus on certain things.
So what I'm going to be doing in this one
1802
02:18:47,179 --> 02:18:50,989
is we're just doing the homepage, and I'm
looking at the basic overall structure of
1803
02:18:50,989 --> 02:18:53,808
my page. So we already have the navigation,
I'm going to be nice to you, we're not going
1804
02:18:53,808 --> 02:18:57,198
to redo the whole thing, we're going to be
continuing from where we left off with that
1805
02:18:57,199 --> 02:19:00,909
navigation, we're going to be adding this
whole section here as well as our footer down
1806
02:19:00,909 --> 02:19:05,619
at the bottom. And I can see that everything
here is being held in place by something,
1807
02:19:05,619 --> 02:19:09,669
it's not stretching out. So just like we used
on our navigation, we're going to use the
1808
02:19:09,669 --> 02:19:14,919
container to hold everything in place there.
Then, when I look at that, I see this is my
1809
02:19:14,919 --> 02:19:19,120
big piece that's holding everything. Okay,
what's the next step? That's the big picture.
1810
02:19:19,120 --> 02:19:22,478
But do I have something smaller than that?
So yes, when I look inside of there, I see
1811
02:19:22,478 --> 02:19:26,328
that there's two columns of content, I see
there's this main big column on this side.
1812
02:19:26,329 --> 02:19:29,978
And then this column on the other side, there's
no weird pieces sticking out, everything is
1813
02:19:29,978 --> 02:19:35,348
living inside of it very distinct column.
So I know I need to set up sort of a main
1814
02:19:35,349 --> 02:19:40,689
structure area and a sidebar on the side.
Then inside of those areas, I have these different
1815
02:19:40,689 --> 02:19:45,049
pieces. So to explain this color coding that
I've done a little bit, if we look here, this
1816
02:19:45,049 --> 02:19:48,568
is sort of this unique part of the website.
This is the featured post, it's the one that
1817
02:19:48,568 --> 02:19:52,539
stands out the most The layout is unique.
So that is its own component. It's going to
1818
02:19:52,539 --> 02:19:57,470
have its own sort of markup the way the code
or the HTML is written for that is going to
1819
02:19:57,470 --> 02:20:01,539
be a little bit unique. It's gonna have its
own class name. Then I have these three that
1820
02:20:01,539 --> 02:20:06,010
repeat themselves, they're all exactly the
same thing, just the content in them is changing,
1821
02:20:06,010 --> 02:20:09,829
the layout is the same, the colors are the
same, everything is identical, I just have
1822
02:20:09,829 --> 02:20:13,840
to change the text and the image for each
one. So each one of those will be exactly
1823
02:20:13,840 --> 02:20:18,090
the same structure, just with different texts
going in. So they can all have the same classes
1824
02:20:18,090 --> 02:20:22,430
on there, and they're going to work fine.
And then over on this side, same thing, I
1825
02:20:22,430 --> 02:20:27,140
have these two components, these two little
sidebar widget type things, they're looking
1826
02:20:27,140 --> 02:20:32,199
exactly the same from one another, the content
in them is different. But this mean styling,
1827
02:20:32,199 --> 02:20:36,409
the heading on them is identical. The big
parts, the important parts of them are the
1828
02:20:36,409 --> 02:20:41,359
same. So I'm going to give those the same
class as well. In this video, I'm just focusing
1829
02:20:41,359 --> 02:20:46,109
on that I'm going to do the big picture, I'm
going to set everything up. Then in the next
1830
02:20:46,109 --> 02:20:49,249
one, I'm going to break each one of these
up into its own video where we're going to
1831
02:20:49,249 --> 02:20:53,600
look at how to do the HTML just for this one,
just for this one, and then a third video
1832
02:20:53,600 --> 02:20:58,029
on the HTML for this one. And then we'll start
going into the CSS and we'll go back through
1833
02:20:58,029 --> 02:21:02,300
and do the CSS for each one of those as well
starting mobile first, and then graduating
1834
02:21:02,300 --> 02:21:06,669
up to big screens. So if you'd like and you
want to use that Adobe XD link, and you didn't
1835
02:21:06,669 --> 02:21:12,039
open it before, you can click here and open
it up. Or if you prefer, I have put text files
1836
02:21:12,039 --> 02:21:16,029
for everything, including all the pages. So
if you're being very ambitious, all the text
1837
02:21:16,029 --> 02:21:20,789
is currently there. The one that isn't there
is the recent posts, because the text is exactly
1838
02:21:20,789 --> 02:21:24,709
the same as the homepage, the layout will
change a little bit. But all the text is the
1839
02:21:24,709 --> 02:21:30,529
same. I didn't I put the sidebar and the footer
is separate text files. So on the homepage,
1840
02:21:30,529 --> 02:21:34,529
it's just those articles. And for the sidebar,
you can grab that from this file here, I have
1841
02:21:34,529 --> 02:21:37,699
already included all the images, but you're
gonna notice they're not the right size. And
1842
02:21:37,699 --> 02:21:41,489
I only have one version of all the images
even though the images are changing throughout
1843
02:21:41,489 --> 02:21:46,550
this. Now, you could have two different versions,
you can have the thumbnail version and a big
1844
02:21:46,550 --> 02:21:49,529
version, you'll notice even the cropping is
different than them, I'm going to show you
1845
02:21:49,529 --> 02:21:52,619
a trick where you can use one image. So it
just lessens the load a little bit, we don't
1846
02:21:52,619 --> 02:21:56,560
have to do two downloads, because we have
the same image here. And here. For example,
1847
02:21:56,560 --> 02:22:00,659
we can do all that with one image. Even though
the cropping is different, it might not be
1848
02:22:00,659 --> 02:22:03,789
the most common practice to do it this way.
But I want to show you a really neat trick
1849
02:22:03,789 --> 02:22:08,640
on how we can re crop images in a way that
is sort of new to CSS actually. And it's pretty
1850
02:22:08,640 --> 02:22:14,489
easy to do. So all the images are there, everything
is ready for you to get started. And we just
1851
02:22:14,489 --> 02:22:18,989
have to come right here after our header and
get to work. So I want you to do as much of
1852
02:22:18,989 --> 02:22:23,279
this as possible on your own. And of course,
then I'm going to go through and explain as
1853
02:22:23,279 --> 02:22:26,619
much as I can, as I'm going through it. And
again, I'm really going to be breaking up
1854
02:22:26,619 --> 02:22:30,771
my HTML a lot over different videos just to
keep the video lens down. Because I don't
1855
02:22:30,771 --> 02:22:34,220
want to give you one really long video where
you get if you have to come back to it later
1856
02:22:34,220 --> 02:22:37,079
and you have trouble finding the spot you're
looking for, I think it'd be a little bit
1857
02:22:37,079 --> 02:22:42,579
easier this way. So let's jump into it and
start with this main structure here where
1858
02:22:42,579 --> 02:22:47,760
I just have this big main area. And then I
have this footer down at the bottom. So what
1859
02:22:47,760 --> 02:22:51,300
I'm going to do, and I'm going to introduce
a few new elements here. And if you did this
1860
02:22:51,300 --> 02:22:55,390
on your own, I wouldn't have expected you
to have these, we have our header at the top,
1861
02:22:55,390 --> 02:22:58,511
which often includes things like the logo
and the navigation, that sort of what you
1862
02:22:58,511 --> 02:23:02,300
usually find up in your header. And next up,
if we go and look at our design, again, we
1863
02:23:02,300 --> 02:23:07,890
have this yellow box, right. But this yellow
box is pretty much holding in the position
1864
02:23:07,890 --> 02:23:11,789
of what we have up here where we have our
navigation and we use a container for that.
1865
02:23:11,789 --> 02:23:16,749
So we might as well start with a container.
So we can do our div class container, because
1866
02:23:16,749 --> 02:23:21,800
all of that does have to be held in the middle
of our page. And below all the way to the
1867
02:23:21,800 --> 02:23:27,460
bottom, we can have a footer and close our
footer, the footer, super simple. So we can
1868
02:23:27,460 --> 02:23:31,550
just throw in a couple of paragraphs right
now, when we do the footer, I might come back
1869
02:23:31,550 --> 02:23:35,859
and give these classes. But for the moment,
I really want to focus on the structure of
1870
02:23:35,859 --> 02:23:40,260
what's inside my container. Here, we're going
to look at two elements, which have a lot
1871
02:23:40,260 --> 02:23:44,020
of semantic meaning and which are really important
for the good structure of a site. So I'm going
1872
02:23:44,020 --> 02:23:52,909
to do a main and close main. And after here,
I'm going to put an aside and close aside.
1873
02:23:52,909 --> 02:23:58,180
So the main is literally the main content
of your website. The main, the main content
1874
02:23:58,180 --> 02:24:04,159
of the website with the focus of this page
is so the focus of this page is all these
1875
02:24:04,159 --> 02:24:08,779
articles that I have on my homepage here,
inside that we can have all of my articles
1876
02:24:08,779 --> 02:24:15,329
aside is it's a bit of a weird one. It can
fill in different roles depending in the context
1877
02:24:15,329 --> 02:24:19,350
that it's being used in, which can definitely
be confusing, I've been confused by aside
1878
02:24:19,350 --> 02:24:23,649
because there's lots of different information
out there on it. But the main way you can
1879
02:24:23,649 --> 02:24:30,050
think about it, if it's not being used inside
of a section of a main section of content.
1880
02:24:30,050 --> 02:24:35,709
So a div is not a main section of content.
And the side is sort of a secondary information
1881
02:24:35,709 --> 02:24:40,249
for your whole page. So if we come and look
at this, this is the main content. And then
1882
02:24:40,249 --> 02:24:43,609
I have the secondary stuff, which is like
these little widgets that are showing up on
1883
02:24:43,609 --> 02:24:47,939
the side here. So this is secondary. This
is the main content that I want people to
1884
02:24:47,939 --> 02:24:52,779
do. So the aside can be that as we go through
and find other situations. Hopefully we can
1885
02:24:52,779 --> 02:24:57,200
understand a little bit more how things like
a site and main do work. Main is the easy
1886
02:24:57,200 --> 02:25:00,800
one though, because it is the main content
and that also means you can only have one
1887
02:25:00,800 --> 02:25:05,569
main page mean is an important element to
use on a page. And it can actually affect
1888
02:25:05,569 --> 02:25:10,569
the accessibility experience of people that
are visiting your website. Because they use
1889
02:25:10,569 --> 02:25:14,699
assistive technologies. And one of the things
those can look for is your main, there are
1890
02:25:14,699 --> 02:25:17,999
literally people who are blind that visit
websites. So there are programs that will
1891
02:25:17,999 --> 02:25:21,989
read things out to them, this can be blind
or just have very bad vision, and it will
1892
02:25:21,989 --> 02:25:25,459
read the page out to them. Or it could be
if you have an injury, and you're having trouble
1893
02:25:25,459 --> 02:25:31,289
using a mouse and using keyboard navigation,
things like that. Having your header and having
1894
02:25:31,289 --> 02:25:36,489
a nav and having a main and an aside, this
really can help the experience some people
1895
02:25:36,489 --> 02:25:41,689
have on your website. Now the main has very
good browser support. But older browsers including
1896
02:25:41,689 --> 02:25:46,209
Internet Explorer 11, which people still use,
don't understand it. So if you really want
1897
02:25:46,209 --> 02:25:51,310
to be good, you can also add the rule of main
on there as well. It's not required for newer
1898
02:25:51,310 --> 02:25:55,750
browsers. If you do want to support some older
browsers such as Internet Explorer, then you
1899
02:25:55,750 --> 02:25:59,050
want to have your roll of Maine on there as
well. So I'm going to leave it now if this
1900
02:25:59,050 --> 02:26:02,489
is a little bit too much, or you're like this
isn't what I'm here for right now. That's
1901
02:26:02,489 --> 02:26:06,510
cool. I'm gonna put a link in the notes though,
for people who are interested to the ally
1902
02:26:06,510 --> 02:26:11,760
project, which is a one one y, which is short
for the accessibility project. It has lots
1903
02:26:11,760 --> 02:26:15,750
of information on accessibility, and best
steps you can take in putting your website
1904
02:26:15,750 --> 02:26:20,790
together, it is a fantastic resource to keep
on learning and learn about a part of the
1905
02:26:20,790 --> 02:26:25,520
web. That's super important. But the not enough
people focus on that with that little sidebar
1906
02:26:25,520 --> 02:26:30,430
to the way on my side, I'm going to give this
a class of sidebar. Now the reason I'm doing
1907
02:26:30,430 --> 02:26:35,180
that is not just keeping me aside it is possible
for websites have multiple sides on like the
1908
02:26:35,180 --> 02:26:39,239
main which can only have one of the side can
be used for a few different things like I
1909
02:26:39,239 --> 02:26:42,859
mentioned. So because of that, just like a
div, I'm always going to give it a class.
1910
02:26:42,859 --> 02:26:48,409
And aside, I'm also always going to give a
class that sort of works out for the main
1911
02:26:48,409 --> 02:26:53,069
content that we have here. Because I've put
in these two columns now, and we have our
1912
02:26:53,069 --> 02:27:01,310
footer, you can use, let's jump into our main
and start adding a few things. And once again,
1913
02:27:01,310 --> 02:27:05,680
there is a new element that we're going to
be exploring, which is the article and I think
1914
02:27:05,680 --> 02:27:10,350
this one's pretty self explanatory. So I'm
not going to do too much explanation on it.
1915
02:27:10,350 --> 02:27:14,569
But it is when you have an article on a website,
you can use the article element. So it's saying
1916
02:27:14,569 --> 02:27:20,120
this is an article. And an article sort of
this self contained little elements were when
1917
02:27:20,120 --> 02:27:24,850
we're inside of an article, if I put a heading.
So say I put an h2 in here, it's the headings
1918
02:27:24,850 --> 02:27:29,289
for this article, they know that that heading
is related to this article, which is really
1919
02:27:29,289 --> 02:27:33,090
cool and really useful. It's a little bit
self contained compared to other things. Now
1920
02:27:33,090 --> 02:27:37,100
if we come and look at this, this article
is a little bit different from the other three
1921
02:27:37,100 --> 02:27:41,240
articles we have on the page. So what I'm
going to do is I'm going to give this first
1922
02:27:41,240 --> 02:27:48,170
article, a class of Article feature. And then
on these ones here, I'm going to give them
1923
02:27:48,170 --> 02:27:55,619
a class of RT Cole recent, and I'll explain
my naming in one second, let's just add this
1924
02:27:55,619 --> 02:28:00,950
on to those ones. So first, I'm starting with
article and then putting featured just so
1925
02:28:00,950 --> 02:28:05,860
when I have in my CSS, I'm going to have my
article featured and my article recent, they're
1926
02:28:05,860 --> 02:28:09,920
not going to be separate from one another,
like them keeping everything together, it
1927
02:28:09,920 --> 02:28:13,851
makes my CSS a little bit easier for me to
read, if you prefer putting featured article
1928
02:28:13,851 --> 02:28:17,010
in recent article, because that's how you'd
actually say it. There's nothing wrong with
1929
02:28:17,010 --> 02:28:21,459
that at all. I prefer starting things with
sort of the the name of what it is, it's almost
1930
02:28:21,459 --> 02:28:25,790
like going into a modifier class of button.
And then button accent. It's my article featured
1931
02:28:25,790 --> 02:28:29,369
and my article recent. So I know they're both
articles, because that's the first thing I
1932
02:28:29,369 --> 02:28:33,439
see. And then I can see, oh, it's different
because this is my featured one or recent
1933
02:28:33,439 --> 02:28:38,140
one. In this article. If we take a look at
it, I have my image first I have the date.
1934
02:28:38,140 --> 02:28:44,391
And then I have a title, a paragraph. And
the last but not least, I do have the continue
1935
02:28:44,391 --> 02:28:47,609
reading, I'm going to do something a little
weird though. And then I'm not going to put
1936
02:28:47,609 --> 02:28:51,369
them in this order. So we can explore something
else with Flexbox when it comes time to style
1937
02:28:51,369 --> 02:28:55,180
it. And because we want to sort of follow
best practice. So the very first thing I'm
1938
02:28:55,180 --> 02:29:02,109
going to put in here is the h2. And I'm going
to give this a class of article title and
1939
02:29:02,109 --> 02:29:07,310
close h2. After my article title. Now what
I'm going to do is put my image, so we need
1940
02:29:07,310 --> 02:29:12,720
an SRC on that, which we'll get to after and
then a lt, which we'll do after. And we're
1941
02:29:12,720 --> 02:29:18,330
also going to add a class on this of our default
image, we can follow that up with a paragraph.
1942
02:29:18,330 --> 02:29:22,319
And actually, we need two different paragraphs
because we have one for the date and one for
1943
02:29:22,319 --> 02:29:30,020
the rest of the text. And then we need my
link down at the bottom. On the first paragraph.
1944
02:29:30,020 --> 02:29:33,289
There are two different paragraphs, but we're
using them for two different things. This
1945
02:29:33,289 --> 02:29:36,340
one is the date and how many comments the
post has this paragraph here is just sort
1946
02:29:36,340 --> 02:29:41,770
of like a regular paragraph. So on this first
one here, I'm going to give it a class of
1947
02:29:41,770 --> 02:29:45,859
article, Article info. And the reason I'm
doing info is because I'm going to put the
1948
02:29:45,859 --> 02:29:51,229
date and the comments in there and not just
have one or the other. So we can so if it
1949
02:29:51,229 --> 02:29:54,250
was just the data if you'd call it article
date, or if it was just the comments, we could
1950
02:29:54,250 --> 02:29:58,739
do article comments, but I'm just going to
call it article info like that. Then we can
1951
02:29:58,739 --> 02:30:02,260
come down to this one. I'm going to Give it
a class even though I don't know if it's really
1952
02:30:02,260 --> 02:30:07,359
necessary, but I'm going to call it article
body. And the reason body is body text, if
1953
02:30:07,359 --> 02:30:11,040
you're coming, I come from a you come actually
from a print background regular text you seen
1954
02:30:11,040 --> 02:30:14,709
an article is the body text, it's also we
have our you know, that's why we have the
1955
02:30:14,709 --> 02:30:21,119
body, it's the body of the page, this is the
body text of the so it's like the main content,
1956
02:30:21,119 --> 02:30:23,789
don't know if I'm actually going to end up
styling it, but you sort of get the idea that
1957
02:30:23,789 --> 02:30:27,930
I'm using a class for everything here. Because
when I get to my CSS, that way, I know, it's
1958
02:30:27,930 --> 02:30:32,990
super easy to select anything that I want
to select. So then I also have this down here,
1959
02:30:32,990 --> 02:30:38,109
I'm going to give this a class of, I'm gonna
call it read more instead of continue reading
1960
02:30:38,109 --> 02:30:41,250
just because continues really long. And I'll
probably make a typo. And it still gets the
1961
02:30:41,250 --> 02:30:46,209
same message across. So I think that works
out fine. Now, again, the order of this is
1962
02:30:46,209 --> 02:30:50,199
not the same order as here. So if you did
it in a different order, there's nothing really
1963
02:30:50,199 --> 02:30:55,550
wrong with that. The reason I'm doing it in
this order, is imagine if somebody were to
1964
02:30:55,550 --> 02:31:00,489
come on this page, and for some reason, the
CSS doesn't load, if they get it in the actual
1965
02:31:00,489 --> 02:31:05,479
order. And they see the content in the order
that we see here with no CSS, the hierarchy
1966
02:31:05,479 --> 02:31:10,789
and the order things are in there not really
the best, we have this useless sort of information
1967
02:31:10,789 --> 02:31:15,680
first, to be honest, followed by the title.
Also, imagine if using a screen reader, and
1968
02:31:15,680 --> 02:31:20,539
it's just going one piece to the next piece
through this head, it reads this, and then
1969
02:31:20,539 --> 02:31:24,140
it reads the title, it's kind of weird, you
read the title first. And you know if you're
1970
02:31:24,140 --> 02:31:28,390
interested in that without knowing the date
that it was published first. So I like putting
1971
02:31:28,390 --> 02:31:33,079
it this way. And we can actually use a cool
Flexbox technique and feature to change the
1972
02:31:33,079 --> 02:31:38,479
order of things here visually, without impacting
the actual order that they are in the markup.
1973
02:31:38,479 --> 02:31:42,340
So this actually makes more sense when you're
looking at it from a content perspective.
1974
02:31:42,340 --> 02:31:46,899
But with the styles, we can change the order
of it all, which is really, really cool. Now
1975
02:31:46,899 --> 02:31:49,720
these recent articles, they're a little bit
different. So I'm actually gonna break those
1976
02:31:49,720 --> 02:31:53,619
down in the next video, I was planning on
doing it in this one, but I don't want to
1977
02:31:53,619 --> 02:31:56,449
overwhelm we already went through quite a
bit there. So in the next video, we're going
1978
02:31:56,449 --> 02:32:00,170
to look at this because if we go and look
at it, oh my goodness, we actually have two
1979
02:32:00,170 --> 02:32:07,810
columns in these. So let's see how they've
closed in our recent articles here. As I mentioned,
1980
02:32:07,810 --> 02:32:11,449
right at the end of the last video, we actually
have two columns. Oh, my goodness, that complicates
1981
02:32:11,449 --> 02:32:15,790
matters. No, doesn't it. So I'm going to come
in here and create two divs, one for each
1982
02:32:15,790 --> 02:32:22,680
column, div, close div. But this first column
here is going to have a class on it of Article
1983
02:32:22,680 --> 02:32:30,439
recent main. And I'm going to give this one
a class is equal to Article recent secondary.
1984
02:32:30,439 --> 02:32:37,340
So it's like my main content and the secondary
content of my article. Now if you don't really
1985
02:32:37,340 --> 02:32:42,329
like those names, I maybe could come up with
a better name for them. A lot of people don't
1986
02:32:42,329 --> 02:32:46,670
like the idea that I'm repeating article recent.
I don't like the idea of just using main and
1987
02:32:46,670 --> 02:32:49,779
secondary because maybe I you have a main
and I have a secondary for something else
1988
02:32:49,779 --> 02:32:52,970
two that are just completely different. Could
you instead of doing it this way, have an
1989
02:32:52,970 --> 02:32:57,410
article recent and then use a descendant selector,
your compound selector to say like article
1990
02:32:57,410 --> 02:33:02,510
recent main space main and article recent
space secondary, yes, you're 100%. Good. But
1991
02:33:02,510 --> 02:33:07,010
again, I like trying to avoid those descendant
or those compound selectors when I can. So
1992
02:33:07,010 --> 02:33:11,159
I'm going to use my main and my secondary
on this, it does create a long class name
1993
02:33:11,159 --> 02:33:15,999
to have to write when we get to CSS. But it
does also make my CSS really easy to read
1994
02:33:15,999 --> 02:33:20,239
and understand when I'm working in it. So
I do like that, even if it does mean being
1995
02:33:20,239 --> 02:33:25,040
a little bit more verbose. The main content
here, this is where I'm going to have my h2,
1996
02:33:25,040 --> 02:33:30,350
which can have the same class as I have here,
is sometimes a featured article will have
1997
02:33:30,350 --> 02:33:33,350
a different like font settings. But right
now it's the same font size, the same font
1998
02:33:33,350 --> 02:33:37,229
color, the same font, everything. If these
two different articles had different font
1999
02:33:37,229 --> 02:33:40,669
sizes, I'd be looking at this in a completely
different way, I'd be giving this one like
2000
02:33:40,669 --> 02:33:44,750
featured article title and this one recent
article title or something like that, it's
2001
02:33:44,750 --> 02:33:48,890
the same, they're both the exact same styles
on them, I'm going to stick with the same
2002
02:33:48,890 --> 02:33:53,279
class, because I think that makes a lot of
sense. inside of there. I also have my body.
2003
02:33:53,279 --> 02:33:58,689
And I also have the continued readings, you
know what, we can copy all this and paste
2004
02:33:58,689 --> 02:34:02,939
it in here. And exactly like before, these
have the exact same styling on it as they
2005
02:34:02,939 --> 02:34:06,729
do up here. So we can keep the same class
names once you've styled at once we've styled
2006
02:34:06,729 --> 02:34:10,380
the whole thing, the main difference between
our featured article and this one is just
2007
02:34:10,380 --> 02:34:14,290
the structure of them is a little bit different.
So we can have the two columns in one, whereas
2008
02:34:14,290 --> 02:34:18,689
the other one doesn't have the two columns
in it, these two, I can grab, and I can throw
2009
02:34:18,689 --> 02:34:24,829
in this secondary over here, because they
really are secondary, secondary information.
2010
02:34:24,829 --> 02:34:28,590
And now that I have one of those built, well,
I can just copy that whole thing and paste
2011
02:34:28,590 --> 02:34:33,159
it right here. There's all the structure of
that. In the next video, I'll take a look
2012
02:34:33,159 --> 02:34:41,239
at the site. Now, the sidebar is actually
going to be pretty easy to set up pretty much
2013
02:34:41,239 --> 02:34:44,520
because we have just two different things
to create. They're really, really simple.
2014
02:34:44,520 --> 02:34:48,770
We only have one thing to actually create
in all of this, which is I'm going to call
2015
02:34:48,770 --> 02:34:55,829
it div class equals sidebar widget. Now, if
you are going Kevin just call it a widget.
2016
02:34:55,829 --> 02:34:59,590
Go for it. You can call it just a widget.
I just want to be super explicit that this
2017
02:34:59,590 --> 02:35:03,700
widget is meant to live in my sidebar, I don't
think I'd have a widget that would live somewhere
2018
02:35:03,700 --> 02:35:07,390
else. But when I'm styling it up, and when
I have it, I just want to be really clear
2019
02:35:07,390 --> 02:35:12,039
what this widget is actually being used for.
We have two widgets. So the widget, if we
2020
02:35:12,039 --> 02:35:15,350
come and look back at the design, the widget
is the same with a big gray background on
2021
02:35:15,350 --> 02:35:20,159
it. And then inside my two widgets, so it's
one and two, there's a little bit of content,
2022
02:35:20,159 --> 02:35:25,090
but it's really not that much on two separate
things a little bit. The first widget here
2023
02:35:25,090 --> 02:35:32,560
is going to have a h two on it. And the class
will be I'm just going to call it widget title.
2024
02:35:32,560 --> 02:35:38,310
Because I think if I put sidebar widget title,
people would start getting mad at me, I think
2025
02:35:38,310 --> 02:35:42,909
widget title is fine. It's very straightforward
what it's being used for. I do have an image
2026
02:35:42,909 --> 02:35:49,579
in here. So we have our SRC and our al t that
we need. And then in this case, I have a paragraph.
2027
02:35:49,579 --> 02:35:55,989
So you probably guessed it, I want a class
on this to let's call it widget, body, close
2028
02:35:55,989 --> 02:36:00,419
paragraph. And then I have my other widget
over here. Now this widget is a little bit
2029
02:36:00,419 --> 02:36:06,449
different, I have the same styling on this
as I do on this one. But the contents a little
2030
02:36:06,449 --> 02:36:11,250
bit different. I just have an image and a
title. So what I'm gonna say is this widget
2031
02:36:11,250 --> 02:36:15,170
sidebar here. So we're gonna start off with
one thing, which will be an h2, just like
2032
02:36:15,170 --> 02:36:22,939
before to have the class of widget title,
close h2. And then, instead of having an image
2033
02:36:22,939 --> 02:36:26,810
in a paragraph, we have a few like, they're
sort of like articles, but they're not really
2034
02:36:26,810 --> 02:36:30,060
articles. So I don't think they deserve to
be called an article. So I'm just going to
2035
02:36:30,060 --> 02:36:38,829
use a div class. And it's going to be called
a widget, recent post, close div. And we have
2036
02:36:38,829 --> 02:36:42,970
three recent posts, I'm just going to do one
and we'll copy and paste it a few times. For
2037
02:36:42,970 --> 02:36:47,439
my recent post my widget recent posts, the
reason I'm doing a widget Recent Posts is
2038
02:36:47,439 --> 02:36:52,239
if I come and look at it, I sort of have an
image, I have a title and then I've underlined
2039
02:36:52,239 --> 02:36:56,379
image, title, underline image title. And that
last one doesn't actually have an underline.
2040
02:36:56,379 --> 02:36:59,689
So we'll have to figure out how we can turn
off an underline on the last one. It's not
2041
02:36:59,689 --> 02:37:03,119
something hard to do. But it's something new
and really cool that you can do with CSS.
2042
02:37:03,119 --> 02:37:07,710
I always get excited about the CSS parts,
these markup parts aren't as exciting. But
2043
02:37:07,710 --> 02:37:12,819
I digress. Let's go and look. So what I would
do here is I'm going to put an h3 in this
2044
02:37:12,819 --> 02:37:17,720
case. And the reason I'm doing an h3 is because
they are a title. It's a title for the post.
2045
02:37:17,720 --> 02:37:22,200
But it's a sub section to this. So recent
posts, this is like the category recent posts.
2046
02:37:22,200 --> 02:37:26,319
And then I have these three different recent
posts that are in there. And once again, I'm
2047
02:37:26,319 --> 02:37:30,619
putting my h3 before the image. And one part
of it is because I really want to practice
2048
02:37:30,619 --> 02:37:35,069
something with Flexbox, where you can change
the visual order of things. And I do think
2049
02:37:35,069 --> 02:37:40,069
it does make more sense to have it structured
this way with the title followed by an image.
2050
02:37:40,069 --> 02:37:43,979
If you did it the other way around, though,
it probably wouldn't be the end of the world.
2051
02:37:43,979 --> 02:37:50,060
So this do we give it the really long title
of widget recent post title, I'm going to
2052
02:37:50,060 --> 02:37:53,920
keep the widget recent post title if you wanted
to shorten it up. If you're doing your own
2053
02:37:53,920 --> 02:37:57,569
site, and you said widget post title, I think
that'd be perfectly fine. I don't think there's
2054
02:37:57,569 --> 02:38:02,220
any issue with that. The reason I wouldn't
want just post title or when Yeah, the reason
2055
02:38:02,220 --> 02:38:05,569
I wouldn't want something that doesn't have
the word widget in it is because I wouldn't
2056
02:38:05,569 --> 02:38:09,739
want people to get it confused with this article
recent because we have article recent but
2057
02:38:09,739 --> 02:38:14,350
then this article title here. So if we only
put something in here that involve the word
2058
02:38:14,350 --> 02:38:19,209
recent, say recent post title, that can really
get confused. And when you're looking at it,
2059
02:38:19,209 --> 02:38:24,149
you'd think it actually belongs up with my
recent articles. It's very verbose. But what's
2060
02:38:24,149 --> 02:38:27,609
wrong with being a little bit verbose, it
just makes your code much easier in the long
2061
02:38:27,609 --> 02:38:32,449
run, when to know exactly what it's being
used for. So I don't mind being a little bit
2062
02:38:32,449 --> 02:38:36,619
verbose. If you have a shorter way of writing
it, or you can come up with a better name,
2063
02:38:36,619 --> 02:38:40,489
there's nothing wrong with that, by all means
come up with shorter ways of writing it, I
2064
02:38:40,489 --> 02:38:43,749
might be a little if this was a personal site
that I was doing, I might try and come up
2065
02:38:43,749 --> 02:38:48,520
with things that are a little bit shorter,
just because I don't like typing. But when
2066
02:38:48,520 --> 02:38:52,600
we're learning especially, I think it's super
useful to being super clear what things are
2067
02:38:52,600 --> 02:38:56,729
being used for. And it is a good habit to
build up when you're coming up with your class
2068
02:38:56,729 --> 02:39:00,479
names. Anyway, it does make class naming a
little bit harder sometimes, but it's usually
2069
02:39:00,479 --> 02:39:07,779
worth the trouble. So my image has a source
on it, it will have an Alp on it. And it will
2070
02:39:07,779 --> 02:39:13,939
have a class on it. And you know what, I forgot
to put an image. I forgot to put a class on
2071
02:39:13,939 --> 02:39:17,249
this one. Now I think both images are gonna
be treated the same way. So I'm going to call
2072
02:39:17,249 --> 02:39:27,229
this one widget image. And with with his widget
spelt with a D. Man, which is a weird word
2073
02:39:27,229 --> 02:39:32,500
a, I was thinking maybe it was only widget,
but it's with the JIT. All of a sudden, after
2074
02:39:32,500 --> 02:39:35,479
looking at a whole bunch of times, I went
oh my goodness, I just spelt it wrong throughout
2075
02:39:35,479 --> 02:39:42,239
this entire thing. So yeah, I think we can
take this class here and put the same one
2076
02:39:42,239 --> 02:39:47,270
on this because the two images will be behaving
or the four images will behave behaving in
2077
02:39:47,270 --> 02:39:52,409
a super similar way. And once I mentioned
we have our widget recent post once that is
2078
02:39:52,409 --> 02:39:57,180
finished, we can just copy that one and paste
it a few times. And now we have everything
2079
02:39:57,180 --> 02:40:01,159
we need for our homepage intact are ready
to go I'm not going to make you go through
2080
02:40:01,159 --> 02:40:05,409
and put all the text into everything here.
But if you want to, and you're adventurous,
2081
02:40:05,409 --> 02:40:08,721
go through right now and put all the text
in and just see what you can do with it. See
2082
02:40:08,721 --> 02:40:13,100
if you can start styling this up and organizing
things, at least on a basic level. I know
2083
02:40:13,100 --> 02:40:16,720
we haven't looked at how we can reorganize
things visually, when the order in the markup
2084
02:40:16,720 --> 02:40:20,140
is wrong, we will be looking at in the videos,
we're also going to see a little bit more
2085
02:40:20,140 --> 02:40:24,589
on the images and how we can crop them properly.
But you have most of the tools, you have to
2086
02:40:24,589 --> 02:40:28,020
be able to do the site. If you don't want
to do the text, I'm going to do it all off
2087
02:40:28,020 --> 02:40:32,239
camera, when you start the next video, all
of the text will be in place and all the images
2088
02:40:32,239 --> 02:40:35,699
will be there. So if you just want to start
with all of the content already in place,
2089
02:40:35,699 --> 02:40:39,239
hit pause right at the start, and then you
could try and style it up from there. I don't
2090
02:40:39,239 --> 02:40:45,180
blame you, I probably do. I do think it's
going to we're going to be getting started
2091
02:40:45,180 --> 02:40:48,970
with the CSS, I'm so excited by this. I love
working on big projects like this and sharing
2092
02:40:48,970 --> 02:40:53,109
how I work on big projects like this. Well,
I can't see the work you do. I'm excited for
2093
02:40:53,109 --> 02:40:56,680
you to challenge yourself. And you'll have
some fun with this. So here is that Adobe
2094
02:40:56,680 --> 02:41:00,939
XD link again, just in case you never opened
it, I do think it's going to make your life
2095
02:41:00,939 --> 02:41:05,619
a lot easier. So I really encourage you to
click through and use that to get the specs.
2096
02:41:05,619 --> 02:41:09,569
But if you'd rather I'm going to keep this
slide open. The nice thing with the Adobe
2097
02:41:09,569 --> 02:41:13,909
XD version of it is if you go on the homepage
here, you can zoom in on different parts of
2098
02:41:13,909 --> 02:41:17,300
it and look at them in a little bit more detail,
which might make it a little bit easier to
2099
02:41:17,300 --> 02:41:21,629
work on. In this video, we're just focusing
on the global styles sort of setting the stage
2100
02:41:21,629 --> 02:41:25,699
for everything is going to take us a little
while to get through all the CSS that we need
2101
02:41:25,699 --> 02:41:30,329
to do on this one. But let's jump into it
and actually get started. Because it is the
2102
02:41:30,329 --> 02:41:33,760
first time we're looking at a big project
I am going to start out with you want to do
2103
02:41:33,760 --> 02:41:38,100
it on your own, by all means, do as much of
this on your own as you can with what you
2104
02:41:38,100 --> 02:41:41,189
have. And with everything. You know, as I've
already mentioned, there are a few things
2105
02:41:41,189 --> 02:41:45,880
we have not covered yet that I'm going to
use this project as an opportunity to teach
2106
02:41:45,880 --> 02:41:49,959
you about. But constantly throughout all the
lessons we're building out this page, I will
2107
02:41:49,959 --> 02:41:53,920
be stopping you and asking you to do things
that you've already done. So it's not just
2108
02:41:53,920 --> 02:41:57,310
going to be following along with me, I do
want you to be pushing yourself and learning
2109
02:41:57,310 --> 02:42:02,149
while we're doing all of this as well. So
if you didn't get that Adobe XD link already,
2110
02:42:02,149 --> 02:42:05,649
it will also be in the notes of the lesson
too, just in case you don't want to have to
2111
02:42:05,649 --> 02:42:10,959
try and worry about the slides or anything
like that. So as promised, I put in all the
2112
02:42:10,959 --> 02:42:13,689
content here. So that will definitely make
your life a little bit easier. And let's go
2113
02:42:13,689 --> 02:42:18,039
over to the CSS, we already have some CSS
in here. Because when we did this when we
2114
02:42:18,039 --> 02:42:22,310
did our navigation, right, so we're going
to leave this all here, it does make our life
2115
02:42:22,310 --> 02:42:26,089
a little bit easier to work with, because
we've already set a few things up. Now, I'm
2116
02:42:26,089 --> 02:42:30,489
not going to be constantly coming and looking
at the layout throughout this, but I'm going
2117
02:42:30,489 --> 02:42:34,879
to have it open on my own screen on the side
like I'd encourage you to do with the link
2118
02:42:34,879 --> 02:42:37,680
that I have shared you because it's a lot
easier when you're looking at your design,
2119
02:42:37,680 --> 02:42:41,039
I will be opening it occasionally. But I don't
want to constantly be opening and closing
2120
02:42:41,039 --> 02:42:44,569
it just so it's I think that'd be annoying
for you. But whenever I'm sort of looking
2121
02:42:44,569 --> 02:42:48,029
at bigger subjects or when we have to come
and examine something I want to explain myself,
2122
02:42:48,029 --> 02:42:51,919
I will open up these, I will open up the slide
just to take a little bit of look at it. But
2123
02:42:51,919 --> 02:42:56,229
I'm just grabbing font sizes or doing small
things, I might just refer to as you can see
2124
02:42:56,229 --> 02:43:01,619
in the slide or as you can see in the design.
So there's a lot of commonality that's going
2125
02:43:01,619 --> 02:43:05,851
on in this all of our titles are looking exactly
the same. We have our continued reading, we
2126
02:43:05,851 --> 02:43:09,850
just have the basic body. And the setup of
that. As I said, I like starting with global
2127
02:43:09,850 --> 02:43:13,119
styles. I already mentioned this videos about
the global setup. So that's what I'm going
2128
02:43:13,119 --> 02:43:17,029
to be focusing on. And of course, we I've
given you a whole bunch of the typography.
2129
02:43:17,029 --> 02:43:19,640
Now I didn't put the colors, but I showed
you what it looked like. So I'm assuming you
2130
02:43:19,640 --> 02:43:23,990
can figure out what color you need and stuff
like that. So let's go and set all of that
2131
02:43:23,990 --> 02:43:28,280
up. So where do you have our h1 and our subtitle
set up here. So we might as well keep going
2132
02:43:28,280 --> 02:43:31,919
through this and set up the other parts of
our typography. Because I do think that's
2133
02:43:31,919 --> 02:43:35,950
the best place to start whenever doing your
CSS because it really sets the stage when
2134
02:43:35,950 --> 02:43:38,159
you start doing the layout stuff. Sometimes
if you don't have the type set up, things
2135
02:43:38,159 --> 02:43:40,989
don't look and you start getting frustrated
and you're moving things around. And then
2136
02:43:40,989 --> 02:43:45,600
you change a font size. And you have to undo
other stuff you did. So always starting for
2137
02:43:45,600 --> 02:43:49,279
me, it makes a lot of sense. Starting with
the type. I think it prevents problems or
2138
02:43:49,279 --> 02:43:54,129
other issues from cropping up along the way.
So we had our subtitle, which I could put
2139
02:43:54,129 --> 02:43:59,470
here, just a comment to myself that this is
like the logo subtitle because I didn't give
2140
02:43:59,470 --> 02:44:04,239
it the best name to be honest, because we
also have our article title. And I don't want
2141
02:44:04,239 --> 02:44:08,669
to confuse that my subtitle like this is the
subtitle for my h1 or maybe I could even put
2142
02:44:08,669 --> 02:44:15,589
h1 subtitle. So I know that it's not dealing
with my article title that I created. And
2143
02:44:15,589 --> 02:44:19,899
it's it's not a subtitle for my article. Now
if I did have subtitles, which I don't hear,
2144
02:44:19,899 --> 02:44:24,439
but if we had like a secondary title for my
all my article titles, I would have had article
2145
02:44:24,439 --> 02:44:29,939
hyphen, subtitle, just to clarify my naming
and all of that. So I'm going to go through
2146
02:44:29,939 --> 02:44:33,600
and set this one up. So the font family is
Laura. And what what's the easiest thing to
2147
02:44:33,600 --> 02:44:37,890
do to get that font family it's to come up
to here and to copy it. But wait a second,
2148
02:44:37,890 --> 02:44:42,529
if I have to come somewhere and copy it, that
already means that maybe I shouldn't be doing
2149
02:44:42,529 --> 02:44:46,800
that maybe I should be combining two selectors
together. Probably a good idea because I also
2150
02:44:46,800 --> 02:44:51,069
am going to want my font weight here to be
shrunk down as well. So I think what I'm going
2151
02:44:51,069 --> 02:44:55,189
to do is I'm going to take both of those off
of my h1 and actually come all the way up
2152
02:44:55,189 --> 02:45:03,959
here and put an h1 h2 now I'm doing it on
the h1 and h2, I could also be doing this
2153
02:45:03,959 --> 02:45:10,489
on my article title. If you think that makes
more sense, by all means go for it. But I
2154
02:45:10,489 --> 02:45:15,529
am only going to have my h2 says article titles
in this page, it's very possibly of designs
2155
02:45:15,529 --> 02:45:19,550
that are different, and that aren't like that.
And you know what my h threes have that as
2156
02:45:19,550 --> 02:45:23,800
well, because my h threes are going to actually
open up this, I said I wouldn't do much. But
2157
02:45:23,800 --> 02:45:28,100
these are my h threes. And they're sharing
a lot of commonality with everything, my h1
2158
02:45:28,100 --> 02:45:33,739
and h2. So even though they do have a class
on them, the way I usually do it is I'll start
2159
02:45:33,739 --> 02:45:37,940
with a really generic h1, h2 h3 do as much
like global stuff on that. And then when it
2160
02:45:37,940 --> 02:45:43,979
makes sense to have my class, to put things
on that, it really depends on the layout and
2161
02:45:43,979 --> 02:45:48,390
the design that you're creating as well. Sometimes
you only need these, you never have a class,
2162
02:45:48,390 --> 02:45:52,209
sometimes you have a lot more on your classes.
I wish there was like this is the answer that
2163
02:45:52,209 --> 02:45:56,829
I could give you. One of the fun things I
think with CSS is there is no this is the
2164
02:45:56,829 --> 02:45:59,760
answer that I can give you, which can be very
frustrating when you're learning but I do
2165
02:45:59,760 --> 02:46:04,270
want to show you that it's not all just like
this cookie cutter cut and dry thing. And
2166
02:46:04,270 --> 02:46:07,920
that if you didn't do this, and you just put
everything on the class, that'd be perfectly
2167
02:46:07,920 --> 02:46:11,900
fine. There's not a problem with that. But
if you find yourself repeating yourself, try
2168
02:46:11,900 --> 02:46:16,520
and make combinations. And again, you're gonna
see you could even have an h1, h2, h3 and
2169
02:46:16,520 --> 02:46:21,090
then maybe you know, have your article title
in there as well as a selector, even though
2170
02:46:21,090 --> 02:46:24,229
that might be a bit redundant, maybe you're
gonna have an article title, that's a paragraph
2171
02:46:24,229 --> 02:46:29,319
for some odd reason, you never know. And you
just want it for visual reasons. And not necessarily
2172
02:46:29,319 --> 02:46:32,950
for other reasons, you know, I can have my
article title here, as well as like another
2173
02:46:32,950 --> 02:46:37,810
selector that's in that. Now, I'm not doing
that this time, because my h2 and my article
2174
02:46:37,810 --> 02:46:42,199
titles are the same thing. But I'm gonna leave
it just like this for now. But if you're not
2175
02:46:42,199 --> 02:46:47,470
too sure, either put everything on your class,
and you're completely fine. There's nothing
2176
02:46:47,470 --> 02:46:51,260
wrong with working that way. It's how it worked
for the longest time. But now whenever I find
2177
02:46:51,260 --> 02:46:55,319
myself having to come and copy something,
I'm just going to group it up to here. And
2178
02:46:55,319 --> 02:46:59,640
because this was just my regular h1 tag, I'm
just sticking with h2, h3, but if I put my
2179
02:46:59,640 --> 02:47:04,101
classes up there as well, that's completely
fine. And completely normal. You know what
2180
02:47:04,101 --> 02:47:07,609
else is the same on all of them actually,
is the color, they all use that same dark
2181
02:47:07,609 --> 02:47:12,380
blue color. So we can also put this up here,
and we've done a lot, the only thing I really
2182
02:47:12,380 --> 02:47:17,050
need my article title for is the font size.
So my font size on this case, it's 24 pixels,
2183
02:47:17,050 --> 02:47:22,539
which comes out to 1.5. REM. So if you were
looking at the Adobe XD, you would have seen
2184
02:47:22,539 --> 02:47:28,239
24. It's one of the very common number for
font sizes. And it works well. 1.5 is a nice,
2185
02:47:28,239 --> 02:47:34,790
easy one to do. Now I do have the body text
font size, which I have is 1.125. REM. So
2186
02:47:34,790 --> 02:47:39,209
I have a choice now of you know, this is my
body. And then I have my typography grouped
2187
02:47:39,209 --> 02:47:44,340
here, there are some people who will come
and put like this and say body and put a font
2188
02:47:44,340 --> 02:47:48,830
size down here as well. Again, I'm not doing
it on my paragraph, because I don't want it
2189
02:47:48,830 --> 02:47:52,859
to only affect my paragraphs, I want it to
affect everything. And it's not so much going
2190
02:47:52,859 --> 02:47:56,609
to be affecting on this page. But we will
have a project where you'll we will see a
2191
02:47:56,609 --> 02:48:00,409
big difference on that. So I'm going to come
up here onto my body. And I'm going to set
2192
02:48:00,409 --> 02:48:07,050
the font size here to 1.125 rim. And I think
that is it. So that's good. And the next thing
2193
02:48:07,050 --> 02:48:11,060
we want to do on this one, so we have the
links at the end, which always have that article
2194
02:48:11,060 --> 02:48:15,869
read more that say continue reading in them.
So we need to style that. So article read
2195
02:48:15,869 --> 02:48:23,770
more as the font size of 0.875. REM. And if
you leave off the leading zero, there's no
2196
02:48:23,770 --> 02:48:27,760
problem, you can just do just do it like this,
I tend to do it that way. Because it's one
2197
02:48:27,760 --> 02:48:32,079
less keystroke, I know a lot of people prefer
the zero, it's up to you which one you want
2198
02:48:32,079 --> 02:48:36,310
to have. And there's the dates that have the
same font size on them. So why don't we do
2199
02:48:36,310 --> 02:48:43,089
this. But we also have, I put dates in my
Adobe XD file. But if you remember, we actually
2200
02:48:43,089 --> 02:48:47,609
called it article info. Because it's not just
the date, there is some extra information
2201
02:48:47,609 --> 02:48:53,659
in there as well. So the two of those have
the same font size. Look, don't forget the
2202
02:48:53,659 --> 02:48:59,789
dot. But then there are some differences between
them. So on my article read more, we also
2203
02:48:59,789 --> 02:49:05,430
want to be throwing in here a few other things.
The color on that link is that bright blue
2204
02:49:05,430 --> 02:49:09,239
bars there links. So if we actually I'm going
to take a look at this for the first time
2205
02:49:09,239 --> 02:49:12,999
since we've set all of this up, we should
see it's starting to come together. Because
2206
02:49:12,999 --> 02:49:18,649
we're setting things up really nicely. We
forgot to change the font weight on the body.
2207
02:49:18,649 --> 02:49:23,949
And notice how it's a little bit bolder than
in my design. So in my XD file I earn even
2208
02:49:23,949 --> 02:49:28,109
on the slide here, where I put the style,
I definitely mentioned that it should be Ubuntu
2209
02:49:28,109 --> 02:49:32,550
light and I didn't make that change. So here
with my continue reading button, we can see
2210
02:49:32,550 --> 02:49:36,229
there's an underline on it. And we don't want
that underline to be there. So we can turn
2211
02:49:36,229 --> 02:49:43,439
that off text decoration of none, and the
font weight of 700 because it is the regular
2212
02:49:43,439 --> 02:49:47,209
bold if you wrote the word bold that that
would be perfectly fine to the one thing we
2213
02:49:47,209 --> 02:49:52,600
won't be looking at, as I mentioned when we
were looking at the logo is the spacing on
2214
02:49:52,600 --> 02:49:55,520
the letters. The spacing on the letters is
a little bit spaced out. We're going to see
2215
02:49:55,520 --> 02:49:58,050
in the next module, we're going to come back
to this project and we're going to be stepping
2216
02:49:58,050 --> 02:50:01,930
up our style we're going to make things look
a little bit fancy And nicer. So let's come
2217
02:50:01,930 --> 02:50:05,520
up to my body on that one thing that I forgot,
which is my font weight, font weight should
2218
02:50:05,520 --> 02:50:11,060
be 300. And actually, and let's go look, I
don't think it's working. There's a reason
2219
02:50:11,060 --> 02:50:15,340
why it's because I didn't bring in the I didn't
load it in with my Google fonts. But I want
2220
02:50:15,340 --> 02:50:19,169
to take this opportunity to show you a nice
little trick. Because sometimes you realize
2221
02:50:19,169 --> 02:50:22,819
there's a font weight along the way that you
need that you didn't bring in or you didn't
2222
02:50:22,819 --> 02:50:26,619
load. When you were at Google fonts. It's
annoying. If you've closed your tab to find
2223
02:50:26,619 --> 02:50:30,930
the right font to open up the little black
bar thing to go back to customize, get the
2224
02:50:30,930 --> 02:50:35,201
link, copy it back. You know, it's not, it's
not that many steps that I hold them. If you
2225
02:50:35,201 --> 02:50:39,350
can avoid it, it's always nice. So when we're
bringing in our Google fonts, I've shown you
2226
02:50:39,350 --> 02:50:43,609
that it adds the numbers here, it's just putting
in the numbers and comma separating them.
2227
02:50:43,609 --> 02:50:46,850
So if you forgot one, and you want to add
it in, after, you can literally just come
2228
02:50:46,850 --> 02:50:50,859
here and add it in like that, it's really,
really simple, really, really easy. And now
2229
02:50:50,859 --> 02:50:56,379
we have access to our 300 as well. So if we
come in look, we should see ha, there we go.
2230
02:50:56,379 --> 02:51:01,180
The fonts are nice and light, and they look
much, much nicer. My continue reading is also
2231
02:51:01,180 --> 02:51:07,109
looking Okay. One thing I didn't do on that
though, was I made a bit of a booboo. I did
2232
02:51:07,109 --> 02:51:12,319
not include a hover. So I'm going to come
in and add a hover to it. And if we have a
2233
02:51:12,319 --> 02:51:16,840
hover, we need one other thing. What is it?
Hope you said focus on these long ones I like
2234
02:51:16,840 --> 02:51:22,260
to copy and paste to make life a little bit
easier. I'm going to put take a minute, I'm
2235
02:51:22,260 --> 02:51:25,379
going to remove the font weight because we
don't want to change that, I want to change
2236
02:51:25,379 --> 02:51:31,350
my color to the darker color. Just so they're
just we have a color. But I also want to add
2237
02:51:31,350 --> 02:51:35,909
the text decoration back in. Because I find
the subtle, it's going to be a shifting color.
2238
02:51:35,909 --> 02:51:39,560
But I think adding the underline will really
just make it more pronounced. So the original
2239
02:51:39,560 --> 02:51:43,250
text decoration, we haven't looked much at
this. But if you want to, it's just writing
2240
02:51:43,250 --> 02:51:47,880
the word underline the default style that's
already there. So we can add it back in by
2241
02:51:47,880 --> 02:51:51,000
doing a text decoration underline or you can
put that on something that doesn't have an
2242
02:51:51,000 --> 02:51:54,979
underline and you can create once you get
a span where you want it an underline. This
2243
02:51:54,979 --> 02:51:59,600
is one way you can do it. So now if we go
and take a look at what we have, we have the
2244
02:51:59,600 --> 02:52:03,010
everything is looking pretty good. And you
can see the changes color. And I'm getting
2245
02:52:03,010 --> 02:52:07,390
that underline that's coming on there as well.
So we have two things left to do in the typography
2246
02:52:07,390 --> 02:52:10,470
section before we finish off this video, but
I'm going to do them as a challenge to you
2247
02:52:10,470 --> 02:52:14,820
before I do them. They're both things we've
looked at before. And I won't lie to you,
2248
02:52:14,820 --> 02:52:17,439
I forgot to do this at the beginning. So you
might have noticed at the beginning of this
2249
02:52:17,439 --> 02:52:22,109
video, we didn't have the bold or the link
here. I've just added them in now. Sorry about
2250
02:52:22,109 --> 02:52:26,580
that. But now that they are here, I need you
to style them. For me. The problem with the
2251
02:52:26,580 --> 02:52:30,649
bold one is it's not bold enough, it looks
a little bit bold, but it's not really quite
2252
02:52:30,649 --> 02:52:35,520
getting there. And I'll explain why in a second.
And then the other problem is this, it just,
2253
02:52:35,520 --> 02:52:38,720
you know, some basic styling on our link,
we want to make sure we have a hover, change
2254
02:52:38,720 --> 02:52:42,390
the color and all of that on there. So I'll
let you do those two, and then I'll take a
2255
02:52:42,390 --> 02:52:51,300
look and explain a little bit of what's going
on with the strong. Right. So I'm assuming
2256
02:52:51,300 --> 02:52:55,979
you put them down here when you did it on
line 60. And I left a space there to do it.
2257
02:52:55,979 --> 02:53:00,159
So that's completely fine. Just to see if
I was doing this myself, I'd actually leave
2258
02:53:00,159 --> 02:53:05,080
this space here because I'm going into a next
section of content anyway. But I would actually
2259
02:53:05,080 --> 02:53:11,060
bring those up here where I have my general,
like my h1, h2 h3 selectors, because then
2260
02:53:11,060 --> 02:53:14,880
I'm getting into classes. And I just like
organizing things. And this is just personal
2261
02:53:14,880 --> 02:53:18,869
preference on my part, there's no right or
wrong answer here. But I would have my a here
2262
02:53:18,869 --> 02:53:23,830
as well as my strong tag. If I had paragraph
styles. If I had anything that's just a regular
2263
02:53:23,830 --> 02:53:29,130
tag, before I get into the typography of my
classes, I would include all of the general
2264
02:53:29,130 --> 02:53:33,739
ones first. So on my eight here, we can set
the color of it, which is the light color.
2265
02:53:33,739 --> 02:53:37,279
Now when that you might have also found a
way to sort of combine it with other selectors.
2266
02:53:37,279 --> 02:53:40,550
And if you did that, that's really cool. I
think that's the only change we needed there.
2267
02:53:40,550 --> 02:53:46,550
But of course, we need our a hover, and a
focus, we also want to give it I'm just going
2268
02:53:46,550 --> 02:53:51,289
to do the same color change that I did on
those read more links. And as I said on, we
2269
02:53:51,289 --> 02:53:56,199
need to style the strong tag. Because the
font isn't bold enough, it's a little bit
2270
02:53:56,199 --> 02:54:01,449
bold, and it's not really getting very bold.
And the reason for this is, depending on the
2271
02:54:01,449 --> 02:54:06,459
browser, using actually bold can have two
different settings on it. One of them is bold,
2272
02:54:06,459 --> 02:54:11,039
which will just bring it to 700 automatically,
but the specification actually outlines that
2273
02:54:11,039 --> 02:54:15,909
it should be bolder, like there's a there's
a literally a boulder keyword. So if I come
2274
02:54:15,909 --> 02:54:21,220
on my link here just so we can stay in one
spot and not create a new class or anything.
2275
02:54:21,220 --> 02:54:25,890
If I set the font weight on this to Boulder,
you'll see it looks a lot like my strong tie
2276
02:54:25,890 --> 02:54:30,339
here, it's gained a little bit of weight.
What boulder means I'm going to go back to
2277
02:54:30,339 --> 02:54:36,560
my index for a second is it means we're currently
here, go one step bolder. So it's going to
2278
02:54:36,560 --> 02:54:42,319
go from 300 to the next available font in
the scale whereas if you use the actual bold
2279
02:54:42,319 --> 02:54:48,779
keyword, so instead of bold it goes to a bolder
it goes to bold. Now you can see it's gotten
2280
02:54:48,779 --> 02:54:53,502
super fat, like look at the difference there
between this one and my link. So bold, really
2281
02:54:53,502 --> 02:54:59,399
bold will always jump to 700 Where's bolder,
we'll go to the next available. This depends
2282
02:54:59,399 --> 02:55:04,119
what browser In Google, Chrome will actually
normally go to bold, whereas Firefox and some
2283
02:55:04,119 --> 02:55:08,120
other browsers will go to Boulder. But boulder
is the official specification, that's the
2284
02:55:08,120 --> 02:55:12,709
way it should be working. That's one of the
reasons on a strong tag. Even if it looks
2285
02:55:12,709 --> 02:55:17,689
good on your screen, different browsers might
be doing different stuff. So always tell it
2286
02:55:17,689 --> 02:55:21,919
what font weight you want to have, in this
case, it should be 700. And we can take this
2287
02:55:21,919 --> 02:55:26,689
font weight of my aof. And if you put the
word bold, that would be fine too bold and
2288
02:55:26,689 --> 02:55:30,961
700 should end up at the same place, I prefer
the numbers a, they're faster, they're a bit
2289
02:55:30,961 --> 02:55:34,770
more consistent. And when you get start getting
into like the in betweens, which you're often
2290
02:55:34,770 --> 02:55:38,270
going to be using, it's just a lot easier
to use a number. So there we go. Now I have
2291
02:55:38,270 --> 02:55:43,550
the nice big bold font on there, and everything
else is looking good. My link is clearly something
2292
02:55:43,550 --> 02:55:48,270
we can click on. And that's it, we don't have
anything else to do the dates, we don't actually
2293
02:55:48,270 --> 02:55:51,850
have to this article info, we don't actually
have to do any other more styling than the
2294
02:55:51,850 --> 02:55:56,609
font size. I know in my outline, I put the
distribute light, but because I put the light
2295
02:55:56,609 --> 02:56:01,060
font weight on my body here, that's automatically
going to get applied to everything. Now pretty
2296
02:56:01,060 --> 02:56:06,660
much unless I explicitly override it by putting
a font weight on it. So everything is done,
2297
02:56:06,660 --> 02:56:13,380
we're good to go. In the next video, we can
start with the layout of curfew first. In
2298
02:56:13,380 --> 02:56:17,609
this video, we're just looking at the big
picture, I always start big picture. And now
2299
02:56:17,609 --> 02:56:21,899
typography maybe isn't big picture. But as
I mentioned, when you set up layout, and then
2300
02:56:21,899 --> 02:56:25,249
things aren't looking good, then you change
the type things change again, then you go
2301
02:56:25,249 --> 02:56:29,760
back to layout. So I always like doing typography
first, then big layout, and then slowly working
2302
02:56:29,760 --> 02:56:33,710
my way to like more and more like all the
different smaller pieces of my layout, which
2303
02:56:33,710 --> 02:56:37,380
we often call components, we have a few different
components. On this page, we have our widget
2304
02:56:37,380 --> 02:56:42,020
component or featured article component. And
our recent article component is sort of how
2305
02:56:42,020 --> 02:56:45,720
I'm going to break this page down in the same
way when we were doing our markup how I looked
2306
02:56:45,720 --> 02:56:48,930
at it. So we need something, it's going to
hold the page in the middle. And then we need
2307
02:56:48,930 --> 02:56:52,130
that to have two different columns on it.
And we need to set those two columns to have
2308
02:56:52,130 --> 02:56:57,030
the right sizes on them. A few decisions that
have to be made now about a few different
2309
02:56:57,030 --> 02:57:00,459
things. Now one thing that we've already done,
if we scroll down, and we find where we did
2310
02:57:00,459 --> 02:57:04,619
our layout, we already created a container.
So that's pretty cool, because that means
2311
02:57:04,619 --> 02:57:10,880
our content here is already inside of a container,
it's already being held within the same place.
2312
02:57:10,880 --> 02:57:15,040
Because when we created this, we gave it that
same container. So if I go really, really
2313
02:57:15,040 --> 02:57:19,920
big now, I can't go in my content, we'll stop
growing at one point, which is awesome. So
2314
02:57:19,920 --> 02:57:23,419
we don't have to worry too much about the
container itself. The first thing I'm gonna
2315
02:57:23,419 --> 02:57:27,260
worry about is setting up those two columns,
though. So in my layout, if we come back,
2316
02:57:27,260 --> 02:57:30,379
actually, we should look at our indexes, you're
always gonna be jumping back and forth between
2317
02:57:30,379 --> 02:57:36,149
the two of them unless you have a really good
memory for your classes, we had my main and
2318
02:57:36,149 --> 02:57:43,079
my main is all my Main articles, and then
we had an aside right there, and then all
2319
02:57:43,079 --> 02:57:49,119
my aside is that secondary widget on the side.
And all of that is living inside of this container.
2320
02:57:49,119 --> 02:57:53,050
Now the container, I don't want to give it
a display flex, because I might get other
2321
02:57:53,050 --> 02:57:57,439
content inside of a container that I don't
want to have a display flex on. So that's
2322
02:57:57,439 --> 02:58:01,779
the same reason I had my container and my
container nav here. And when I did that, it's
2323
02:58:01,779 --> 02:58:07,140
because I wanted to make this container have
a display flex on it. Now what I'm realizing
2324
02:58:07,140 --> 02:58:11,560
is I'm coming in, I want to do the same thing
here. So having container nav here wouldn't
2325
02:58:11,560 --> 02:58:16,500
make a lot of sense. I could call it container
main or main content, but why not come and
2326
02:58:16,500 --> 02:58:21,699
give it a class like container flex. And the
idea here is I have a container, but I'm also
2327
02:58:21,699 --> 02:58:26,729
making this container a Flexbox. If I do container,
flex there, and then I come up here and I
2328
02:58:26,729 --> 02:58:31,159
change this one. The reason I'm changing that
one now is because I'm going oh, I want these
2329
02:58:31,159 --> 02:58:35,300
two to have the exact same behavior, I might
as well give them the exact same class, it
2330
02:58:35,300 --> 02:58:39,079
This might not work in every situation you
run into. Because if you remember when we
2331
02:58:39,079 --> 02:58:43,909
did this, we had display flex, but we also
had this justify content space between. In
2332
02:58:43,909 --> 02:58:46,689
this case, that's a good thing. It's exactly
what we want, because we want to push our
2333
02:58:46,689 --> 02:58:52,510
two things as far apart as possible. So container
nav display flex, that's fine. So we can just
2334
02:58:52,510 --> 02:58:57,560
change this from nav to container flex. And
that means anytime we have a container, we
2335
02:58:57,560 --> 02:59:02,489
need to display flex on width is justify content
space between we can use this class and we're
2336
02:59:02,489 --> 02:59:07,140
modifying so we have a normal container if
we need it. And we can take that a step further
2337
02:59:07,140 --> 02:59:11,380
when we want to with this modifier of that
original container. Now technically, and a
2338
02:59:11,380 --> 02:59:16,050
lot of places we'll just call this like flex,
or though it'd be like a flex class, right?
2339
02:59:16,050 --> 02:59:19,770
It'd be flex, and you might add something
to the name to indicate that it's also doing
2340
02:59:19,770 --> 02:59:25,040
this or if you really get into something called
atomic CSS, it would have like a diff, you'd
2341
02:59:25,040 --> 02:59:29,770
have literally D flex, which would just be
display flex, then you can have something
2342
02:59:29,770 --> 02:59:33,909
that else is just justify content that just
applies justify content. I'm personally not
2343
02:59:33,909 --> 02:59:39,119
a fan of doing that. But I think you could
just call it flex if you think you'd use this
2344
02:59:39,119 --> 02:59:45,529
for a whole bunch of reasons. I tend to do
more, this type of thing personally. But one
2345
02:59:45,529 --> 02:59:50,220
thing we CSS and CSS naming conventions, there's
about a million different approaches to it.
2346
02:59:50,220 --> 02:59:53,899
So I'm throwing a few ideas out there. I'm
gonna stick with this one for now, if we've
2347
02:59:53,899 --> 02:59:57,839
worked through our project, sometimes you
end up running into a situation where maybe
2348
02:59:57,839 --> 03:00:02,159
you end up changing the name again. Now part
of CSS is planning things ahead. But it's
2349
03:00:02,159 --> 03:00:05,779
really hard to do when you're a complete beginner.
So I want to show you the type of things that
2350
03:00:05,779 --> 03:00:09,069
you might run into. If you've planned things
out really well from the beginning, because
2351
03:00:09,069 --> 03:00:13,300
you've made 100 sites, and you can analyze
the design really well right from the get
2352
03:00:13,300 --> 03:00:16,989
go, you might not need to be making these
things. Or you might realize I always need
2353
03:00:16,989 --> 03:00:20,950
to have something like this. And right from
the beginning, you're always giving yourself
2354
03:00:20,950 --> 03:00:25,260
some sort of flex class that just has like
these basic settings on it that you can use
2355
03:00:25,260 --> 03:00:28,729
whenever you need it, simplify your life as
much as possible. Let me go take a look at
2356
03:00:28,729 --> 03:00:34,749
our layout. Now. We should have two columns.
Now everything's a little bit broken, because
2357
03:00:34,749 --> 03:00:39,479
my images are huge. So we can see though we
have two columns, that's amazing. We're almost
2358
03:00:39,479 --> 03:00:42,869
finished honestly, with the layout. And the
two big things that we need to go through
2359
03:00:42,869 --> 03:00:46,689
and fix right now are the image sizes, and
it's really going to help and we can set our
2360
03:00:46,689 --> 03:00:50,910
column sizes as well, I'm going to go all
the way up to the top where my body is. And
2361
03:00:50,910 --> 03:00:55,359
right after that, I'm going to put my image
here, I find this a really like global generic
2362
03:00:55,359 --> 03:00:59,119
thing, it doesn't really fit into layout.
It's definitely not prototype biography. It's
2363
03:00:59,119 --> 03:01:07,089
a sort of my general thing that lives up here
at the top MSA max width is 100%. I'm also
2364
03:01:07,089 --> 03:01:13,789
going to put a display of block on here. I'm
doing it now not to confuse you. But just
2365
03:01:13,789 --> 03:01:18,169
to say I remember when I said images are usually
display inline, it does lead to this issue
2366
03:01:18,169 --> 03:01:22,819
where there's a small when something when
an image is display, inline, which it is,
2367
03:01:22,819 --> 03:01:26,449
by default, it gets this little little space
underneath that I'm not going to worry about
2368
03:01:26,449 --> 03:01:30,489
why that happens right now. But what what
it means is, when you're setting spacing on
2369
03:01:30,489 --> 03:01:35,709
them, it doesn't always line up exactly how
you want it to. So a really, this is like
2370
03:01:35,709 --> 03:01:43,240
every site you ever do, literally, you might
do something like this, where it just solves
2371
03:01:43,240 --> 03:01:47,409
98% of the problems you'll ever have with
an image, we have one other thing we're going
2372
03:01:47,409 --> 03:01:51,289
to do to deal with the cropping on them. But
this is just like, if you're setting up your
2373
03:01:51,289 --> 03:01:54,419
images, these two things will just make your
life a lot easier. So I sort of recommend
2374
03:01:54,419 --> 03:01:58,260
always having it's like body this image this
and then you're done. So if we go and take
2375
03:01:58,260 --> 03:02:02,970
a look, now, hey, look, things have already
gotten much, much, much better. I also made
2376
03:02:02,970 --> 03:02:06,569
another mistake in my typography, we'll fix
that when we get to our widget. So the last
2377
03:02:06,569 --> 03:02:12,050
thing we'll do is sort of set the proper sizes
on those. So that was my main and my aside.
2378
03:02:12,050 --> 03:02:16,970
So I'm definitely going to come down to my
layout, layout, containers really sort of
2379
03:02:16,970 --> 03:02:23,010
generic, then I have my header, this is all
header, we might as well go right here, I
2380
03:02:23,010 --> 03:02:27,420
have my navigation, I have this in its own
category, I might, you know, depending on
2381
03:02:27,420 --> 03:02:30,640
how you want to work, you might keep your
navigation up here with your header stuff.
2382
03:02:30,640 --> 03:02:35,089
Because the navigations in there, I'm just
gonna come right here and say my main and
2383
03:02:35,089 --> 03:02:41,619
we have my aside, I want you to set some sizes
on this, see how we can look and see if we
2384
03:02:41,619 --> 03:02:48,010
end up agreeing on the sizes we're going to
put on this. Alright, so on my main on this
2385
03:02:48,010 --> 03:02:55,399
one, I'm going to put a width of 75%. And
on my side, I'm gonna give this a width of
2386
03:02:55,399 --> 03:02:59,619
20%. That's good. Take a look now may look
a little bit wider than when we needed to
2387
03:02:59,619 --> 03:03:04,010
be. But that's okay. I think overall, we're
sort of hitting where we what we need and
2388
03:03:04,010 --> 03:03:09,089
what we want it to look like. So in C, it's
working. Now we do need to build a breakpoint
2389
03:03:09,089 --> 03:03:13,199
into this as well, right? Because Oh man,
that sucks when we get to the small screens.
2390
03:03:13,199 --> 03:03:18,060
And I know that there's a problem my navigation,
I want you to try and fix it and see what
2391
03:03:18,060 --> 03:03:21,540
it is see if you can figure out what it is
because we have the right code. But now there's
2392
03:03:21,540 --> 03:03:31,649
an issues, see if you can solve it. Did you
find it? This is finding little changes, whether
2393
03:03:31,649 --> 03:03:38,529
it's a typo, or just sort of running through
things quickly and trying to find issues is
2394
03:03:38,529 --> 03:03:42,909
a really, really good skill to have. It's
something you can get pretty good at typos
2395
03:03:42,909 --> 03:03:48,710
are like spelling color wrong, or just setting
the wrong property on something spelling direction,
2396
03:03:48,710 --> 03:03:52,959
but you mix up the C and the T, things like
that knows a lot of problems. Now in this
2397
03:03:52,959 --> 03:03:58,189
case, that's not exactly what it was. But
it's because I renamed my container flex.
2398
03:03:58,189 --> 03:04:02,890
But in my media query, I never redefine that
and change the name here. So remember, we
2399
03:04:02,890 --> 03:04:06,949
had container nav, we change it to container
flex, I need to do that here too, to make
2400
03:04:06,949 --> 03:04:11,069
sure that it's working. And hey, look at that
we have that working wonderfully. But we've
2401
03:04:11,069 --> 03:04:15,540
run into a problem of we still have the wrong
widths on things. Now these are using something
2402
03:04:15,540 --> 03:04:20,669
called max width instead of min width. And
I mentioned that we sort of want to be doing
2403
03:04:20,669 --> 03:04:25,100
a mobile first approach to things instead
of working from the big screen to the small
2404
03:04:25,100 --> 03:04:30,149
screen, it generally makes life a lot easier,
you end up writing less CSS, because the defaults
2405
03:04:30,149 --> 03:04:35,029
are a bit more of your friend. So in the next
video, we're going to explore how we can switch
2406
03:04:35,029 --> 03:04:38,779
our min width to a max width and a little
bit of refactoring we can do and then you're
2407
03:04:38,779 --> 03:04:41,880
going to see how much easier it just makes
it so you're we're not overriding as much
2408
03:04:41,880 --> 03:04:48,560
we can write a lot less code. So I'm actually
going to take this. So to start thinking mobile
2409
03:04:48,560 --> 03:04:54,449
first, what I'm actually going to do is completely
remove my media query. So let's take this
2410
03:04:54,449 --> 03:04:59,410
out and take that out. So we're left with
this. Now we don't want this code just floating
2411
03:04:59,410 --> 03:05:03,199
around. Like that. So I'm actually going to
take this text align center and make it the
2412
03:05:03,199 --> 03:05:08,770
new default. And I'm going to take this flex
direction column, and I'm going to make that
2413
03:05:08,770 --> 03:05:16,540
the new default. And we can delete this extra
stuff here. What I'm also going to do is I'm
2414
03:05:16,540 --> 03:05:20,439
going to delete these for the moment. And
you're gonna see why. Because when I delete
2415
03:05:20,439 --> 03:05:24,220
that, and if we hadn't had the media query
there at all, and we go and take a look at
2416
03:05:24,220 --> 03:05:31,649
it, at small screen sizes, we're almost done.
We've, we've sort of done the mobile first
2417
03:05:31,649 --> 03:05:35,260
design, there's there's not a lot to it here
that we're missing, there's some spacing issues,
2418
03:05:35,260 --> 03:05:38,930
we need a little bit of margin to separate
some stuff, a few little decorations here
2419
03:05:38,930 --> 03:05:42,939
or there. This just needs the box, we need
to fix the typography thing I talked about.
2420
03:05:42,939 --> 03:05:47,899
But you're sort of 90% of the way there. The
problem with working on the big screen first
2421
03:05:47,899 --> 03:05:51,979
is writing a bunch of code, and then you're
overwriting it all at the small screen size,
2422
03:05:51,979 --> 03:05:55,569
you're resetting your columns back to what
they were before, you're changing things to
2423
03:05:55,569 --> 03:06:00,390
be back the way, if you hadn't done it, it's
exactly what it would look like. Now the problem
2424
03:06:00,390 --> 03:06:04,689
is, when we get to the big screens, it just
starts stretching and not looking so nice.
2425
03:06:04,689 --> 03:06:10,180
So what we want to do is build in that point
where all of a sudden, at one point we go,
2426
03:06:10,180 --> 03:06:13,770
Okay, we're big enough, now we're going to
add the two columns in there. So that's where
2427
03:06:13,770 --> 03:06:18,539
the media query comes in. So we can add that
back in now at media. But what I'm going to
2428
03:06:18,539 --> 03:06:25,220
say this time, is, we're going to do a min
width instead of a max width of 675 pixels.
2429
03:06:25,220 --> 03:06:35,499
So now we can say our container, flex, flex
direction, is row. So right away by doing
2430
03:06:35,499 --> 03:06:39,489
that, if we come and take a look, when we
hit the right screen size, oh, now we have
2431
03:06:39,489 --> 03:06:44,260
two columns, and we have one, and it's working
pretty good. Now, I never said any sizes on
2432
03:06:44,260 --> 03:06:49,670
this, this is just the defaults that are popping
up right now is now I can say my main cause
2433
03:06:49,670 --> 03:07:01,029
the width of 75. My side has the width of
20. And that's it, I don't have to worry about
2434
03:07:01,029 --> 03:07:05,390
Whoops, I don't want that there. I don't have
to worry about overriding this anywhere, I
2435
03:07:05,390 --> 03:07:10,079
don't have to go and all of a sudden say,
whoop, I also need to now immediately like
2436
03:07:10,079 --> 03:07:14,960
I don't have this as my default that I then
need to reset up to 100%. So we've just said
2437
03:07:14,960 --> 03:07:19,149
at one time, we've redefined it for the big
screen because the small screen was perfect.
2438
03:07:19,149 --> 03:07:23,039
And in general, small screens are much simpler.
So it's a lot easier to do all of your small
2439
03:07:23,039 --> 03:07:26,800
screen stuff, and then add on a few little
things here and there afterward. So now if
2440
03:07:26,800 --> 03:07:33,289
we go look, we have our gap between there
and everything is starting to fall into place.
2441
03:07:33,289 --> 03:07:38,829
spacing on things isn't the most work we sort
of have to do is with this, we need to add
2442
03:07:38,829 --> 03:07:42,819
this line that's going to be coming through
on here and just add some spacing between
2443
03:07:42,819 --> 03:07:46,800
our articles in general, because if we come
and take a look at them, we'll go to our small
2444
03:07:46,800 --> 03:07:52,579
screen. And we are not spaced out properly,
the spacing on things isn't very good. If
2445
03:07:52,579 --> 03:07:56,209
these are really stuck together. So we're
going to add in that spacing that we need
2446
03:07:56,209 --> 03:08:00,670
right now, when we come and we look at the
original design, we do have a lot more space
2447
03:08:00,670 --> 03:08:04,879
are on my date, this spacing actually looks
pretty good. But we'd need a lot more space
2448
03:08:04,879 --> 03:08:09,890
here in here with this line coming through.
So let's start with just getting the space
2449
03:08:09,890 --> 03:08:13,699
around my date and make three comments thing
that's right there. Now where would we do
2450
03:08:13,699 --> 03:08:18,999
that? We don't even need to go into our article.
To do that right now we need the first part,
2451
03:08:18,999 --> 03:08:22,060
since we're just looking at something in there
is actually in the typography so we can come
2452
03:08:22,060 --> 03:08:27,869
back up. And that is my article info, we don't
have a selector for it. So I'm just going
2453
03:08:27,869 --> 03:08:33,029
to copy that. We have the read more, read
more. So we can come down here and put my
2454
03:08:33,029 --> 03:08:37,970
article info, I want you to create the spacing
for it with one that line of CSS don't want
2455
03:08:37,970 --> 03:08:45,339
you to use the shorthand and add in that empty
space. So you weren't sure if it's margin
2456
03:08:45,339 --> 03:08:48,660
or padding. Again, people mix those up all
the time. But I think you won't have confused
2457
03:08:48,660 --> 03:08:53,069
it yet. Because we've been using almost exclusively
margin up until now once we start doing more
2458
03:08:53,069 --> 03:08:57,439
projects with padding, you might start mixing
them a little bit, the spacing is pretty big
2459
03:08:57,439 --> 03:09:02,080
on it, I want to make it even on the two sides.
This is where it depends a little bit how
2460
03:09:02,080 --> 03:09:08,420
you like to work, though. And the reason I'm
saying that is you could some I tend to always
2461
03:09:08,420 --> 03:09:13,430
like putting margin bottoms only. But I have
exceptions. Because if you only deal with
2462
03:09:13,430 --> 03:09:17,640
margin bottoms, it definitely makes your life
a little bit easier. But sometimes it's nice
2463
03:09:17,640 --> 03:09:22,329
to have a margin top just to simplify things.
So I'm going to do that. So I don't have to
2464
03:09:22,329 --> 03:09:25,989
add a margin bottom on my image. And I'm just
going to put this space and this space all
2465
03:09:25,989 --> 03:09:30,390
on the date, it looks quite a bit bigger than
my font size. So I'm gonna start with like
2466
03:09:30,390 --> 03:09:35,149
a 2.5 M and a zero, maybe it's too big, I
think it might be but I tend to go bigger
2467
03:09:35,149 --> 03:09:39,609
and then shrink down. And there's a really
good reason that I do that. A lot of the time
2468
03:09:39,609 --> 03:09:43,529
with margins, there's this thing that happens
where you always end up putting them too small
2469
03:09:43,529 --> 03:09:48,529
and then you think it's not bad, but maybe
no just go bigger always go bigger than you
2470
03:09:48,529 --> 03:09:52,749
think. So start with a big number and slowly
reduce until you're happy with it. Oh, it
2471
03:09:52,749 --> 03:09:56,799
does look a little bit big. So let's just
drop that down to two. And I think that looks
2472
03:09:56,799 --> 03:10:02,319
much better. And here's the fun part and that
is going to be Adding in the underlying after
2473
03:10:02,319 --> 03:10:06,089
our continue reading, here's that line that
goes all the way across the bottom, I want
2474
03:10:06,089 --> 03:10:09,840
you to think about where you do that, how
you do that, how you pull it off how you create
2475
03:10:09,840 --> 03:10:14,510
the spacing that you need on the two sides
of that line. So what you know, if you have
2476
03:10:14,510 --> 03:10:18,529
to jump into the index, look at the markup
a little bit, try and analyze it and see where
2477
03:10:18,529 --> 03:10:22,420
you'd put that and how you think you might
be able to pull that off. If you get a little
2478
03:10:22,420 --> 03:10:26,069
bit stuck, that's fine. There's a bit of a
trick to this one. It's not complicated, but
2479
03:10:26,069 --> 03:10:32,180
it's not always something you'd think of when
you're first starting off with this stuff.
2480
03:10:32,180 --> 03:10:35,489
So hope you had success with that, and you
figured it out. If not, then really don't
2481
03:10:35,489 --> 03:10:40,129
worry about it. But what I'm going to do is
in my layout, I'm going to come down and down
2482
03:10:40,129 --> 03:10:45,479
and down and down. And we're going to create
a new section here called articles, because
2483
03:10:45,479 --> 03:10:51,159
I am going into my article itself. And I'm
breaking that down a little bit now. So for
2484
03:10:51,159 --> 03:10:55,939
this, I want to take my article featured,
because this is the only one that has the
2485
03:10:55,939 --> 03:11:00,270
underline on it. And I'm going to add a border
bottom to it. So that's going to create that
2486
03:11:00,270 --> 03:11:04,439
line a lot like we did on remember negation
actually. So border bottom, and we can give
2487
03:11:04,439 --> 03:11:11,119
it the color that we need. We'll give it one
pixel. And we'll make it a solid line. And
2488
03:11:11,119 --> 03:11:16,890
let's go and take a look at how that looks.
So there we go, we have the line that's actually
2489
03:11:16,890 --> 03:11:21,319
showing up, but the spacing and everything
is off. It's just not where exactly we need
2490
03:11:21,319 --> 03:11:26,590
it to be. So how can we fix that. But we need
two different things. The first one is I'm
2491
03:11:26,590 --> 03:11:29,270
going to add padding, but I only want the
padding on the bottom. And I'm going to do
2492
03:11:29,270 --> 03:11:32,520
with the shorthand just illustrate why. So
I'm going to do one m of padding, and we'll
2493
03:11:32,520 --> 03:11:36,810
go take a look. And you can see it's pushing
everything inward. And you know what, let's
2494
03:11:36,810 --> 03:11:39,899
also give this a background color to make
it super clear what's going on. So we're gonna
2495
03:11:39,899 --> 03:11:44,039
give this a pink background, so we can look
at what's happening. So we can see the size
2496
03:11:44,039 --> 03:11:49,089
of my featured articles exactly the same.
But when I added that padding, it pushed everything
2497
03:11:49,089 --> 03:11:53,810
inside of that box a little bit. And if we
make that a bigger number, it's gonna push
2498
03:11:53,810 --> 03:11:58,479
it even more. So we're pushing all inside.
But you'll notice the border is staying on
2499
03:11:58,479 --> 03:12:03,159
the outside of my padding. So the borders
all the way over here. So if this padding
2500
03:12:03,159 --> 03:12:06,699
was only on the bottom, instead of being on
all the sides, it would just be creating empty
2501
03:12:06,699 --> 03:12:11,720
space right here where we want it. So I can
take this down to maybe back down to a one.
2502
03:12:11,720 --> 03:12:16,439
And I can also switch it over to padding bottom,
if you want to use the padding shorthand,
2503
03:12:16,439 --> 03:12:20,419
it's perfectly fine there mentioned, if you're
only putting it on one side, I don't think
2504
03:12:20,419 --> 03:12:24,770
personally, there's anything wrong with using
the padding, bottom or padding, right or that
2505
03:12:24,770 --> 03:12:28,970
type of thing, it's when you're using two
or three sides, it's a little bit faster to
2506
03:12:28,970 --> 03:12:32,520
actually do it with the shorthand. But if
you use the shorthand for everything, it's
2507
03:12:32,520 --> 03:12:36,640
kind of cool to be consistent, so I don't
blame you. Um, so you can see it has created
2508
03:12:36,640 --> 03:12:41,499
that space we want my border is right there.
Now, I also want to increase this space a
2509
03:12:41,499 --> 03:12:47,152
little bit. And we can do that with my margin.
So it's an margin bottom. And I'm gonna make
2510
03:12:47,152 --> 03:12:51,989
it way too big for now, just to illustrate
that it is working. And so you can see this
2511
03:12:51,989 --> 03:12:57,129
is my pink box, the padding was working inside.
So that's why we have a gap right here, then
2512
03:12:57,129 --> 03:13:01,749
I have my border, and then I have my margin
after. So if you go way back to when we learned
2513
03:13:01,749 --> 03:13:06,909
about the box model, it was always padding
first, then a border, then a margin, we don't
2514
03:13:06,909 --> 03:13:11,500
use borders terribly often. So sometimes we
forget where they flow into the whole box
2515
03:13:11,500 --> 03:13:16,739
model thing. So if you didn't get this, it's
completely fine. Now this is too big of a
2516
03:13:16,739 --> 03:13:20,930
space, I'm going to drop that down to it too.
And of course, turn off the pink background.
2517
03:13:20,930 --> 03:13:26,319
And you know what, I switched that, but I
think a two and two looks a little bit better,
2518
03:13:26,319 --> 03:13:30,079
just to make this spacing completely equal.
I think it'll look better in the long run
2519
03:13:30,079 --> 03:13:33,420
if we do that. So there we go. I think that
is great for my featured article, everything
2520
03:13:33,420 --> 03:13:39,100
is good there, then we're going to jump into
styling this one here. And this is where we
2521
03:13:39,100 --> 03:13:42,189
had that trick that I talked about. And actually,
you know, I think they would do better in
2522
03:13:42,189 --> 03:13:46,579
its own video, because it's a little bit weird.
And I want to be able to focus on it or find
2523
03:13:46,579 --> 03:13:49,630
this video again, if you need to reference
it. So I'll see you in the next video, we'll
2524
03:13:49,630 --> 03:13:53,699
we'll take a look at how we can change the
order of the content in there to match the
2525
03:13:53,699 --> 03:14:00,810
design where the image is actually on top.
And when we look at this one, the text is
2526
03:14:00,810 --> 03:14:04,310
what we currently have. And so this image
on the left is what we currently have. And
2527
03:14:04,310 --> 03:14:07,350
we're aiming something that looks a little
bit more like this. And you can see there's
2528
03:14:07,350 --> 03:14:10,720
a pretty big difference between the two of
them right now with the order of everything.
2529
03:14:10,720 --> 03:14:14,279
And I said there's a good reason for that.
So in this one, we're just going to fix the
2530
03:14:14,279 --> 03:14:18,999
order of it, then we're going to worry about
positioning things a little bit within that
2531
03:14:18,999 --> 03:14:23,819
space. If we come down and we take a look.
Let's go back to our markup here and come
2532
03:14:23,819 --> 03:14:29,629
down to our recent articles. So we've done
is created our article recent. inside of our
2533
03:14:29,629 --> 03:14:34,569
article recent we have the main and we have
the recent secondary. Now this is gonna be
2534
03:14:34,569 --> 03:14:38,220
really useful, we get to the big screen sizes
because we want two columns. That's the main
2535
03:14:38,220 --> 03:14:42,710
reason I created these two separate divs is
so at large screens, we can have the two columns.
2536
03:14:42,710 --> 03:14:47,310
Right now though, we only have one column
because we're on small screens, but we need
2537
03:14:47,310 --> 03:14:52,669
to rearrange the order of everything. So what
I want to do is I want to give let's come
2538
03:14:52,669 --> 03:14:58,260
up so we'll come over here to our styles and
we can do our article. Recent with display
2539
03:14:58,260 --> 03:15:03,609
flex, we can change the order but First, when
I do display flex, it has created two columns.
2540
03:15:03,609 --> 03:15:07,539
So I want you to go ahead now and change that
back. So it wouldn't be two columns, I want
2541
03:15:07,539 --> 03:15:15,239
them to stack one on top of each other. So
we do that with our flex direction and switch
2542
03:15:15,239 --> 03:15:20,859
that over to a column. And now we have it
back pretty much exactly how we had it before.
2543
03:15:20,859 --> 03:15:24,890
But now we can play around with ordering.
And this is pretty cool. So what I'm going
2544
03:15:24,890 --> 03:15:31,079
to do is to change the order of something,
we go and we do it on the child itself. So
2545
03:15:31,079 --> 03:15:41,039
we have our article, recent main, and we had
the article, recent secondary. And on different
2546
03:15:41,039 --> 03:15:46,760
things within a flex, you can literally apply
an order to them. So if I said order two,
2547
03:15:46,760 --> 03:15:52,499
and I can come on this and say order. One,
it's going to switch the order of them, you
2548
03:15:52,499 --> 03:15:55,859
might have even noticed that the order of
it like sort of jumped around. So we're going
2549
03:15:55,859 --> 03:16:00,409
to take a really quick look, you can see that
it actually has changed our images on top
2550
03:16:00,409 --> 03:16:04,439
and everything else is on the bottom. And
that's awesome. That's super cool, right?
2551
03:16:04,439 --> 03:16:10,510
So why would we do this? Again, it's to be
focused on keeping the markup making more
2552
03:16:10,510 --> 03:16:15,779
sense and the logical order here, as if if
there was no CSS that loaded in so somebody
2553
03:16:15,779 --> 03:16:20,709
could still read it in a way that makes sense,
as if there's no CSS. And if we want to make
2554
03:16:20,709 --> 03:16:25,709
visual changes, we can, if we want to make
visual reordering, we can because we have
2555
03:16:25,709 --> 03:16:29,310
a hierarchy that we were following, that still
is drawing the eye to the right place, if
2556
03:16:29,310 --> 03:16:34,079
the CSS were to fail, it would make a lot
more sense the order that we see it in here.
2557
03:16:34,079 --> 03:16:37,380
Now, closer to when you are the first it's
going to come you're literally saying this
2558
03:16:37,380 --> 03:16:40,520
should be first this should be second, this
should be third, just for fun, if you wanted
2559
03:16:40,520 --> 03:16:43,619
to, you could try doing what would happen
if I gave it zero, well guess what it means
2560
03:16:43,619 --> 03:16:48,760
it's smaller than one. So it's, it's going
first. Or then what happens if I give this
2561
03:16:48,760 --> 03:16:54,189
a negative one? Well, that's smaller now.
So it goes first. So it's the smaller your
2562
03:16:54,189 --> 03:16:58,600
number, the earlier it is, and you could have
100 items, and you could give them all an
2563
03:16:58,600 --> 03:17:03,100
order. And that would be a nightmare to control
and to set up. But if that's what floats your
2564
03:17:03,100 --> 03:17:08,220
boat, go for it. But I'm going to stick with
my two and a one. If you have two things that
2565
03:17:08,220 --> 03:17:12,399
have equal order, they're going to go in the
order, they were originally in the markup.
2566
03:17:12,399 --> 03:17:16,709
So they're going to follow whatever they had
here because they have the same value. So
2567
03:17:16,709 --> 03:17:20,970
if you don't apply anything, now we'll switch
this one back to a two, it might even be worth
2568
03:17:20,970 --> 03:17:26,319
putting a comment in your code just to explain
why you're bothering to do this. If you think
2569
03:17:26,319 --> 03:17:29,880
it's not clear enough, or if you'd be coming
back later, and maybe think you might be confused
2570
03:17:29,880 --> 03:17:34,579
by something like that. This lesson is focused
really on order. But I do want to just finish
2571
03:17:34,579 --> 03:17:38,760
up a little bit on here. So the other thing
I want to do is on my article recent just
2572
03:17:38,760 --> 03:17:44,689
add a little bit of margin bottom to them
have say to em to create that space here,
2573
03:17:44,689 --> 03:17:48,479
just so it's not sticking to the image of
the next one that we have in there. Because
2574
03:17:48,479 --> 03:17:53,390
if not, it doesn't look very nice. So just
adding in that empty space is a good thing.
2575
03:17:53,390 --> 03:17:57,109
And again, go with a bigger margin than you
might expect. We do have a layout to be basing
2576
03:17:57,109 --> 03:18:01,130
things on if you're looking back at your layout
as well. The last thing while we're here,
2577
03:18:01,130 --> 03:18:04,449
though, is you might be going well, you know,
we just added some space here. But the last
2578
03:18:04,449 --> 03:18:08,529
thing we might you might be wondering about
is this gigantic space that we're getting
2579
03:18:08,529 --> 03:18:14,459
here. Part of it is we have our h2 here that
has a margin top and we have this which we
2580
03:18:14,459 --> 03:18:19,260
added a big margin bottom on, and that's causing
some problems. And you might be going well
2581
03:18:19,260 --> 03:18:22,529
shouldn't those margins be collapsing, and
then normally, they would be collapsing. But
2582
03:18:22,529 --> 03:18:27,600
there's something weird with Flexbox and collapsing
margins, they don't collapse anymore. That's
2583
03:18:27,600 --> 03:18:31,300
only for the direct children. So I'm not going
to get too much into that we're definitely
2584
03:18:31,300 --> 03:18:36,430
going to run into more situations with it.
But we need the fix for this for the for this
2585
03:18:36,430 --> 03:18:41,449
little timeframe anyway is the fix which we
need to do on our site at large. Anyways,
2586
03:18:41,449 --> 03:18:47,539
I'm just gonna scroll all the way up to my
h1 h2 h3 here and say that it should have
2587
03:18:47,539 --> 03:18:52,340
a margin top of zero because we're going to
run into other issues with that, if not anyway,
2588
03:18:52,340 --> 03:18:56,339
so we go and take a look at that just sort
of sucks everything up a little bit closer
2589
03:18:56,339 --> 03:19:00,869
and looks a little bit nicer. I'm going to
explore how you could potentially get that
2590
03:19:00,869 --> 03:19:05,640
to be even closer. When we look at the media
query in the next one where we're going to
2591
03:19:05,640 --> 03:19:11,359
pull this over to the right side and suck
that up even more. That's an exploration video
2592
03:19:11,359 --> 03:19:17,609
more than a best practice video, but we'll
see that consequence didn't notice that there
2593
03:19:17,609 --> 03:19:22,339
was one unintended consequence didn't notice
before, which was we got rid of the spacing
2594
03:19:22,339 --> 03:19:26,779
on our titles, and that got this stuck on
this. We'll fix this in this video as well.
2595
03:19:26,779 --> 03:19:31,899
But the main focus will be here, like I mentioned,
getting it to pop on over to this site at
2596
03:19:31,899 --> 03:19:35,609
certain sizes. The way I'm going to do it
now the reason I'm saying it's not a best
2597
03:19:35,609 --> 03:19:41,350
practice video as much as a exploration video
is because if you had a really long title,
2598
03:19:41,350 --> 03:19:45,799
this would cause some problems. And there's
the potential for overlapping but I just want
2599
03:19:45,799 --> 03:19:49,869
to show you something that we haven't looked
at yet. It's something that I try and avoid
2600
03:19:49,869 --> 03:19:54,629
when I can but I want to show it to you anyway
and I think is fun for the layout purposes
2601
03:19:54,629 --> 03:19:59,520
on this one and something that's worth exploring
because while you try and avoid it, it's good
2602
03:19:59,520 --> 03:20:04,040
to know that It is a possibility. And that
is negative margins. So I'm gonna go all the
2603
03:20:04,040 --> 03:20:08,699
way down to my layout area. And we're gonna
go all the way down until we find my articles.
2604
03:20:08,699 --> 03:20:12,430
There we go. And I'm going to create a new
media query, because we're going to be dealing
2605
03:20:12,430 --> 03:20:18,600
with these two, pretty much. So at media,
as far as the size of where do I create this
2606
03:20:18,600 --> 03:20:24,069
media query for, don't create media queries
based on the size of certain devices or set
2607
03:20:24,069 --> 03:20:28,020
devices, because then you can always do things
that you want to do, or those devices, you
2608
03:20:28,020 --> 03:20:31,300
know, people will make too many media queries,
because they're trying to match certain devices
2609
03:20:31,300 --> 03:20:34,959
when they don't need one, or in this case,
I'm trying to really base it on my layout,
2610
03:20:34,959 --> 03:20:38,779
I'm sort of just guessing at the size, we're
gonna tweak it a little bit as we go. So I'm
2611
03:20:38,779 --> 03:20:43,919
going to do 500 pixels for now. And let's
see if you see how it goes from there. So
2612
03:20:43,919 --> 03:20:51,699
inside my media query, what I want to do is
select my article recent main, and I'm going
2613
03:20:51,699 --> 03:20:58,319
to give this a margin. Top of negative, I
don't know what's out with negative one M
2614
03:20:58,319 --> 03:21:03,029
and just see how that affects things. So you
can see they sort of gotten a little closer
2615
03:21:03,029 --> 03:21:07,910
together, let's just try changing that maybe
to negative two, insert seeing these are starting
2616
03:21:07,910 --> 03:21:12,090
to overlap, and we can bring that maybe up
to a whole negative three. And they're starting
2617
03:21:12,090 --> 03:21:15,669
to line up how we want them to I'm going to
switch that to a 2.5 because I think it's
2618
03:21:15,669 --> 03:21:20,670
gonna be bang on how I want the top of the
text is sort of lining up. Now, as I mentioned,
2619
03:21:20,670 --> 03:21:26,810
this can create text overlap, so it's probably
not a best practice, overall cure. Yeah, so
2620
03:21:26,810 --> 03:21:29,739
this is my longest one. So I'm gonna base
it on this title. But what would happen if
2621
03:21:29,739 --> 03:21:33,299
you had a really long title, it would break
this whole layout. So I'm going to show you
2622
03:21:33,299 --> 03:21:37,620
how we can do it with a negative margin. So
you know, if I bring this up really big, you
2623
03:21:37,620 --> 03:21:41,850
can see it's pulling it up on top of other
things. And it's one of the problems with
2624
03:21:41,850 --> 03:21:46,799
negative margins. But it is important to know
you can have a negative margin because sometimes
2625
03:21:46,799 --> 03:21:51,439
it does come into use, and it is useful to
have. So that is perfect. Now the other thing
2626
03:21:51,439 --> 03:21:56,729
I'm going to do in this media query is do
my article info, and say there's a text align
2627
03:21:56,729 --> 03:22:02,770
to the right. And there we go, we have the
layout that I wanted, where we have those
2628
03:22:02,770 --> 03:22:06,590
going like that. Now the problem is, where's
the media query coming in, where's 550 pixels,
2629
03:22:06,590 --> 03:22:12,549
so we're going to shrink, and it's really,
really close. But on this one, it's looking
2630
03:22:12,549 --> 03:22:16,949
perfect. So you know, it's one of those ones
where you have to judge it by eye a little
2631
03:22:16,949 --> 03:22:21,659
bit, I'm going to pump it up to 550, just
because I don't want those to get so close
2632
03:22:21,659 --> 03:22:25,899
to each other. So it gives us this small little
range where we have two columns, and then
2633
03:22:25,899 --> 03:22:29,199
we're pops over back to the big layout, where
we're gonna have to change what that looks
2634
03:22:29,199 --> 03:22:33,999
like anyway. So that is how we can go and
do something like that with a little bit of
2635
03:22:33,999 --> 03:22:39,510
hackery to give herself this fake two column
look based on the way our markup is. But again,
2636
03:22:39,510 --> 03:22:43,279
make sure you keep this really, really simple
because it's keeping cooking simple. But if
2637
03:22:43,279 --> 03:22:50,430
this was how to keep your cooking simple,
all of a sudden, I'm a little worried. We
2638
03:22:50,430 --> 03:22:55,359
have overlap, and it's causing problems. So
while negative margins can be fun for creating
2639
03:22:55,359 --> 03:22:59,319
cool layouts, or cool effects, sometimes and
sometimes you want overlapping content, it's
2640
03:22:59,319 --> 03:23:02,880
always possible, you want two things to sort
of overlap. And there's other ways of doing
2641
03:23:02,880 --> 03:23:06,899
it with positioning as well, which we're going
to explore later. But just when you use the
2642
03:23:06,899 --> 03:23:11,359
negative margin be very, very aware that this
is a possibility. So I think what I'm going
2643
03:23:11,359 --> 03:23:15,020
to do is while we've explored it, what we've
seen it if you want to sort of rebuild this
2644
03:23:15,020 --> 03:23:18,829
on your own at one point, and keep it in your
code, because I do think it looks really nice
2645
03:23:18,829 --> 03:23:24,010
with how I've set this up, it's just not something
we can do in a responsible way. So we've looked
2646
03:23:24,010 --> 03:23:28,529
at how to do it. But now we're just going
to take it all off. Because I think it's going
2647
03:23:28,529 --> 03:23:33,430
to cause more problems in the long run. And
it's really important that you keep your code
2648
03:23:33,430 --> 03:23:38,520
as functional as possible, and that it can
accommodate for all these situations. So if
2649
03:23:38,520 --> 03:23:41,739
you're ever putting together a demo site,
make sure you don't only use short text, it's
2650
03:23:41,739 --> 03:23:45,500
really if you're doing a business card template,
don't use a really short name, KEVIN POWELL
2651
03:23:45,500 --> 03:23:48,959
is not a good name to use if you want to get
a really, really long name on the template
2652
03:23:48,959 --> 03:23:53,369
to make sure that he can work with super long
names. And it's not running into issues. So
2653
03:23:53,369 --> 03:23:57,430
the same thing here, we you want to test the
short titles and long titles to make sure
2654
03:23:57,430 --> 03:24:04,300
everything will work with your code. now is
use a really, so what we're going to do now
2655
03:24:04,300 --> 03:24:09,470
is use a really interesting property called
object fit. It's a relatively new properties
2656
03:24:09,470 --> 03:24:13,810
as far as properties go. And it is really,
really awesome. It's actually something that
2657
03:24:13,810 --> 03:24:17,590
existed for background images, which we haven't
even looked at yet, which is crazy. We're
2658
03:24:17,590 --> 03:24:20,890
doing all this cool stuff, we haven't even
done a background image yet, I'm only going
2659
03:24:20,890 --> 03:24:24,540
to do it inside the media query. Because I
think the screen sizes, I just want to see
2660
03:24:24,540 --> 03:24:29,029
my complete image. I think that looks nice
that we have a nice big image like that. But
2661
03:24:29,029 --> 03:24:32,520
when I get to these two columns, I don't want
my image to be so tiny, I want to I want to
2662
03:24:32,520 --> 03:24:37,289
make it taller, but I don't if I make this
taller, it's also going to have to be wider
2663
03:24:37,289 --> 03:24:40,979
because we're you know, we're keeping the
image in proportion. I'm going to cheat a
2664
03:24:40,979 --> 03:24:46,310
little here. These are article images, Article
image, I think is what I call it. I'm going
2665
03:24:46,310 --> 03:24:52,140
to give them a width of 100%. But I'm in the
height of 300% just for fun and to show you
2666
03:24:52,140 --> 03:24:56,789
what happens. So we can look at the super
stretch there so overlapping each other which
2667
03:24:56,789 --> 03:25:01,129
is a bit of a problem. But we can see that
these images are actually Super stretched
2668
03:25:01,129 --> 03:25:06,970
out. So I can't make my images taller without
the risk of stretching them like this, unless
2669
03:25:06,970 --> 03:25:12,779
we bring in something called object fit. In
object fit, we have a few different options,
2670
03:25:12,779 --> 03:25:16,899
the one that you're probably always going
to use is called cover, when we use cover
2671
03:25:16,899 --> 03:25:22,729
when it's actually going to do is it's gonna
crop my image inside of that space. So let's
2672
03:25:22,729 --> 03:25:27,930
fix this to be a little bit more of a realistic
number. Let's put like 400 pixels here. And
2673
03:25:27,930 --> 03:25:31,681
you can see it's cutting off the sides of
my image, my image is much bigger, my image
2674
03:25:31,681 --> 03:25:36,189
should look like this. This is what the original
one looked like right here. Whereas on this
2675
03:25:36,189 --> 03:25:41,149
version here, I can see that it's cropping
the image. Whereas if I turn off the object
2676
03:25:41,149 --> 03:25:45,379
fit cover, it's squishing the image. And this
looks terrible. I never want to see this on
2677
03:25:45,379 --> 03:25:49,899
a website, if you do this on a website, you
show it to me, I won't be proud of myself,
2678
03:25:49,899 --> 03:25:54,250
because I didn't teach you properly, I made
a mistake if you do this, so do not squish
2679
03:25:54,250 --> 03:25:59,729
your images. But this object fit cover, it
saves us it lets us pull off controlling the
2680
03:25:59,729 --> 03:26:03,659
size of an image. Now the one thing is it
will crop your image. So well these two are
2681
03:26:03,659 --> 03:26:07,140
looking great here, we're sort of we have
this little leaf sticking out the side, it
2682
03:26:07,140 --> 03:26:13,932
isn't ideal. Now one thing you can do is you
can also do an object position. And I can
2683
03:26:13,932 --> 03:26:19,289
say left. And what that means is it's keeping
the left side of my imaging instead of the
2684
03:26:19,289 --> 03:26:23,210
center of the image, which is the default,
but now I've ruined this image. And I probably
2685
03:26:23,210 --> 03:26:27,529
ruin that image as well, because it's keeping
the left side and left side of this. So we're
2686
03:26:27,529 --> 03:26:31,970
just seeing like this part of my image here
right now, which we don't want, that doesn't
2687
03:26:31,970 --> 03:26:37,169
look very good. So for this one, I am going
to leave it as just the object fit cover,
2688
03:26:37,169 --> 03:26:40,850
I'm not going to bother with my object position.
But I do want you to be aware that that is
2689
03:26:40,850 --> 03:26:46,140
an option. And I think I'm going to bring
this down to like 250 pixels. And I'm also
2690
03:26:46,140 --> 03:26:52,279
going to give this the minimum height of 250
pixels. If it needs to get bigger, for some
2691
03:26:52,279 --> 03:26:57,520
reason, sure, why not. But I want to make
sure, at minimum, the height is 250 pixels.
2692
03:26:57,520 --> 03:27:01,689
And I think that looks a little bit closer
to what we had in our layout. Maybe we could
2693
03:27:01,689 --> 03:27:06,850
make that 300 instead of 250. You can see
I think at the smaller screens, that it's
2694
03:27:06,850 --> 03:27:10,879
looking pretty good, it's getting narrow,
it has a nice aspect ratio to it. And then
2695
03:27:10,879 --> 03:27:15,339
as it gets bigger, I'm pretty happy with that,
if you'd prefer a different number, you can
2696
03:27:15,339 --> 03:27:18,770
play around with it a little bit, and find
something that you think looks a little bit
2697
03:27:18,770 --> 03:27:22,669
nicer, it's completely up to you. But I'm
gonna stick with that, I think that's a really
2698
03:27:22,669 --> 03:27:27,589
cool property, a nice little trick for letting
us bring in one image in two different places
2699
03:27:27,589 --> 03:27:31,890
and having them cropped completely differently.
And having it work at the other screen size.
2700
03:27:31,890 --> 03:27:36,409
And it's still showing up in here. So like
this is the same image that we have here,
2701
03:27:36,409 --> 03:27:40,050
which is really, really cool and handy that
we can do that all with one image instead
2702
03:27:40,050 --> 03:27:43,879
of having to load in three different versions
of the same image. Now, sometimes you might
2703
03:27:43,879 --> 03:27:48,209
want to do that there are ways of actually
doing loading in different images based on
2704
03:27:48,209 --> 03:27:52,140
different screen sizes. But it's a nice little
trick early on. While we're just getting our
2705
03:27:52,140 --> 03:27:58,390
feet wet with all of this, this is a nice
easy way to be able to do a problem here,
2706
03:27:58,390 --> 03:28:02,299
we're fine. Let's start by fixing this problem
here we're finding simplicity and life is
2707
03:28:02,299 --> 03:28:07,709
stuck to the top, you get 100% do this is
the margin top somewhere here just to push
2708
03:28:07,709 --> 03:28:12,619
things down. But I like trying to use margin
bottoms as much as possible to create space,
2709
03:28:12,619 --> 03:28:16,079
instead of mixing up margin top sometimes
the margin bottom Other times, there's always
2710
03:28:16,079 --> 03:28:19,339
going to be exceptions, there's always times
where maybe you won't do that. But I think
2711
03:28:19,339 --> 03:28:21,760
this makes the most sense. Because you don't
know if you're always gonna have a title as
2712
03:28:21,760 --> 03:28:25,109
your very first thing, maybe you have something
else that's actually coming up here as the
2713
03:28:25,109 --> 03:28:30,909
very first thing. So I think the best course
of action is actually to put a margin bottom
2714
03:28:30,909 --> 03:28:35,659
on this rather than having a margin top on
this because again, maybe another page, the
2715
03:28:35,659 --> 03:28:39,980
first thing will be an image or it'll be something
other than your your title here, I think it's
2716
03:28:39,980 --> 03:28:43,560
just a bit more robust, doing that. So this
doesn't even have to go anywhere, you just
2717
03:28:43,560 --> 03:28:48,609
do this on our nav nav nav header, I think
we have a header there, we do. So we can just
2718
03:28:48,609 --> 03:28:54,760
come on here and add a margin bottom of I'll
do three m to give us a very generous space,
2719
03:28:54,760 --> 03:28:59,180
because so the spacing here is here looks
more or less equal, I think it just looks
2720
03:28:59,180 --> 03:29:02,589
nice and balanced. If you'd want that to be
too I wouldn't argue with you, I think you
2721
03:29:02,589 --> 03:29:06,669
could pull that off as well. So that fixes
that. But the more important thing for this
2722
03:29:06,669 --> 03:29:12,119
video is, while our recent articles are looking
good at small screen sizes, when we get to
2723
03:29:12,119 --> 03:29:17,089
big screen sizes, we want this to become a
two column layout. That just looks quite a
2724
03:29:17,089 --> 03:29:20,419
bit different. So let's go and do that right,
go all the way down to the bottom because
2725
03:29:20,419 --> 03:29:24,499
I'm in my article section. And I want to create
a media query. So I'm going to ask you to
2726
03:29:24,499 --> 03:29:28,859
create your media query first on here and
actually see if you can remember how to turn
2727
03:29:28,859 --> 03:29:33,289
it from a one column into a two column all
on your own. I'm going to use the same breakpoint
2728
03:29:33,289 --> 03:29:37,529
that I used for my navigation here because
I want everything changing at the same time.
2729
03:29:37,529 --> 03:29:41,779
I think it's a bit more consistent when you
do that way. Instead of just having all these
2730
03:29:41,779 --> 03:29:45,709
random different numbers throughout. Of course,
that does depend on the layout. You saw in
2731
03:29:45,709 --> 03:29:49,930
the last video, I use a different number for
my breakpoint, but in general, I try and stick
2732
03:29:49,930 --> 03:29:56,471
with the same breakpoints just for consistency
and it makes my life a little easier to Did
2733
03:29:56,471 --> 03:29:59,629
you get it to work? I hope you did. So I'm
going to come in here and create my media
2734
03:29:59,629 --> 03:30:04,959
query. So It's an ad media, I want my parentheses
and then my curly braces, I'm gonna come back
2735
03:30:04,959 --> 03:30:11,209
up into here and do my min width 675. And
now we can come down here and add in what
2736
03:30:11,209 --> 03:30:14,949
we want. Now, don't do the mistake where we
just start writing stuff. Obviously, I've
2737
03:30:14,949 --> 03:30:18,669
done that a million times, but we have to
choose the selector we want first. So the
2738
03:30:18,669 --> 03:30:23,699
selector I want for now is article recent.
Now, we've already said that article recent
2739
03:30:23,699 --> 03:30:27,709
is display flex, so we don't have to declare
it again, if you did that, where you put display
2740
03:30:27,709 --> 03:30:31,270
flex, here, it's fine, it's not going to do
anything, it doesn't cause any problems. But
2741
03:30:31,270 --> 03:30:35,060
since we already have declared it, here is
the general rule, we don't have to read Eclair
2742
03:30:35,060 --> 03:30:39,500
it again, once we're inside of our media query
here, all they want to do is redefine my flex
2743
03:30:39,500 --> 03:30:44,449
direction, so I can do my flex direction.
And his column, I'm going to switch that over
2744
03:30:44,449 --> 03:30:50,171
to a row. And right away, we should see now
we have two rows of content in here. Now we
2745
03:30:50,171 --> 03:30:58,339
can come on to my article, recent main, we're
gonna want to do a little bit of work on that,
2746
03:30:58,339 --> 03:31:04,439
and my article, recent, secondary, and do
a little bit of work on that one as well.
2747
03:31:04,439 --> 03:31:07,659
So I want the secondary one to actually be
pretty small. So I'm going to give this one
2748
03:31:07,659 --> 03:31:12,799
a width of about 25%. If I go and look though,
it's gonna be tiny, tiny, tiny, tiny and this
2749
03:31:12,799 --> 03:31:19,159
is Flexbox, trying to be smart about things,
because it knows this one should be 100%.
2750
03:31:19,159 --> 03:31:25,609
Why is that 100%? Though, think about it,
why is this one trying to be 100%? It's trying
2751
03:31:25,609 --> 03:31:30,049
to be 100%, because we never gave it a default
width. And by default, any block level element
2752
03:31:30,049 --> 03:31:35,579
will be set to 100%. So 100 and 125. It can't
fit in this area. So it's doing its best to
2753
03:31:35,579 --> 03:31:39,260
go Okay, well, this one's allowed to be smaller.
So I'm shrinking it way down is sort of how
2754
03:31:39,260 --> 03:31:43,439
Flexbox thinks we're going to get more into
actually what's happening with this a little
2755
03:31:43,439 --> 03:31:47,619
bit later on. But for now, what I'm just going
to do is come on here and say this one has
2756
03:31:47,619 --> 03:31:53,659
a width of 70%. And if you go and look, the
only problem is we have all this leftover
2757
03:31:53,659 --> 03:31:57,159
space right here, I don't want leftover space
here, I want that leftover space to be in
2758
03:31:57,159 --> 03:32:01,080
between the two of them. How can we do that?
Do you remember, go ahead and do it if you
2759
03:32:01,080 --> 03:32:07,850
do. So to put the space between them, instead
of all the way in the right, I can come on
2760
03:32:07,850 --> 03:32:15,689
here and do a justify content space between
my doing that. Now I get the gap coming here
2761
03:32:15,689 --> 03:32:21,169
instead, you might say it's not reaching the
end here. But it's because the lines are breaking,
2762
03:32:21,169 --> 03:32:25,409
if I have a long word that can't fit here,
it's just going to go down to that side. So
2763
03:32:25,409 --> 03:32:30,029
it really is making it all the way out to
the edge, it just really depends on the the
2764
03:32:30,029 --> 03:32:33,649
text that you have in there. And the size
of the screen that you have it, sometimes
2765
03:32:33,649 --> 03:32:37,499
it'll look like it's closer. And other times
it might look in again, it's just based on
2766
03:32:37,499 --> 03:32:42,520
where the words are breaking. I actually don't
like that breakdown of stuff so much. So I'm
2767
03:32:42,520 --> 03:32:46,209
going to make this one a little bit bigger,
I'm gonna push you up to 30. And I think I'll
2768
03:32:46,209 --> 03:32:51,989
bring this one down to like a 68, or 67. Because
I think that space can be a little bit tighter
2769
03:32:51,989 --> 03:32:56,089
like that. So cool. That's looking pretty
good. We have my two columns that are working.
2770
03:32:56,089 --> 03:33:00,479
And when we get to the small screen sizes,
everything is stacking and our order is looking
2771
03:33:00,479 --> 03:33:05,510
fine there. I know our order is looking fine
here. So everything is fantastic. Except for
2772
03:33:05,510 --> 03:33:09,629
one thing. And the one thing that's not fantastic
is the order here is not good. If we come
2773
03:33:09,629 --> 03:33:13,630
and take a look, when we're a big screens,
we want our image all the way at the top,
2774
03:33:13,630 --> 03:33:17,749
and we want to have an info here, then we
want to have the title. And that's just not
2775
03:33:17,749 --> 03:33:21,659
what we have going on here because I put it
all in the wrong order when I did the markup.
2776
03:33:21,659 --> 03:33:26,109
So what I want you to do is we can work inside
of this media query, I want you to play around
2777
03:33:26,109 --> 03:33:30,680
and get that to work on large screens to be
in the right order for everything. Of course,
2778
03:33:30,680 --> 03:33:33,419
once you've done that, I'll go ahead and look
at how we can do it. But it's all things we
2779
03:33:33,419 --> 03:33:40,640
already know how to do. So go ahead and tackle
that. So I hope you found it if you didn't
2780
03:33:40,640 --> 03:33:43,619
Don't worry too much about it because it was
trying to trick you a little bit with this
2781
03:33:43,619 --> 03:33:48,569
one and make you think a little bit. So if
we come and look at my markup, we have the
2782
03:33:48,569 --> 03:33:52,369
featured article here. My feature article
has everything we need in it. But we want
2783
03:33:52,369 --> 03:33:57,209
to change the order of these and see you did
article title just for fun. If I came down
2784
03:33:57,209 --> 03:34:03,979
to here and I say article, title, order 99.
That should push it all the way to the end
2785
03:34:03,979 --> 03:34:08,909
should become the last thing everywhere. But
nothing happens. It's not actually changing.
2786
03:34:08,909 --> 03:34:13,709
So if you were playing around with the order
of things, and you're like, why isn't it changing?
2787
03:34:13,709 --> 03:34:18,970
It's normal. The reason it's not changing
is we can't use order unless we have display
2788
03:34:18,970 --> 03:34:27,689
flex on something already. So what I need
to do is article featured display flex. But
2789
03:34:27,689 --> 03:34:32,180
of course when I do that, it just causes chaos
because now everything is becoming a column
2790
03:34:32,180 --> 03:34:38,430
I even got some so it's just a mess. So I
want you to fix that now. And once you've
2791
03:34:38,430 --> 03:34:41,749
done that, if you weren't able to get the
order working, go in and put the order on
2792
03:34:41,749 --> 03:34:47,419
it and we'll take a look at the rest of it
together in a second. Alright, so fixed the
2793
03:34:47,419 --> 03:34:53,159
first thing was the flex direction. We want
that to be a not a row a column. And that
2794
03:34:53,159 --> 03:34:56,789
should at least fix the craziness that was
going on before and everything sort of falls
2795
03:34:56,789 --> 03:35:05,430
back to how it was more or less and then what
we can Do my article image has an order of
2796
03:35:05,430 --> 03:35:09,619
negative one. Now I'm actually going to make
this a negative two, because I also want to
2797
03:35:09,619 --> 03:35:17,959
give my article info and order of negative
one, to pull it up to in between those two.
2798
03:35:17,959 --> 03:35:23,539
Because if I don't include that, it's first
going to be my image, then it's my title,
2799
03:35:23,539 --> 03:35:28,810
then it's this, and I want this to be on top
there, whoops, on my console, so I can have
2800
03:35:28,810 --> 03:35:34,489
that negative one on there. So first, I have
my image, then I have this, then I have my
2801
03:35:34,489 --> 03:35:38,000
title, and then I can get into the rest of
it. And it's starting to look pretty good.
2802
03:35:38,000 --> 03:35:42,720
I'm pretty happy. Overall, with how this is
starting to come together, I think it's looking
2803
03:35:42,720 --> 03:35:49,790
really the Adobe XD for our widgets, we have
the sidebar widgets that we created here.
2804
03:35:49,790 --> 03:35:54,379
So we have the div class sidebar widget, and
we want to make them look a little bit like
2805
03:35:54,379 --> 03:35:58,830
this. So they have a really big thick border
on them. The color is not this dark gray is
2806
03:35:58,830 --> 03:36:02,419
a lighter gray than that, I'll let you experiment
a little bit. Or if you link to the Adobe
2807
03:36:02,419 --> 03:36:07,029
XD file, you should be able to get the exact
color that that is, as well as the exact thickness,
2808
03:36:07,029 --> 03:36:10,640
I'm just going to estimate it and hope for
the best. The one thing I'm a little bit worried
2809
03:36:10,640 --> 03:36:15,549
about with our current layout, though, is
this space is already pretty narrow here.
2810
03:36:15,549 --> 03:36:19,659
And it's going to get a little bit tighter
once we add that MP once we add the border
2811
03:36:19,659 --> 03:36:23,649
and that spacing inside of it. So what I'm
going to do is I'm actually going to right
2812
03:36:23,649 --> 03:36:29,310
now change the size of those before we get
into those widgets. Because I am scared we're
2813
03:36:29,310 --> 03:36:33,569
going to run out a room for them, I just think
it's gonna be a little bit too tight. So here,
2814
03:36:33,569 --> 03:36:40,419
I'm going to change this width down to a 70.
And this one up to a 25. I don't know what
2815
03:36:40,419 --> 03:36:43,869
might have to readjust again after but I think
it's going to help us out just by giving us
2816
03:36:43,869 --> 03:36:47,680
a little bit of extra space there. And now
what I want you to do, let's go all the way
2817
03:36:47,680 --> 03:36:52,420
back down. And I'm going to create a little
comment here saying with jets. And I want
2818
03:36:52,420 --> 03:36:56,169
you to come down and style them as much as
you can, it's using a bunch of stuff we've
2819
03:36:56,169 --> 03:37:00,839
already looked at. So go ahead and try your
best at least adding the border as well as
2820
03:37:00,839 --> 03:37:04,629
that space on the inside. And if you feel
up to it also doing the typography once again,
2821
03:37:04,629 --> 03:37:07,979
I didn't give it to you here but we know what
the fonts are, you can adjust and play with
2822
03:37:07,979 --> 03:37:12,339
the font size. If you do look at the Adobe
XD link, you will be able to get the actual
2823
03:37:12,339 --> 03:37:15,550
font size that was used, but it will be in
pixels from there. So make sure you convert
2824
03:37:15,550 --> 03:37:19,249
it over to rim. If you're not sure how to
do that you can watch when I do it, because
2825
03:37:19,249 --> 03:37:23,449
in just a few seconds after I give it to you,
I'll be doing it myself. As usual, they'll
2826
03:37:23,449 --> 03:37:30,449
try and do as much as you can and see if you
can pull it off before I take over. So I hope
2827
03:37:30,449 --> 03:37:34,510
you have a lot of success. Now let's dive
in. And it's not just widgets, it's my sidebar
2828
03:37:34,510 --> 03:37:39,529
widget. And the first thing we do is give
it the border. So I'm gonna give this 20 pixels
2829
03:37:39,529 --> 03:37:42,770
solid. And for the color, I'm just guessing
right now, but I know it's a really light
2830
03:37:42,770 --> 03:37:47,749
gray. And I know EF EF f is a light gray because
I've been doing this for a long time. So we
2831
03:37:47,749 --> 03:37:51,779
can see that it's looking pretty good. Actually,
I'm happy with that. Now they're also stuck
2832
03:37:51,779 --> 03:37:55,879
together. So I'm going to add a margin bottom
on this to help out a little bit. So margin
2833
03:37:55,879 --> 03:38:00,899
bottom, I'm going to try one M and see what
it looks like. And it's not bad, it's probably
2834
03:38:00,899 --> 03:38:04,260
a little bit too tight. So it's boosted up
to a two. But before we go and look at it
2835
03:38:04,260 --> 03:38:08,989
again, you might be going, Kevin, why are
using pixels here. But m here, borders are
2836
03:38:08,989 --> 03:38:12,520
one of the few places where I have a habit
of using pixels. Because a lot of the time
2837
03:38:12,520 --> 03:38:15,831
we have a one pixel border, maybe a two pixel
border, it's really rare that you're gonna
2838
03:38:15,831 --> 03:38:20,279
have a really big size on a border like this.
Now, as you can see here, it has happened,
2839
03:38:20,279 --> 03:38:25,140
but it's not too much. So I just fall in the
habit of using pixels because one pixel in
2840
03:38:25,140 --> 03:38:29,609
M is just not doing that. If you'd rather
set this because it's a bigger border and
2841
03:38:29,609 --> 03:38:33,720
M or M and M and that's what you did before
then by all means go for it, it would work
2842
03:38:33,720 --> 03:38:37,209
beautifully as well. And before we go and
check it out, though, I'm also going to add
2843
03:38:37,209 --> 03:38:41,489
some padding, and we'll try one aim of padding
on that. And that doesn't look too bad. I'm
2844
03:38:41,489 --> 03:38:44,850
pretty happy with how that looks. But let's
just see, when we get to the smaller screens,
2845
03:38:44,850 --> 03:38:49,629
if we run into any problems, this font size
is going to get smaller, these are getting
2846
03:38:49,629 --> 03:38:54,420
really, really narrow. But overall, nothing's
broken the image, the titles are a little
2847
03:38:54,420 --> 03:38:59,189
bit too big, the images are really, really
small. And we're sort of running into two
2848
03:38:59,189 --> 03:39:02,259
options. Now when we're making something responsive
like this, because it seemed to be working
2849
03:39:02,259 --> 03:39:06,759
super well. I think at the large screen size,
it's exactly what I want it to look like.
2850
03:39:06,759 --> 03:39:11,699
So I don't want to modify too much, we sort
of have two options. One of them is to change
2851
03:39:11,699 --> 03:39:14,590
our breakpoint. And if we do that we're going
to be going through potentially changing it
2852
03:39:14,590 --> 03:39:18,560
in multiple places. I don't really feel like
doing that because I don't want to have to
2853
03:39:18,560 --> 03:39:24,279
reconfigure a whole bunch of things. So another
option we have is to come on this and actually
2854
03:39:24,279 --> 03:39:27,759
make sure it can't get too small. Because
right now what's happening is it's clearly
2855
03:39:27,759 --> 03:39:31,079
just getting too small. Whereas these are
working fine. They're not ideal, but they're
2856
03:39:31,079 --> 03:39:36,039
working. Okay. So I think that's what I'm
going to do. So if we come on to my widget,
2857
03:39:36,039 --> 03:39:42,600
let's go and find not my widget but my sidebar.
So here we had our main and our aside, I think
2858
03:39:42,600 --> 03:39:47,259
I'm going to give this a minimum width. So
I want it ideally to be the 25% but I also
2859
03:39:47,259 --> 03:40:01,009
don't want it to get smaller than 250 pixels.
So well. It's even too big. I think There's
2860
03:40:01,009 --> 03:40:07,420
one disadvantage that when we do this, and
that's that that justify or justify content
2861
03:40:07,420 --> 03:40:11,439
space between stops having enough of an effect
on it, because at one point, when we lock
2862
03:40:11,439 --> 03:40:15,380
in that size at one point, they can actually
hit each other, because now that's locked
2863
03:40:15,380 --> 03:40:20,009
in at that minimum size of 200 pixels, which
I think is roughly the right size. Because
2864
03:40:20,009 --> 03:40:25,279
here, it doesn't look super ridiculously small,
it's borderline, maybe I could actually change
2865
03:40:25,279 --> 03:40:29,319
this breakpoint to be a little bit bigger.
But while we're here, why don't we just come
2866
03:40:29,319 --> 03:40:36,020
on the side here and add a margin left of
one M to the whole thing, which is not a lot
2867
03:40:36,020 --> 03:40:40,500
of space. But we don't want too much when
we're at this really small screen size anyway.
2868
03:40:40,500 --> 03:40:44,789
So at the big sizes, I think it's going to
look pretty good. And then we get smaller,
2869
03:40:44,789 --> 03:40:48,149
it's just going to prevent the two columns
from colliding into each other by having that
2870
03:40:48,149 --> 03:40:54,010
one mm space on the side there. So now we
get smaller. Again, maybe this is a good point
2871
03:40:54,010 --> 03:40:58,189
when we could be modifying the breakpoint
on it if we really wanted to, but I'm not
2872
03:40:58,189 --> 03:41:03,260
in not hating necessarily. And there we go.
And this comes into a really good discussion
2873
03:41:03,260 --> 03:41:08,079
about when you want to have your breakpoints.
And it's really about adjusting to the layout
2874
03:41:08,079 --> 03:41:11,930
and when things are working or not working.
So if you really don't like this, you could
2875
03:41:11,930 --> 03:41:16,479
come in and adjust your breakpoint at this
point. I'm gonna say it again, I've said I've
2876
03:41:16,479 --> 03:41:19,489
said this before, I'm gonna keep saying it.
Again, breakpoints are not device specific.
2877
03:41:19,489 --> 03:41:24,199
They are layout specific. When your layout
is breaking, when your layout is not looking
2878
03:41:24,199 --> 03:41:29,819
good. That's when you go ahead and create
a new breakpoint or adjust a breakpoint that
2879
03:41:29,819 --> 03:41:33,529
you already have. It's about your layout,
it's not about what device, it's looking at
2880
03:41:33,529 --> 03:41:38,159
hundreds, maybe 1000s of different phones.
Now, they all have a little bit of a different
2881
03:41:38,159 --> 03:41:42,589
size. There's so many tablets, there's laptops,
and these little laptops. And there's big
2882
03:41:42,589 --> 03:41:47,779
laptops, you don't know the device size somebody
is on. So don't worry about finding specific
2883
03:41:47,779 --> 03:41:52,550
numbers to use, and adjust it where your layout
is working and just make it work at the different
2884
03:41:52,550 --> 03:41:58,109
screen sizes. However you can I'm pretty happy
with this. If somebody happens to be here,
2885
03:41:58,109 --> 03:42:02,560
there might not be a million people with this
device width on it. But overall, I think I'm
2886
03:42:02,560 --> 03:42:06,100
happy with that and how the whole thing is
working, we could also allow this to get a
2887
03:42:06,100 --> 03:42:09,999
little bit wider, I just wanted to make sure
that we're limiting the max width of it. For
2888
03:42:09,999 --> 03:42:12,930
some people who are doing this tutorial on
a smaller screen, they can see it reaching
2889
03:42:12,930 --> 03:42:17,689
that maximum width. I'm gonna end this lesson
here, because I think we covered some easy
2890
03:42:17,689 --> 03:42:21,779
things with our setting that up. The last
thing we're gonna do in the next one is finishing
2891
03:42:21,779 --> 03:42:25,259
up everything in the site. So we're gonna
fix our titles, we're going to fix the order
2892
03:42:25,259 --> 03:42:30,119
on this. And the one forgotten element is
our footer all the way at the bottom, I think
2893
03:42:30,119 --> 03:42:38,359
we can knock that all out of the park really,
really quickly. So let's wrap this tiling
2894
03:42:38,359 --> 03:42:41,659
the titles, they need to be adjusted a little
bit. So let's go and do that. And let's go
2895
03:42:41,659 --> 03:42:46,619
and look at our index first. What do we call
them, we call that widget title. So this is
2896
03:42:46,619 --> 03:42:51,659
where we have an h2 that it's really useful
to have a class on. Because pretty much all
2897
03:42:51,659 --> 03:42:57,220
the styling. On our other h twos, we didn't
need to do very much on these, right, because
2898
03:42:57,220 --> 03:43:01,520
when we look back at our styles, and we go
all the way back up in our file here, a lot
2899
03:43:01,520 --> 03:43:05,640
of it is handled right here on this h2, we
set up the font family, we set up that we
2900
03:43:05,640 --> 03:43:09,149
set up the color, we set up the margin, we
did everything here. But we're still dealing
2901
03:43:09,149 --> 03:43:13,259
with an h2, this one just happens to visually
look completely different. So this is where
2902
03:43:13,259 --> 03:43:17,489
it's really really handy. To have this, we
have all of our articles stuff, let's come
2903
03:43:17,489 --> 03:43:25,090
right here, widget title. And let's give this
one a font size of one REM, the colors probably
2904
03:43:25,090 --> 03:43:30,510
Alright, but we need to change the font family
over to Ubuntu just there we go. And we also
2905
03:43:30,510 --> 03:43:38,799
want to make the font weight to be 700. Because
we want it to be not 7700, we want it to be
2906
03:43:38,799 --> 03:43:44,039
bold, I don't even know how bold 7000 might
be. So there we go, that's looking not too
2907
03:43:44,039 --> 03:43:47,640
bad. Let's just go look back at the original
design, maybe the font size can be slightly
2908
03:43:47,640 --> 03:43:52,369
bigger. But I'm gonna stick with that. I'm
pretty happy with it actually, just based
2909
03:43:52,369 --> 03:43:57,970
on looking at it visually. We want to style
these now and actually change the order of
2910
03:43:57,970 --> 03:44:01,499
things over here. So how can we do that? Let's
go and take a look back at our markup and
2911
03:44:01,499 --> 03:44:06,890
see how we did it. So we had a div of widget
recent post. And then we have the order of
2912
03:44:06,890 --> 03:44:12,100
our widget recent title, you know what I actually
think is widget recent title. So that's looking
2913
03:44:12,100 --> 03:44:15,169
good. Now these are too big. And I think these
are actually supposed to be the same size
2914
03:44:15,169 --> 03:44:21,830
as this. So let's come back up to our CSS
file here. And widget title, I think what
2915
03:44:21,830 --> 03:44:29,970
we could do is keep my widget title, but also
have my post title. Don't forget the dot and
2916
03:44:29,970 --> 03:44:36,979
give those the font size, font size of one
REM here. So we don't need to have it necessarily
2917
03:44:36,979 --> 03:44:41,209
on that one. So that it helps shrink down
those a little bit. Just visually they're
2918
03:44:41,209 --> 03:44:45,180
not as in our face. And what you need to do
is change the order of them because this should
2919
03:44:45,180 --> 03:44:48,609
be underneath the image and not on top of
the image. It doesn't look right like now
2920
03:44:48,609 --> 03:44:52,159
the spacing is all off. So we've already looked
at how we can do that when we did all those
2921
03:44:52,159 --> 03:44:59,409
other order things. Give it a try. I hope
you got it to work. If you didn't. Let's go
2922
03:44:59,409 --> 03:45:03,149
and look at our markup, the one reason you
might not have is we have this widget recent
2923
03:45:03,149 --> 03:45:08,170
post. So this widget Recent Posts needs to
have the display flex on it. So we can change
2924
03:45:08,170 --> 03:45:11,979
the order of things that are inside of it.
So I'm going to come here, I'm just going
2925
03:45:11,979 --> 03:45:17,640
to go all the way down where we have our widgets.
Because now I am looking at layout. Don't
2926
03:45:17,640 --> 03:45:25,169
forget the.at the front. And we can give this
a display of flex. And when we do that, it
2927
03:45:25,169 --> 03:45:31,499
will make columns, we don't want columns.
So flex direction, will become column. So
2928
03:45:31,499 --> 03:45:35,720
the things inside our rows, and they're stacking
on top of each other. So it goes sort of back
2929
03:45:35,720 --> 03:45:40,089
to how they were. But now we have the advantage
of having the order on these now. And realistically,
2930
03:45:40,089 --> 03:45:45,379
I might not actually switch the order on them,
like I did here, I might have just put image
2931
03:45:45,379 --> 03:45:49,350
and then title, I think it's fine in the markup
to do it that way, I just wanted you to practice
2932
03:45:49,350 --> 03:45:53,109
a little bit more and play with the order
a little bit more, since it was a new concept
2933
03:45:53,109 --> 03:46:00,350
coming into this project. so here we can say
that my widget image has an order of negative
2934
03:46:00,350 --> 03:46:04,780
one, and that should have jumped it over to
the top, there we go. So we have that we have
2935
03:46:04,780 --> 03:46:08,529
that. Now we're just missing one thing. So
we can see those here, there's these little
2936
03:46:08,529 --> 03:46:12,460
little thin lines that are coming in between
on those sets, we need a division here in
2937
03:46:12,460 --> 03:46:15,660
a division here, there is a trick though,
because this one, we don't want to do it.
2938
03:46:15,660 --> 03:46:19,749
That's okay though. For now add one here,
add one here, I'm going to show you a trick
2939
03:46:19,749 --> 03:46:26,670
to get rid of that last one. Okay, so let's
go and add those in, I'm going to do it like
2940
03:46:26,670 --> 03:46:33,449
I did before, where I'm just gonna add a border.
So we're gonna say border, one pixel solid.
2941
03:46:33,449 --> 03:46:36,770
And for the color, we'll go with that dark
Ray that we've already been using. If we go
2942
03:46:36,770 --> 03:46:41,350
and look at it, now we have a line Oh, no,
it's on all four sides, I only want it to
2943
03:46:41,350 --> 03:46:46,119
be on the bottom. So let's fix that right
away and go look, again, that's looking nice,
2944
03:46:46,119 --> 03:46:51,610
but I need a little bit of space underneath.
And I want some space in here. So we can right
2945
03:46:51,610 --> 03:46:57,079
away at a margin bottom. And we'll just go
with one m, let's see, I use a lot of training
2946
03:46:57,079 --> 03:47:01,669
round numbers, one m one and a half for M
to ram, it helps with the consistency along
2947
03:47:01,669 --> 03:47:07,089
the way. And doesn't that just we go, that
looks pretty good, I think except we don't
2948
03:47:07,089 --> 03:47:13,989
want this one here, this one is going to cause
us some problems. So instead of styling it
2949
03:47:13,989 --> 03:47:17,229
like this, so I'm going to show you a trick,
something we haven't looked at before, I'm
2950
03:47:17,229 --> 03:47:27,430
going to do a widget recent post. Last Child.
So this is another pseudo class, this is like
2951
03:47:27,430 --> 03:47:32,430
hover and active and visited. But it's saying
if it's the last child inside of something,
2952
03:47:32,430 --> 03:47:38,999
I'm gonna say border zero, and I'm gonna say
margin of zero, because we want to take that
2953
03:47:38,999 --> 03:47:43,869
margin bottom off, so it doesn't add extra
space. So I'll explain this in a second. But
2954
03:47:43,869 --> 03:47:48,359
let's go and look. And there we go. Now everything
is getting balanced out, we have a line here,
2955
03:47:48,359 --> 03:47:53,399
we have a line here, but we don't have a line
coming on this one at the bottom. So to explain
2956
03:47:53,399 --> 03:47:58,879
what this is in a little bit more detail,
let's go and look in my index. So we have
2957
03:47:58,879 --> 03:48:03,979
our widget, our widget here, and our widget
here. And this is the last child inside of
2958
03:48:03,979 --> 03:48:13,009
this parent, if I were to come and add a paragraph
here, example. And we were to come back. Now
2959
03:48:13,009 --> 03:48:17,699
that we have a another item in there, this
is no longer the last child. So this now has
2960
03:48:17,699 --> 03:48:22,930
a border on it. That's pretty fun, right?
I think that's pretty cool. So it's always
2961
03:48:22,930 --> 03:48:29,310
about the state is this, if there is a widget
recent post that happens to be the last child
2962
03:48:29,310 --> 03:48:32,390
somewhere, we're going to turn off that border
in that margin that we just added here. But
2963
03:48:32,390 --> 03:48:35,470
otherwise, they should always have it just
like when we're hovering on something. So
2964
03:48:35,470 --> 03:48:39,419
we have a normal style in a certain state.
And when our mouse is hovering on top of a
2965
03:48:39,419 --> 03:48:43,409
link, we're changing the state this instead
of looking at a mouse, it's looking at its
2966
03:48:43,409 --> 03:48:47,830
relationship to its parent and to its siblings.
So it's a really, really fun and cool pseudo
2967
03:48:47,830 --> 03:48:51,379
class that can come up on something. So let's
go and take out that extra paragraph that's
2968
03:48:51,379 --> 03:48:55,339
on here. And I'm not going to save the I'm
going to do the footer. Now I said we're going
2969
03:48:55,339 --> 03:48:58,220
to wrap up the whole thing. And then the footer
is so nice and easy. I never even put the
2970
03:48:58,220 --> 03:49:02,800
text in there. So there we go, we have our
paragraphs inside the footer. And if we go
2971
03:49:02,800 --> 03:49:07,739
and look, it's just has that text, the first
one is bold, the second one isn't. So let's
2972
03:49:07,739 --> 03:49:15,039
wrap this one up in a strong tag. And close
strong right there. And we can come into our
2973
03:49:15,039 --> 03:49:18,659
styles. I'm going to come up a little bit
here all the way to here where I was doing
2974
03:49:18,659 --> 03:49:22,140
like my header, my containers, all of that
I'm actually gonna put the footer here because
2975
03:49:22,140 --> 03:49:26,600
the footer is this really generic item. That's
just everywhere. So we're gonna give this
2976
03:49:26,600 --> 03:49:31,899
one the background of that dark blue, we're
going to give it a color. In this case, I'm
2977
03:49:31,899 --> 03:49:35,239
going to give it white for now I'm going to
come back to this color later on when we're
2978
03:49:35,239 --> 03:49:39,810
coming back in in the next module of this
course, stepping up style, because we're going
2979
03:49:39,810 --> 03:49:43,629
to show you a cool trick if you set another
color on it or want to actually you know,
2980
03:49:43,629 --> 03:49:48,299
use a color picker or getting a specific value
just to match that. That'd be cool. When we
2981
03:49:48,299 --> 03:49:53,129
do stepping up or style. I'm going to dive
a little bit deeper into this. A text align
2982
03:49:53,129 --> 03:49:57,550
center on there and some padding. We'll go
with the three M and zero because the padding
2983
03:49:57,550 --> 03:50:01,439
looks pretty big on the top and bottom and
there we go. It is Looking pretty good, the
2984
03:50:01,439 --> 03:50:05,399
homepage is all wrapped up, and we're ready
to move on to the other two pages, which are
2985
03:50:05,399 --> 03:50:11,859
going to just start by coming over to my favorites.
And some of the recent articles page, which
2986
03:50:11,859 --> 03:50:15,180
is this one here, I'm not even gonna bother
zooming in, it's so similar to this one, we
2987
03:50:15,180 --> 03:50:19,479
can knock this whole thing out without even
writing one line of CSS, we just have to literally
2988
03:50:19,479 --> 03:50:24,229
edit a little bit of markup. So for this Pedram
and do is I'm going to start by coming over
2989
03:50:24,229 --> 03:50:30,930
to my files here and clicking on new file,
and creating a page called recent hyphen posts
2990
03:50:30,930 --> 03:50:36,419
dot html. Now, this could just be recent instead
of recent posts, it's really up to you. But
2991
03:50:36,419 --> 03:50:40,359
if you're going to do recent posts, it's either
a hyphen, or underscore, make sure there's
2992
03:50:40,359 --> 03:50:44,699
no space in there. And what we want to do
is come over to my index, I'm going to do
2993
03:50:44,699 --> 03:50:49,449
Ctrl A, or Command A, if you're on a Mac,
to select everything. And then I'm going to
2994
03:50:49,449 --> 03:50:54,339
Ctrl or Command C to copy it, I'm going to
come over to my recent posts, and I'm gonna
2995
03:50:54,339 --> 03:50:58,989
paste that right in there. Because we have
everything in place that we need for this
2996
03:50:58,989 --> 03:51:04,749
page to work. The only difference between
the two layouts is this one is styled just
2997
03:51:04,749 --> 03:51:10,209
like all my other recent articles, whereas
on the homepage, it was done as a featured
2998
03:51:10,209 --> 03:51:15,509
article. So part of the reason I did this
was to show you a little bit of how CSS gets
2999
03:51:15,509 --> 03:51:20,320
reused across our pages, we don't have to
keep recreating and rewriting styles, we have
3000
03:51:20,320 --> 03:51:23,810
everything we need literally everything we
need. If this was a real page, it probably
3001
03:51:23,810 --> 03:51:27,629
be dynamic, and the content would be automatically
put in there, we might have more than four
3002
03:51:27,629 --> 03:51:33,000
posts on a page. And these two pages wouldn't
be so close to each other in terms of content,
3003
03:51:33,000 --> 03:51:37,850
but layout wise and CSS wise, they'd still
be identical to one another. So if we come
3004
03:51:37,850 --> 03:51:43,770
through, and we look, here, we have my featured
article. But I want that to be a recent article.
3005
03:51:43,770 --> 03:51:48,199
So I'm going to copy my recent article here,
Command C, paste it in here. And then I'm
3006
03:51:48,199 --> 03:51:52,799
going to start just taking little pieces.
So if you do a Command or Ctrl x, it's a cut
3007
03:51:52,799 --> 03:51:57,079
instead of a copy, I can cut that title out.
And then I can come and put that title right
3008
03:51:57,079 --> 03:52:04,560
here. I can take my image, and I can put that
image right here, I have my info. It goes
3009
03:52:04,560 --> 03:52:10,729
right there. And this paragraph, it goes right
here. Continued reading is the same in both
3010
03:52:10,729 --> 03:52:14,090
of them. So we can just delete that whole
thing and not even worry about it. And we
3011
03:52:14,090 --> 03:52:17,470
can actually see that page yet because we
haven't set up the links to be able to do
3012
03:52:17,470 --> 03:52:21,410
it. Because then the only place where those
were linking together is in the navigation.
3013
03:52:21,410 --> 03:52:24,949
And right now in my navigation, I just have
these placeholder links. So what I want you
3014
03:52:24,949 --> 03:52:29,259
to do is fix the navigation links. So you
can go back and forth when you're on one page
3015
03:52:29,259 --> 03:52:33,609
or the other page make all of the navigation
links work, except for the about page because
3016
03:52:33,609 --> 03:52:39,890
obviously we haven't done that one yet. So
we are working. So on this one, we want to
3017
03:52:39,890 --> 03:52:45,869
have our index dot HTML here and on my recent
posts, so we can add that in even though recent
3018
03:52:45,869 --> 03:52:49,939
posts, this is the page we're currently on.
And then I'll come over to my index. And I
3019
03:52:49,939 --> 03:52:53,479
want to do the exact same thing there. So
whether you're copying and pasting, or you're
3020
03:52:53,479 --> 03:52:57,259
rewriting it again, here, something that a
lot of people don't realize, or they don't
3021
03:52:57,259 --> 03:53:01,390
always think about is that you need to have
all of the links and all of your pages to
3022
03:53:01,390 --> 03:53:06,100
be updated. So that you can go back and forth
between the different pages. So if we save
3023
03:53:06,100 --> 03:53:10,839
that income, take a look at it. This is my
homepage. And if I click on recent posts,
3024
03:53:10,839 --> 03:53:15,439
or Recent Posts is working perfectly, and
everything is good there. And we haven't written
3025
03:53:15,439 --> 03:53:19,970
one line of CSS, and we just finished a second
page. So this shows you once you're finished
3026
03:53:19,970 --> 03:53:23,949
one page, it's exaggerating a little bit,
you often have to write a little bit of extra
3027
03:53:23,949 --> 03:53:27,470
CSS. But in this case, we didn't have to write
any at all, we're going to go on to the About
3028
03:53:27,470 --> 03:53:30,779
Me page, which is a little bit different from
the rest of them. So we might have to write
3029
03:53:30,779 --> 03:53:38,631
a few extra styles. But overall, it is really
similar. There isn't a lot for the amount
3030
03:53:38,631 --> 03:53:42,300
Me page, there isn't a lot to do once again,
but there is a little bit that we need to
3031
03:53:42,300 --> 03:53:48,699
do. So I'm going to give you the link to the
Adobe XD file, once again in the show notes
3032
03:53:48,699 --> 03:53:52,529
as well as in the slides and just one second,
just to make it easier to get the text but
3033
03:53:52,529 --> 03:53:55,999
also to see what text is bold in here, because
we do have quite a bit of text that you're
3034
03:53:55,999 --> 03:54:00,939
going to want to make bold when you do this
one. And we also have these h threes that
3035
03:54:00,939 --> 03:54:06,169
are different from all the other h threes.
So that need their own style, their own color,
3036
03:54:06,169 --> 03:54:10,369
their own font size, and all of that setup
on them. But otherwise, there isn't that much.
3037
03:54:10,369 --> 03:54:15,319
Now the very beginning of this is exactly
like we did before, we can go to one of our
3038
03:54:15,319 --> 03:54:19,369
pages, copy all the content and paste it into
a new page. So I want you to try and do that
3039
03:54:19,369 --> 03:54:24,609
and delete everything that you do not need,
we can keep some stuff but we do need to delete
3040
03:54:24,609 --> 03:54:28,499
some other things. So go ahead and give it
a try. Place the content and see if it works
3041
03:54:28,499 --> 03:54:32,079
the way you expect it all to work. And of
course as usual, I'm going to be jumping in
3042
03:54:32,079 --> 03:54:38,839
and taking a look at it with you in just a
minute. Okay, so let's go and make that new
3043
03:54:38,839 --> 03:54:44,660
file. So new file, we can call it a boat mi
dot html. Again, if you're going to have two
3044
03:54:44,660 --> 03:54:49,069
words in it, and you need namespacing do not
put a space with your keyboard. Make sure
3045
03:54:49,069 --> 03:54:54,140
that is hyphens separated on my recent posts.
We can copy all that come over to my about
3046
03:54:54,140 --> 03:54:59,800
me and paste it all footers good. In my sidebar.
The sidebar is a little bit different on this
3047
03:54:59,800 --> 03:55:02,209
one
We do not need this first widget anymore,
3048
03:55:02,209 --> 03:55:07,629
since we're on the About Me page. So we can
delete that sidebar widget. And we don't need
3049
03:55:07,629 --> 03:55:10,909
any of the articles. But I am going to keep
the main there. So let's come through and
3050
03:55:10,909 --> 03:55:15,840
just delete all of these articles, they're
all vanished, they're all gone. And we can
3051
03:55:15,840 --> 03:55:19,180
just come in here and start working directly
in the main, I'm just going to fast forward,
3052
03:55:19,180 --> 03:55:22,939
when I do this part, there's not a lot to
it, it's just, you know, we just have to place
3053
03:55:22,939 --> 03:55:27,419
content and put the right tags on everything.
So I'll be back with you in a second with
3054
03:55:27,419 --> 03:55:32,680
all of the content in place. So all of the
content is in place or ready to go now and
3055
03:55:32,680 --> 03:55:36,520
do the last finishing touches on this. So
there's not a lot to do, if we come in Look,
3056
03:55:36,520 --> 03:55:39,720
I've also been really nice, and I've set up
all the links for you. So if you go and look
3057
03:55:39,720 --> 03:55:42,720
between all the different pages, I have put
those links in there. So if we come through
3058
03:55:42,720 --> 03:55:47,289
and look, now, all of the links are working,
we can jump through between the different
3059
03:55:47,289 --> 03:55:52,200
pages, and everything is all awesome, there's
only two things is I need to change the color
3060
03:55:52,200 --> 03:55:55,510
of that looks like I made a little typo there
somewhere too, we want to change the color
3061
03:55:55,510 --> 03:56:02,009
of my h threes, maybe change the spacing on
them a tad. And of course, we want to make
3062
03:56:02,009 --> 03:56:05,270
some modifications on this picture. Because
we looked at the original design, it should
3063
03:56:05,270 --> 03:56:09,920
be able to crop itself, similar to how these
images were cropping. So the first thing I
3064
03:56:09,920 --> 03:56:13,810
want you to do is go ahead and do that we've
seen it with those other ones. If we come
3065
03:56:13,810 --> 03:56:18,710
and look at my About Me page, I've given it
the class of image full. The idea here is
3066
03:56:18,710 --> 03:56:23,909
that I see this page sort of acting as a template
page as well. So just like these are sort
3067
03:56:23,909 --> 03:56:28,489
of templated pages, if you were to click on
Continue reading, it can use this exact same
3068
03:56:28,489 --> 03:56:32,989
layout for a blog instead of for, for the
full blog post, instead of format, just my
3069
03:56:32,989 --> 03:56:38,199
About Me page, if you're going to do that,
I'd probably have the article tag, the whole
3070
03:56:38,199 --> 03:56:42,020
thing wrapped in that. So article open all
the way at the bottom article close. But in
3071
03:56:42,020 --> 03:56:45,180
this case, it's not really an article, so
I'm not going to include it. Now if you're
3072
03:56:45,180 --> 03:56:48,629
wondering how you could do that, where you're
creating template pages, that's not in the
3073
03:56:48,629 --> 03:56:53,229
scope of this course. But there are different
ways there's languages like PHP, which WordPress
3074
03:56:53,229 --> 03:56:57,739
is built on. So you could actually make your
own WordPress theme. Or I use a language called
3075
03:56:57,739 --> 03:57:01,029
Jekyll for my personal site. Right now I'm
looking at changing that maybe to eleventy,
3076
03:57:01,029 --> 03:57:05,489
or there's many, many others, there's a few
of them that I'm looking into. For the next
3077
03:57:05,489 --> 03:57:09,300
time I redo my own personal site, which are
called static site generators, where it's
3078
03:57:09,300 --> 03:57:13,689
mostly using HTML and CSS. So you're setting
everything up with those. But then you can
3079
03:57:13,689 --> 03:57:18,699
have the content if you write a new blog post
that sort of automatically putting the content
3080
03:57:18,699 --> 03:57:23,279
into the template file that you created. And
we're well on our way of having something
3081
03:57:23,279 --> 03:57:27,069
that could be taken to that next step once
you're ready, but I wouldn't get there yet,
3082
03:57:27,069 --> 03:57:30,600
don't get ahead of yourselves, let's first
master how to make the responsive page. And
3083
03:57:30,600 --> 03:57:34,550
then once you're super comfortable with that,
you can start worrying about templating. So
3084
03:57:34,550 --> 03:57:39,119
for the image, I want you to go ahead and
do that set up the image. So it is cropping
3085
03:57:39,119 --> 03:57:42,919
just like we did on the other ones, I would
do with a maximum height, so limit the maximum
3086
03:57:42,919 --> 03:57:46,479
height or image you can have, and also maybe
add a little bit of margin on the bottom of
3087
03:57:46,479 --> 03:57:52,879
it. And in the next video, I'm going to show
you how I would do that I gave you in the
3088
03:57:52,879 --> 03:57:56,119
last we'll be wrapping up this module in the
next video. But this is the finishing touches
3089
03:57:56,119 --> 03:58:00,551
on this site. Before we move on to stepping
up our style, we're going to look at some
3090
03:58:00,551 --> 03:58:05,299
of the more finer tune stuff, but let's not
get ahead of ourselves. And let's see what
3091
03:58:05,299 --> 03:58:08,449
we can do. So the first thing is the challenge
that I gave you in the last one of fixing
3092
03:58:08,449 --> 03:58:13,750
that image, I'm going to come and put it all
the way up with my other image class, my image
3093
03:58:13,750 --> 03:58:18,199
style, it could probably come into layout
here as well. Because this is all layout related
3094
03:58:18,199 --> 03:58:22,090
stuff. The reason I'm you know, my other ones
were article related, but this one technically
3095
03:58:22,090 --> 03:58:25,819
can be used anywhere it could be used inside
an article, if I ran into another post where
3096
03:58:25,819 --> 03:58:30,859
maybe there is no sidebar, and it's just this
full image that takes up the full size, then
3097
03:58:30,859 --> 03:58:34,859
it would work there too. So I think it makes
sense in this case, just to throw it up here
3098
03:58:34,859 --> 03:58:38,619
where I have my images, which is all the way
at the top here. Because it's sort of like
3099
03:58:38,619 --> 03:58:44,369
this image helper class. So I called it image
full. And all I want to do is give this a
3100
03:58:44,369 --> 03:58:49,579
max width and a max width, I said to give
it a max height, I'm going to give it 300
3101
03:58:49,579 --> 03:58:53,590
pixels. But when I do that, it's trying to
keep my image in proportion. So I'm going
3102
03:58:53,590 --> 03:58:59,149
to give it a width of 100%. So it always stays
at 100%. But the problem now is it's all squished
3103
03:58:59,149 --> 03:59:03,619
and he looks a little bit chubbier than he
should. So we want to come on and give it
3104
03:59:03,619 --> 03:59:08,609
the object fit property with that cool cover
value that we looked at where it will crop
3105
03:59:08,609 --> 03:59:13,909
the image for me and it's looking perfection
right there. And I think my image flow will
3106
03:59:13,909 --> 03:59:19,140
always have a margin underneath it. So our
margin bottom, I'll just give it a one m to
3107
03:59:19,140 --> 03:59:22,319
give us a little bit of space. And you know,
I don't know if that'd be enough. So I'm gonna
3108
03:59:22,319 --> 03:59:28,060
do two before I even go and look at it. Half
love it. I think that looks fantastic. So
3109
03:59:28,060 --> 03:59:31,760
that's I'm super happy with that. It's looking
really good. The next thing we do is change
3110
03:59:31,760 --> 03:59:36,329
the color of these and I think I'm done for
this the site. I'm really happy with it. As
3111
03:59:36,329 --> 03:59:40,990
I said in the next one we'll be looking at
stepping up our style. So for that I'm in
3112
03:59:40,990 --> 03:59:45,930
my typography section now let's go and look
I actually those were just h threes. I never
3113
03:59:45,930 --> 03:59:52,029
even gave them a class which is cool. So I
can just come here and say my h3 has a color
3114
03:59:52,029 --> 03:59:58,419
of the bright blue color. Um, no i did group
that with here. I could break the color out
3115
03:59:58,419 --> 04:00:03,199
of here and apply it but then I You know,
I'm being a little bit lazy with my CSS. Now
3116
04:00:03,199 --> 04:00:07,180
we're defining two different colors. And it's
just always the second one that's going to
3117
04:00:07,180 --> 04:00:10,379
win. I just don't feel like making another
selector for it, to be honest with you. And
3118
04:00:10,379 --> 04:00:14,270
I don't mind overriding things a little bit,
it's easier than breaking this out having
3119
04:00:14,270 --> 04:00:19,970
my h1, h2 have all of h3 have all of it, and
then another h1, h2 that just does the color,
3120
04:00:19,970 --> 04:00:23,930
oh, I'm just gonna put it like this where
I'm overriding that a little bit, because
3121
04:00:23,930 --> 04:00:28,310
it's going to work and my colors are there.
Oh, no, oh, my goodness, look, it changed
3122
04:00:28,310 --> 04:00:33,279
these ones as well, that's not good. So we
can go and fix that just really fast. As I
3123
04:00:33,279 --> 04:00:36,489
said, we're wrapping up right now. So I'd
want to come down to here and those with my
3124
04:00:36,489 --> 04:00:42,329
widget, recent post title, so we want to grab
that, paste it in there and change the color
3125
04:00:42,329 --> 04:00:47,140
of those color to the dark blue. And with
that, that is looking awesome, we have the
3126
04:00:47,140 --> 04:00:51,580
darker titles back to there. I'm gonna remove
that because it's driving me absolutely bananas.
3127
04:00:51,580 --> 04:00:56,840
And we got one last thing that we need to
take a look at. And that one last thing we
3128
04:00:56,840 --> 04:01:00,939
need to do it has to do with our navigation,
can you think of what it is we'll try and
3129
04:01:00,939 --> 04:01:05,709
find this mistake here. So our navigation
is working all fine. All the different pages
3130
04:01:05,709 --> 04:01:11,209
are working. But our current page class got
lost. So I want you to go in and add the current
3131
04:01:11,209 --> 04:01:20,020
page to the correct page on all the pages
to finally wrap up this site. So all we need
3132
04:01:20,020 --> 04:01:25,609
to do for that is if you remember on our index,
I'm going to do it on this one first, and
3133
04:01:25,609 --> 04:01:32,170
then add the class of current page. Let's
go take a look, we get the underlying we gets
3134
04:01:32,170 --> 04:01:36,499
rid of that hover, but these ones are still
working. But when I go to my about me, I want
3135
04:01:36,499 --> 04:01:41,520
this one now to be that. So if I want to go
to my about me, let's actually make our life
3136
04:01:41,520 --> 04:01:46,609
easier by copying all of this. And then I
can go to my about me find the right spot
3137
04:01:46,609 --> 04:01:51,470
right there and paste it in. And then I can
go over to my recent posts. And I can do the
3138
04:01:51,470 --> 04:01:57,449
exact same thing there, where I paste it in.
So we're saying what page we're currently
3139
04:01:57,449 --> 04:02:03,859
on. And now when we go and look, all the pages,
get that nice little underline on it to indicate
3140
04:02:03,859 --> 04:02:08,149
what page we're on while we're navigating
around. And with that we are done, we have
3141
04:02:08,149 --> 04:02:11,739
wrapped up this site, everything is looking
really really good. I'm really happy with
3142
04:02:11,739 --> 04:02:16,709
how it turned out. I really hope you are too.
We covered a lot throughout this module. So
3143
04:02:16,709 --> 04:02:19,659
in the next video, we're going to do a wrap
up of all the different things we've covered
3144
04:02:19,659 --> 04:02:27,199
and where we go. So this is a really important
note before you move on, or before you graduate
3145
04:02:27,199 --> 04:02:32,539
from scuba air, you start doing things on
your own. And that is we have a viewport meta
3146
04:02:32,539 --> 04:02:37,839
tag. And I didn't include it in the lessons
of this module. When we take a look in the
3147
04:02:37,839 --> 04:02:42,359
browser window on our desktop computer and
we play with the width, it works really well.
3148
04:02:42,359 --> 04:02:47,249
But this doesn't fully simulate how a phone
will render a page. So the best case scenario
3149
04:02:47,249 --> 04:02:51,949
is actually testing out the sights you're
doing on your actual phone, or multiple phones
3150
04:02:51,949 --> 04:02:56,989
on an iPad on your Android tablet, whatever
it is, we want to actually test across different
3151
04:02:56,989 --> 04:03:01,520
devices. The reason we have this viewport
meta tag we're going to see in a second. But
3152
04:03:01,520 --> 04:03:07,489
mobile devices, what they started doing is
to prevent problems in how the page was rendered.
3153
04:03:07,489 --> 04:03:12,609
When sites are not optimized for mobile devices
and small screens, they would render a zoomed
3154
04:03:12,609 --> 04:03:17,100
out version of the page. And then they'd shrink
it down to fit inside the viewport of their
3155
04:03:17,100 --> 04:03:22,539
mobile device. So they all every device has
its sort of default size. So you might be
3156
04:03:22,539 --> 04:03:27,020
on a phone like an iPhone that has a width
of 360 pixels, but what they're gonna do is
3157
04:03:27,020 --> 04:03:31,199
they're actually going to bring in the version,
they're telling the browser that it's 960.
3158
04:03:31,199 --> 04:03:34,810
And it's going to take the version of your
site as if it was at 960 pixels wide, and
3159
04:03:34,810 --> 04:03:39,250
it's going to shrink the whole thing down.
And it's gonna be super zoomed out, it's gonna
3160
04:03:39,250 --> 04:03:43,109
look like your desktop site, but really, really
small. Even if you did all the hard work of
3161
04:03:43,109 --> 04:03:47,479
building your media queries and doing everything
you wanted to make it responsive. So to prevent
3162
04:03:47,479 --> 04:03:51,549
it from doing this on our pages, which we've
optimized for small screens with the media
3163
04:03:51,549 --> 04:03:56,409
queries, we need to add a meta tag to the
head of our document. There are a lot of different
3164
04:03:56,409 --> 04:03:59,899
attributes that we can add, but the basic
meta tag that you'll use will look something
3165
04:03:59,899 --> 04:04:03,770
like this, or it will look exactly like this
really. And this can be added anywhere in
3166
04:04:03,770 --> 04:04:08,169
the head of our document. This will make sure
that the page actually loads properly on on
3167
04:04:08,169 --> 04:04:11,770
mobile devices, which after all the hard work
we did, we really wanted to do. So once you've
3168
04:04:11,770 --> 04:04:15,229
graduated from here on screen, but and you're
working on your own pages, and you're testing
3169
04:04:15,229 --> 04:04:20,459
them in different devices. Remember to include
this in your head, I can go anywhere up here,
3170
04:04:20,459 --> 04:04:24,100
I already have a meta tag for that. I'm gonna
go right after that and paste it in right
3171
04:04:24,100 --> 04:04:29,069
there. So what this is doing is it's saying
that it's a meta tag is always referencing
3172
04:04:29,069 --> 04:04:32,600
different things. We haven't really looked
at meta tags, but it's referencing like different
3173
04:04:32,600 --> 04:04:35,590
stuff, you have a description of the site,
you have the author of the site. So if we
3174
04:04:35,590 --> 04:04:45,430
say meta name equals author content is equal
to KEVIN POWELL. For this individual page
3175
04:04:45,430 --> 04:04:49,509
of my website, I've said that the author of
this page was KEVIN POWELL. I know the browser
3176
04:04:49,509 --> 04:04:54,100
knows that there are other ones that you may
use along the way as well. But in this case,
3177
04:04:54,100 --> 04:04:58,159
we're looking at the viewport once we're saying
that this meta tag is related to our viewport
3178
04:04:58,159 --> 04:05:01,379
and the first one here's the really important
one. What this is doing? Is it saying the
3179
04:05:01,379 --> 04:05:06,659
width is actually the device width. So this
is where I said that mobile devices would
3180
04:05:06,659 --> 04:05:11,310
simulate being a larger device and then shrink
everything down. So it would say, No, I'm
3181
04:05:11,310 --> 04:05:14,989
actually a device that's 960 pixels. And then
it wouldn't take that and shrink that whole
3182
04:05:14,989 --> 04:05:19,009
thing down. This is saying, nope, the width
isn't what you're telling me it is, it's the
3183
04:05:19,009 --> 04:05:24,279
actual device width and the initial scale,
you don't, I don't think really, really need
3184
04:05:24,279 --> 04:05:27,789
it. But it's pretty standard to have it in
there. And it's just setting the initial zoom
3185
04:05:27,789 --> 04:05:31,759
level when the page is first loaded. So you
could actually have it zoomed in more or less.
3186
04:05:31,759 --> 04:05:34,959
But I think that'd be really, really awkward.
So you generally want it just to be zoomed
3187
04:05:34,959 --> 04:05:42,899
to 100%, or like the default 1.0 type of thing.
To have it not scaled when the page is loaded.
3188
04:05:42,899 --> 04:05:46,039
So once you're done here on screen, but and
you're making your own web pages, please please
3189
04:05:46,039 --> 04:05:50,680
remember always to be including this in here,
because the browser window on your computer
3190
04:05:50,680 --> 04:05:54,689
is not the same as on your phone or on your
tablet. So you want to test across different
3191
04:05:54,689 --> 04:05:58,871
devices. And most importantly, if you don't
want things to look really zoomed out, make
3192
04:05:58,871 --> 04:06:07,229
sure every single page that you create has
this meta tag right here. Really scratch this,
3193
04:06:07,229 --> 04:06:10,710
you did it, you should be super proud of yourself.
Before we get into being proud of yourself
3194
04:06:10,710 --> 04:06:13,279
and giving you a pat on the back. Let's turn
remember some of the things we learned in
3195
04:06:13,279 --> 04:06:18,509
here. So we covered Flexbox, we looked into
a more of a deeper exploration into what Flexbox
3196
04:06:18,509 --> 04:06:23,220
is. And we've only really scratched the surface
with Flexbox. despite there being a lot more
3197
04:06:23,220 --> 04:06:26,850
to it, we've learned enough to leverage it
and to do some stuff with it. And we've done
3198
04:06:26,850 --> 04:06:32,029
that by starting to play with justify content
and align items to position things where we
3199
04:06:32,029 --> 04:06:36,209
want them to be on the page. So we know we
can on both of these do a flex start flex
3200
04:06:36,209 --> 04:06:40,999
and or a center. And we've also seen that
with the justify content, we can do like a
3201
04:06:40,999 --> 04:06:46,609
space between or a space around or a space
evenly. So we can redistribute the leftover
3202
04:06:46,609 --> 04:06:51,270
empty space with our content to help make
our layouts without having to complicate things
3203
04:06:51,270 --> 04:06:55,549
and get all the numbers perfect. We've also
seen flex direction, which is switching the
3204
04:06:55,549 --> 04:06:59,999
main axis. So it's taking that justify content
in the line items and making them work the
3205
04:06:59,999 --> 04:07:04,640
other way around a little bit, which is kind
of weird. I agree. But that's how it works.
3206
04:07:04,640 --> 04:07:08,689
But we've seen how we can switch the main
axis and why we might want to switch the main
3207
04:07:08,689 --> 04:07:14,510
axis. So in some circumstances, it was useful
to do it just permanently, such as on those
3208
04:07:14,510 --> 04:07:18,819
widgets. In the widget, little title cards,
it was good to do it on those just so we could
3209
04:07:18,819 --> 04:07:23,499
work with Flexbox. But we could also switch
it using media queries. And when we use our
3210
04:07:23,499 --> 04:07:28,409
media queries, we were changing the way the
layout worked at small screens and big screens.
3211
04:07:28,409 --> 04:07:32,539
And this was super powerful and super useful.
We sort of went through a whole bunch of stuff
3212
04:07:32,539 --> 04:07:36,330
on media queries. But once we started using
them, we were just doing the really basic
3213
04:07:36,330 --> 04:07:40,039
stuff, we're setting some min widths, and
it's working. And that's it doesn't have to
3214
04:07:40,039 --> 04:07:45,050
be complicated. I don't want you to overcomplicate
it when you are using your media queries.
3215
04:07:45,050 --> 04:07:49,199
Another thing we learned wasn't necessarily
about thinking responsively, like a lot of
3216
04:07:49,199 --> 04:07:53,430
Flexbox and media queries are all about. But
we did learn how to make it responsive was
3217
04:07:53,430 --> 04:07:57,209
how to build and style and navigation was
a lot more complicated than you might have
3218
04:07:57,209 --> 04:08:01,020
thought it would be. But we got it to work,
it looks fantastic, you should be really happy,
3219
04:08:01,020 --> 04:08:05,539
really proud of yourself. And you should give
yourself a huge pat on the back for making
3220
04:08:05,539 --> 04:08:09,909
it this far, it's a lot of work and a lot
of material that like an insane amount of
3221
04:08:09,909 --> 04:08:14,340
material that we've covered so far. Really,
you should be super proud of yourself at this
3222
04:08:14,340 --> 04:08:19,949
point. Take a break, please, please take a
break, there's been tons of stuff, you need
3223
04:08:19,949 --> 04:08:24,710
to award yourself with a couple of days off,
or a couple of days of doing some other stuff.
3224
04:08:24,710 --> 04:08:28,409
If you really want try and build the site.
Again, going back over everything you have
3225
04:08:28,409 --> 04:08:32,130
the Adobe XD link, do it on your own, don't
follow my instructions, see if you can pull
3226
04:08:32,130 --> 04:08:35,140
it off again. Or maybe if your own colors,
your own layout, or just try and do your own
3227
04:08:35,140 --> 04:08:39,220
thing. Maybe with a similar layouts, you're
not trying to go too far out from what we've
3228
04:08:39,220 --> 04:08:43,390
done so far. But trying to push things and
do things on your own a little bit would be
3229
04:08:43,390 --> 04:08:47,819
really, really good to use everything we've
been learning so far. But do make sure you
3230
04:08:47,819 --> 04:08:51,689
relax and breathe a little bit. If you're
going to do any work at this point, I would
3231
04:08:51,689 --> 04:08:56,119
really make sure it's reinforcing what you've
learned up until now. And once you're feeling
3232
04:08:56,119 --> 04:09:00,249
ready, and once you're feeling comfortable,
then it's time to step up your style with
3233
04:09:00,249 --> 04:09:04,540
the next module in this course. But please
don't rush into it. Take your time to get
3234
04:09:04,540 --> 04:09:08,750
there, relax a little bit, go on Twitter,
social media, YouTube, whatever it is chill
3235
04:09:08,750 --> 04:09:13,600
out, you know, some Netflix and chill. Whatever
it is you'd like to do for a little bit just
3236
04:09:13,600 --> 04:09:17,239
to let everything absorb. And then when you're
ready, and you're feeling up to it. In the
3237
04:09:17,239 --> 04:09:20,739
next one. When we see how we can step up our
style and start making things you have done
3238
04:09:20,739 --> 04:09:24,089
it you've made it through a massive amount
of content. You've wrapped up all of that.
3239
04:09:24,089 --> 04:09:27,569
And I hope you've learned a lot of things
along the way. Now, as I mentioned at the
3240
04:09:27,569 --> 04:09:32,850
very beginning, all of these lessons are part
of one module of six in the responsive web
3241
04:09:32,850 --> 04:09:37,689
design bootcamp that accreted over unscrambler.
That course is available right now over there.
3242
04:09:37,689 --> 04:09:42,479
So if you'd like to go and check that out,
by all means you can it goes in from the very
3243
04:09:42,479 --> 04:09:47,199
fundamentals of CSS, we're covering the basics.
We have this module that you just did we go
3244
04:09:47,199 --> 04:09:52,180
into stepping up are style where it's not
so much about responsiveness, but it's about
3245
04:09:52,180 --> 04:09:56,029
understanding CSS, taking things up to the
next level, making things look a little bit
3246
04:09:56,029 --> 04:09:59,489
nicer. We get into typography as well as some
of the more flashy and fun things you can
3247
04:09:59,489 --> 04:10:04,510
do in CSS. Before taking a real deep dive
into Flexbox, to make sure you really understand
3248
04:10:04,510 --> 04:10:08,979
it, because in this, we started using Flexbox,
we started scratching the surface with it.
3249
04:10:08,979 --> 04:10:13,430
But in that module, we really go all the way
in, we go deep into it, followed by a deep
3250
04:10:13,430 --> 04:10:20,100
dive into CSS Grid, which is CSS is newest
layout tool. It's the really, it's the way
3251
04:10:20,100 --> 04:10:24,149
that large scale layouts should be made these
days, it is a fantastic tool. So we take a
3252
04:10:24,149 --> 04:10:27,980
deep dive into that. And then we wrap the
whole project up with a final project where
3253
04:10:27,980 --> 04:10:32,239
we take everything we've learned, put it into
practice, and also add a few cool things in
3254
04:10:32,239 --> 04:10:35,609
along the way. So if you did enjoy these lessons,
you can go over to Scrivener, and check that
3255
04:10:35,609 --> 04:10:39,669
course out. Again, it's called the responsive
web design bootcamp. Of course, you can also
3256
04:10:39,669 --> 04:10:43,449
find me over on my own YouTube channel, which
is at KEVIN POWELL, you can find me over there
3257
04:10:43,449 --> 04:10:46,439
with a quick search. And whenever you do,
if you haven't yet subscribed here on Free
3258
04:10:46,439 --> 04:10:50,589
Code Camp, I'd also really encourage you to
do that. They just have tons of amazing content
3259
04:10:50,589 --> 04:10:54,119
here and they keep putting out some great
great stuff. So make sure you go ahead and
3260
04:10:54,119 --> 04:10:59,020
subscribe to their own channel here as well.
And as I usually like to sign off on my own
3261
04:10:59,020 --> 04:11:02,279
channel, until next time, don't forget to
make your corner of the internet just a little
3262
04:11:02,279 --> 04:11:02,858
bit more awesome.
405901
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.