1
00:00:00,000 --> 00:00:03,719
Instructor: Hey guys, welcome to the introduction

2
00:00:03,719 --> 00:00:05,910
to CSS section.

3
00:00:05,910 --> 00:00:07,740
And in this very first lesson

4
00:00:07,740 --> 00:00:10,620
we're gonna be introducing you to CSS.

5
00:00:10,620 --> 00:00:13,440
You'll be learning what it is, how it works

6
00:00:13,440 --> 00:00:16,650
and why we need it to be able to style our websites

7
00:00:16,650 --> 00:00:19,560
and make them look beautiful.

8
00:00:19,560 --> 00:00:21,630
What exactly is CSS?

9
00:00:21,630 --> 00:00:25,920
Well, it stands for cascading style sheets.

10
00:00:25,920 --> 00:00:29,820
It kind of conjures up the image of a cascade, right?

11
00:00:29,820 --> 00:00:33,690
And a cascade is simply like a waterfall.

12
00:00:33,690 --> 00:00:36,330
You have water at one level that then drops

13
00:00:36,330 --> 00:00:40,260
down through a waterfall into another level.

14
00:00:40,260 --> 00:00:41,190
And we're gonna see

15
00:00:41,190 --> 00:00:44,700
as we start to use these cascading style sheets

16
00:00:44,700 --> 00:00:47,160
why that analogy is so apt.

17
00:00:47,160 --> 00:00:50,730
Because the way that the style is applied cascades

18
00:00:50,730 --> 00:00:52,200
like a waterfall.

19
00:00:52,200 --> 00:00:54,120
We start from the most general

20
00:00:54,120 --> 00:00:58,500
all the way down to the most specific styling requirements

21
00:00:58,500 --> 00:00:59,940
and we're going to see that

22
00:00:59,940 --> 00:01:03,990
in use as we use these cascading style sheets.

23
00:01:03,990 --> 00:01:07,920
The other part of this name is the style sheet.

24
00:01:07,920 --> 00:01:11,790
A style sheet is a type of language similar

25
00:01:11,790 --> 00:01:16,790
to how we had the HTML, which is a markup language.

26
00:01:17,280 --> 00:01:21,540
That's what the ML part of HTML stands for.

27
00:01:21,540 --> 00:01:23,640
We have the style sheet

28
00:01:23,640 --> 00:01:26,610
which is what the SS part stands for.

29
00:01:26,610 --> 00:01:29,401
And this is a language that allows us to

30
00:01:29,401 --> 00:01:33,390
specify how things should look in our website.

31
00:01:33,390 --> 00:01:37,050
And there are many different types of style sheet languages

32
00:01:37,050 --> 00:01:38,700
the one that's most important

33
00:01:38,700 --> 00:01:40,380
and what we are gonna be learning all

34
00:01:40,380 --> 00:01:43,890
about in this section is the cascading style sheet.

35
00:01:43,890 --> 00:01:47,400
But there's also others like Sass, which stands

36
00:01:47,400 --> 00:01:52,260
for Syntactically Awesome Style Sheet, and Less

37
00:01:52,260 --> 00:01:57,260
which stands for Leaner CSS and many, many others.

38
00:01:57,390 --> 00:02:00,060
But the most important one that every

39
00:02:00,060 --> 00:02:03,810
web developer needs to know is CSS.

40
00:02:03,810 --> 00:02:06,630
And that's what we're gonna be focusing on today.

41
00:02:06,630 --> 00:02:09,840
So why did we need CSS?

42
00:02:09,840 --> 00:02:13,080
Where did it come from and what exactly is the history

43
00:02:13,080 --> 00:02:14,370
of this whole thing?

44
00:02:14,370 --> 00:02:17,640
Well, in the very beginning, when the internet was very

45
00:02:17,640 --> 00:02:19,920
very new, there was no CSS.

46
00:02:19,920 --> 00:02:22,170
There was only HTML.

47
00:02:22,170 --> 00:02:25,140
And one of the things that developers started wanting to

48
00:02:25,140 --> 00:02:28,710
do is they wanted to style their website and make it

49
00:02:28,710 --> 00:02:31,920
look the way they wanted to, but they were really

50
00:02:31,920 --> 00:02:34,110
really limited by HTML.

51
00:02:34,110 --> 00:02:39,110
And this is a now famous email sent by Marc Andreessen

52
00:02:40,050 --> 00:02:42,720
who is the founder of Mosaic, which is one

53
00:02:42,720 --> 00:02:46,770
of the earliest internet browsers who later found Netscape

54
00:02:46,770 --> 00:02:50,790
and now the very famous Andreessen Horowitz VC fund.

55
00:02:50,790 --> 00:02:54,690
And in his email, he famously said that the answer he has

