Fireship · @fireship
CSS in 100 Seconds
Uploaded December 14, 2021 · Length 2:20
Summary
css basics: selectors, rules, box model, layout, media queries, animations in 100 seconds.
- css basics
- css selectors
- css rules
- css box model
- css layout
- css media queries
- css animations
Transcript preview
The first 2 minutes of the transcript. Select a timestamp to watch that moment on YouTube.
- 0:00
cascading stylesheets or css is a
- 0:02
stylesheet language famous for making
- 0:04
websites look pretty by default a
- 0:06
browser will render HTML as a boring
- 0:09
black and white document CSS allows you
- 0:11
to describe the presentation of this
- 0:13
markup by modifying the size color
- 0:16
positioning and layout of HTML elements
- 0:19
it was first released in 1996 and
- 0:21
evolved into CSS 3 by 1999 the language
- 0:24
continues to evolve to this day with new
- 0:26
features but there will never be a CSS 4
- 0:29
just updates to the existing language
- 0:31
the typical CSS rule starts with a
- 0:33
selector that can be matched to an
- 0:34
element in the HTML document you then
- 0:37
use braces to create a declaration block
- 0:39
that contain properties that change the
- 0:41
appearance of that element this is known
- 0:43
as a CSS rule but the tricky thing is
- 0:45
that stylesheets Cascade a stylesheet
- 0:48
might contain multiple rules that apply
- 0:50
to the same element this creates a
- 0:51
hierarchy and rules that are more
- 0:53
specific will overwrite the rules of
- 0:55
their parents in other words the order
- 0:57
of your CSS rules matter in addition
- 0:59
some elements will inherit the styles of
- 1:01
their parent but others will not
- 1:03
ultimately the browser uses the concepts
- 1:05
of cascade specificity and inheritance
- 1:08
to control which styles are applied to
- 1:10
an element to get started open up a
- 1:12
style tag in any HTML document a
- 1:14
selector can Target all HTML elements of
- 1:17
a certain type multiple related elements
- 1:19
with a custom class or a single element
- 1:21
with an ID now think of every HTML
- 1:23
element like a box the content is in the
- 1:26
middle followed by padding border and a
- 1:28
margin the amount of real estate used by
- 1:30
every area in the Box can be customized
- 1:33
by defining properties like padding and
- 1:35
margin they can take explicit pixel
- 1:37
values or responsive values that are
- 1:39
relative to the parent element or a
- 1:41
percentage of the viewport itself now
- 1:43
these boxes will bump into each other to
- 1:44
make up a web page but you can use tools
- 1:47
like Flex layout and grid layout to
- 1:49
control how they float together in a
- 1:50
sophisticated way it can also detect
- 1:52
user interaction with pseudo selectors
- 1:55
like hover CSS also makes it possible to
- 1:57
add logic to your code with variables or
- 1:59
custom properties and by making media


