hideApril is World Autism Month and we want to bring awareness to the importance of inclusion in the classroom!
💡Learn with Amara.org how Captioning Can Empower Diverse Learners!

< Return to Video

CSS inheritance

  • 0:01 - 0:02
    Now that you've seen a bunch of
  • 0:02 - 0:04
    properties, I want to point out something that
  • 0:04 - 0:05
    you might have already figured out yourself
  • 0:05 - 0:07
    already. A concept called inheritance;
  • 0:07 - 0:10
    some CSS properties are inherited, which
  • 0:10 - 0:11
    means they get passed down to all the
  • 0:11 - 0:13
    children tags underneath them. For
  • 0:13 - 0:16
    example, the font family is an inherited
  • 0:16 - 0:19
    property. Just by setting it on the body
  • 0:19 - 0:20
    tag, we can see it get picked up
  • 0:20 - 0:22
    automatically by the children tags, like
  • 0:22 - 0:24
    the h1, and paragraphs. It only stops
  • 0:24 - 0:27
    taking effect once another rule steps in.
  • 0:27 - 0:29
    Like--this rule--changing the font family
  • 0:29 - 0:32
    of all the headings to cursive. Another
  • 0:32 - 0:35
    inherited property is color. If we set it
  • 0:35 - 0:37
    on body, we can see it trickle down to
  • 0:37 - 0:39
    all the tags inside body, until other
  • 0:39 - 0:42
    rules override it. Like--this rule here--
  • 0:42 - 0:45
    setting the h2's to green. Other
  • 0:45 - 0:47
    inherited properties that we've seen are
  • 0:47 - 0:52
    font weight, font size, font style, line
  • 0:52 - 0:55
    height, text align--actually, a lot of
  • 0:55 - 0:57
    the ones we've seen are inherited, because
  • 0:57 - 0:59
    they have to do with text styling--and
  • 0:59 - 1:00
    browsers figured that web designers would
  • 1:00 - 1:03
    want text styles to trickle down, so they
  • 1:03 - 1:05
    don't have to keep defining the styles at
  • 1:05 - 1:08
    each level. Going forward, though, most of
  • 1:08 - 1:10
    the new properties you see won't be
  • 1:10 - 1:12
    inherited. If you're not sure if a
  • 1:12 - 1:14
    property is inherited or not, either stick
  • 1:14 - 1:16
    it on the body tag, and see what happens,
  • 1:16 - 1:19
    or look up the property on the internet,
  • 1:19 - 1:21
    and read the documentation about it.
Title:
CSS inheritance
Description:

more » « less
Video Language:
English
Duration:
01:22
Josh Kline commented on English subtitles for CSS inheritance Dec 27, 2014, 1:37 AM
Josh Kline commented on English subtitles for CSS inheritance Dec 26, 2014, 8:51 PM
Retired user edited English subtitles for CSS inheritance Dec 26, 2014, 7:59 PM
nitinjan06 edited English subtitles for CSS inheritance Nov 26, 2014, 5:34 PM
  • I don't understand the reason for recent revision to this, doesn't it introduce some issues?

    Dec 26, 2014, 8:51 PM
  • Actually, I was in error with the last comment... the most recent revision added timings, which is a good thing. The original revision has the errors.

    When I get around to it, I'll come back and try to get the whole thing in line with proper style.

    Dec 27, 2014, 1:37 AM

English subtitles

Revisions