56
00:02:54,690 --> 00:02:56,850
for so many developers who want to

57
00:02:56,850 --> 00:02:59,850
simply control what their documents look like,

58
00:02:59,850 --> 00:03:02,970
meaning what their websites look like

59
00:03:02,970 --> 00:03:04,290
in a way that would be trivial

60
00:03:04,290 --> 00:03:06,690
say in Microsoft Word, his answer

61
00:03:06,690 --> 00:03:09,660
to these developers is just, sorry, you're screwed.

62
00:03:09,660 --> 00:03:11,499
There is no way to do it very easily

63
00:03:11,499 --> 00:03:14,700
at that point in HTML.

64
00:03:14,700 --> 00:03:17,460
That's why all the website looks pretty much the same

65
00:03:17,460 --> 00:03:18,540
pretty boring.

66
00:03:18,540 --> 00:03:20,610
And there was no variation.

67
00:03:20,610 --> 00:03:21,930
So what happened next?

68
00:03:21,930 --> 00:03:25,410
Well, the W3 consortium responded

69
00:03:25,410 --> 00:03:30,330
by releasing a new version of HTML, HTML 3.2.

70
00:03:30,330 --> 00:03:32,430
And this came out in 1997

71
00:03:32,430 --> 00:03:35,400
so it was still in the very early days of the internet.

72
00:03:35,400 --> 00:03:38,940
And what this 3.2 HTML allowed was

73
00:03:38,940 --> 00:03:43,940
it introduced new HTML tags, such as the font tag

74
00:03:44,010 --> 00:03:46,770
which allows you to define the font size, the color

75
00:03:46,770 --> 00:03:50,010
and the font face, so the type

76
00:03:50,010 --> 00:03:53,280
of font you would want to use for your document.

77
00:03:53,280 --> 00:03:57,750
Similarly, there was also the color attribute for font.

78
00:03:57,750 --> 00:04:00,270
There was the face attribute, the size attribute

79
00:04:00,270 --> 00:04:02,640
and these attributes allow you to change all sorts

80
00:04:02,640 --> 00:04:06,840
of things about the way the text looks on your website.

81
00:04:06,840 --> 00:04:08,970
And then there was also the center element

82
00:04:08,970 --> 00:04:12,360
which allows you to format your document

83
00:04:12,360 --> 00:04:16,680
and define how it would be laid out on the screen.

84
00:04:16,680 --> 00:04:18,322
Now, what you'll notice in all three

85
00:04:18,322 --> 00:04:23,322
of these webpages is the deprecated symbol next to it.

86
00:04:23,850 --> 00:04:26,520
All of these are deprecated, which

87
00:04:26,520 --> 00:04:29,550
in programming lingo simply means you should

88
00:04:29,550 --> 00:04:34,410
no longer be using these attributes and elements.

89
00:04:34,410 --> 00:04:37,980
And the reason for this is because as you can imagine

90
00:04:37,980 --> 00:04:41,940
our HTML is supposed to be for content.

91
00:04:41,940 --> 00:04:46,560
Now, if you add in a ton of styling into all of that content

92
00:04:46,560 --> 00:04:50,580
you tell the website how it should be centered

93
00:04:50,580 --> 00:04:52,230
how it should be laid out

94
00:04:52,230 --> 00:04:55,950
how the font should look, what color it should be

95
00:04:55,950 --> 00:04:57,960
what kind of border your tables should have

96
00:04:57,960 --> 00:05:01,618
and whole bunch of other styling effectively

97
00:05:01,618 --> 00:05:06,618
then this is going to massively clutter up all of your HTML.

98
00:05:07,140 --> 00:05:10,530
And you can imagine this is a really, really short website

99
00:05:10,530 --> 00:05:13,380
and it's already got so much junk in it that we can't really

100
00:05:13,380 --> 00:05:16,920
tell what exactly is the structure and the content

101
00:05:16,920 --> 00:05:18,180
of the website.

102
00:05:18,180 --> 00:05:21,930
And if you extend this to a larger website and you just

103
00:05:21,930 --> 00:05:25,440
wanna do some simple things like give it some colors

104
00:05:25,440 --> 00:05:30,240
or put things into the center, then your whole HTML file

105
00:05:30,240 --> 00:05:32,340
is gonna be many, many, many thousands

106
00:05:32,340 --> 00:05:35,730
of lines long, and it's impossible to differentiate

107
00:05:35,730 --> 00:05:38,370
the content from the styling.

108
00:05:38,370 --> 00:05:40,454
So what happened next?

109
00:05:40,454 --> 00:05:45,454
Well, in 1996, a new recommendation was proposed

110
00:05:46,530 --> 00:05:49,140
by the W3 Consortium

