Fireship · @fireship
The Joy of CSS Grid - Build 3 Beautifully Simple Responsive Layouts
Uploaded March 10, 2020 · Length 11:37
Summary
Learn how to build three simple responsive layouts using CSS Grid with just three lines of code.
- css grid tutorial
- responsive layouts
- css grid examples
- grid system
- css grid basics
Transcript preview
The first 2 minutes of the transcript. Select a timestamp to watch that moment on YouTube.
- 0:00
today you'll learn the basics of CSS
- 0:01
grid by building three different grid
- 0:03
layouts from scratch the first example
- 0:05
is a responsive 12 column grid it
- 0:07
replaces most of the use cases that
- 0:09
you'd find in a grid system like Twitter
- 0:10
bootstrap but it does so with only three
- 0:12
lines of code and removes the need for
- 0:14
all this crazy markup from your HTML
- 0:16
next we'll build a responsive photo
- 0:18
gallery and third we'll build an
- 0:19
explicit grid that has this fancy
- 0:21
staggered intro animation by the end of
- 0:23
this video you should know enough about
- 0:25
grid to start putting it to use in your
- 0:26
own projects if you're new here like it
- 0:28
subscribe and feel free to grab your
- 0:30
mouse the keyboard to code along with us
- 0:32
when you start just have a good feeling
- 0:34
and be happy and in love with life in
- 0:37
the world and sit down and begin playing
- 0:40
I'd like to start off by sharing my own
- 0:42
experience with grid because on fire
- 0:44
ship i/o I was previously using a
- 0:45
flexbox based system like you would find
- 0:47
in bootstrap and many other CSS
- 0:49
frameworks now there's nothing wrong
- 0:51
with using a third-party solution but
- 0:53
when you use grid you don't have to add
- 0:54
any additional CSS to your bundle size
- 0:56
the grid system just works natively in
- 0:58
the browser but the much more important
- 1:00
benefit was how much it simplified the
- 1:02
code base my HTML markup had a bunch of
- 1:04
columns each with its own collection of
- 1:06
classes to make that call and responsive
- 1:08
after moving to CSS grid I was able to
- 1:10
remove all these classes and implement
- 1:12
my own grid system with just three lines
- 1:14
of code and on top of that beautiful
- 1:15
designs that you would normally only
- 1:16
find in a magazine are much easier to
- 1:18
implement with grid because the system
- 1:20
itself is inspired by print based grids
- 1:22
now I should warn you that grid is
- 1:24
pretty weird to learn at first so let's
- 1:26
jump into some examples and understand
- 1:27
what every line of code is doing you can
- 1:29
follow along by opening your editor and
- 1:31
creating an HTML and CSS file or you can
- 1:34
clone the project from github and you'll
- 1:35
see that each grid is broken down into
- 1:37
its own HTML and CSS files this first
- 1:40
grid we're building is basically an
- 1:41
infinite set of responsive columns and
- 1:43
that's really useful if you have
- 1:45
something like a feed of cards like the
- 1:47
lesson feed on fire ship IO and a grid
- 1:49
like this will also replace many of the
- 1:51
use cases for something like Twitter
- 1:52
bootstrap grid go ahead and open an HTML
- 1:55
file in BS code then start typing HTML
- 1:57
to autocomplete the boilerplate code
- 1:59
next I'm going to go into the head of