111
00:05:49,140 --> 00:05:52,477
and this was led by Hakon Wium...

112
00:05:54,180 --> 00:05:56,550
how calm...

113
00:05:56,550 --> 00:05:58,440
How come...

114
00:05:58,440 --> 00:06:00,390
By how come.

115
00:06:00,390 --> 00:06:04,350
And he's basically the father of the cascading style sheet.

116
00:06:04,350 --> 00:06:07,440
And what this recommendation allows us to do is to

117
00:06:07,440 --> 00:06:11,490
allow us to attach style such as fonts, colors

118
00:06:11,490 --> 00:06:15,780
and spacing to our HTML documents.

119
00:06:15,780 --> 00:06:19,050
And this is the breakthrough that allowed us to

120
00:06:19,050 --> 00:06:23,220
separate our styling from our content.

121
00:06:23,220 --> 00:06:27,210
And as in many different situations, a separation

122
00:06:27,210 --> 00:06:30,600
of concerns so that somebody is responsible

123
00:06:30,600 --> 00:06:32,430
for putting together the car headlights

124
00:06:32,430 --> 00:06:35,010
and somebody else is responsible for dealing

125
00:06:35,010 --> 00:06:39,720
with the wheels rather than one person making an entire car.

126
00:06:39,720 --> 00:06:42,450
This kind of modularity, as you'll see

127
00:06:42,450 --> 00:06:45,780
in coming lessons, is super important, not just

128
00:06:45,780 --> 00:06:50,280
in manufacturing and in real life, but also in programming.

129
00:06:50,280 --> 00:06:54,102
If you wanna see what CSS is able to achieve

130
00:06:54,102 --> 00:06:57,630
I've built this website for you to be able to do that.

131
00:06:57,630 --> 00:07:01,310
If you go over to appbrewery.github.io and then

132
00:07:01,310 --> 00:07:06,310
/just-add-css, you should be able to see this website.

133
00:07:06,720 --> 00:07:08,400
And when you first go over there

134
00:07:08,400 --> 00:07:11,970
you'll see that it's just a very, very simple website.

135
00:07:11,970 --> 00:07:13,110
Pretty bland.

136
00:07:13,110 --> 00:07:15,390
All it's got is HTML.

137
00:07:15,390 --> 00:07:16,620
And now if we go ahead

138
00:07:16,620 --> 00:07:21,270
and press this button to toggle and turn on CSS

139
00:07:21,270 --> 00:07:24,270
then you'll see the entire website transform

140
00:07:24,270 --> 00:07:26,520
and look way more beautiful.

141
00:07:26,520 --> 00:07:29,310
It's now got different fonts, different colors

142
00:07:29,310 --> 00:07:32,550
and different layouts, but you'll notice that

143
00:07:32,550 --> 00:07:37,530
if you go ahead and right click and view the page source

144
00:07:37,530 --> 00:07:41,580
in these two versions, the HTML does not change at all.

145
00:07:41,580 --> 00:07:44,280
So let's toggle our CSS back

146
00:07:44,280 --> 00:07:47,520
and then let's go ahead and view page Source again.

147
00:07:47,520 --> 00:07:49,770
You'll see that in these two versions

148
00:07:49,770 --> 00:07:52,050
as you see me switch it on screen

149
00:07:52,050 --> 00:07:57,050
nothing changes in our index.html.

150
00:07:57,090 --> 00:08:00,870
The only thing that is different is the CSS

151
00:08:00,870 --> 00:08:02,490
that gets added.

152
00:08:02,490 --> 00:08:06,000
Now don't worry too much about the script tags down here

153
00:08:06,000 --> 00:08:08,940
or how we've created our buttons.

154
00:08:08,940 --> 00:08:10,200
We're gonna learn all

155
00:08:10,200 --> 00:08:13,200
of that later on when we learn JavaScript.

156
00:08:13,200 --> 00:08:15,795
But I created this website so that you can play around

157
00:08:15,795 --> 00:08:17,970
with toggling the CSS on

158
00:08:17,970 --> 00:08:22,970
and off to see how it can transform a simple HTML website

159
00:08:23,130 --> 00:08:27,210
without touching any of the code inside the HTML.

160
00:08:27,210 --> 00:08:31,050
And all that we're doing is adding style to our website

161
00:08:31,050 --> 00:08:34,440
in a completely separate language,

162
00:08:34,440 --> 00:08:36,419
the Cascading style sheet.

163
00:08:36,419 --> 00:08:38,820
To learn more about how CSS works

164
00:08:38,820 --> 00:08:41,270
head over to the next lesson where we're gonna get started

165
00:08:41,270 --> 00:08:43,653
styling up a website.

