SlideShare a Scribd company logo
CSS
INHERITANCE
Let’s start
 with the
document
   tree
Before we explore inheritance, we
     need to understand the
        document tree.
All HTML documents are trees.
Document trees are made from
     HTML elements.
The document tree is just like
     your family tree.
An ancestor refers to any
element that is connected but
further up the document tree.


                          Ancestor
A descendant refers to any
       element that is connected but
      lower down the document tree.



                              Descendant


Descendants
A parent is an element that is
connected & directly above an
element in the document tree.


                         Parent
A child is an element that is
connected & directly below an
element in the document tree.



                          Child
A sibling is an element that
       shares the same parent as
            another element.



                               Parent


Siblings
Next, a bit
  about
CSS rules
We also need to understand the
 basics of CSS rules before
    exploring inheritance.
CSS rules tell browsers
how to render specific elements
      on an HTML page.
CSS rules are made up of
  five components.
The selector "selects" the
elements on an HTML page that
    are affected by the rule.



  p { color: red; }


Selector
The declaration block is a
    container that consists of
anything between (and including)
          the brackets.

 p { color: red; }


    Declaration block
The declaration tells a browser
how to render any element on a
     page that is selected.



 p { color: red; }


       Declaration
The property is the aspect of that
element that you are choosing to
              style.



  p { color: red; }


      Property
The value is the exact style you
  wish to set for the property.




 p { color: red; }


             Value
Now…
   what is
inheritance?
Inheritance is where specific CSS
 properties are passed down to
      descendant elements.
To see inheritance in action, we
will use the HTML code below:



<p>
      Lorem <em>ipsum</em> dolor
      sit amet consect etuer.
</p>
Note that the <em> element sits
  inside the <p> element.
We will also use this CSS code.
Note that the <em> element has
      not been specified.



 p { color: red; }
In a browser, the <p> and <em>
 elements will both be colored
              red.




    <em> element
But why is the <em> element
colored red when it has not been
             styled?
Because the <em> element has
inherited the color property from
        the <p> element.
Why is
inheritance
  helpful?
Inheritance is designed to make
      it easier for authors.
Otherwise we would need to
  specify properties for all
  descendant elements.


p { color: red; }
p em { color: red; }
CSS files would be much larger
 in size, harder to create and
 maintain as well as slower to
           download.
Are all CSS
properties
inherited?
No. All CSS properties are
      not inherited!
If every CSS property was
inherited, it would make things
  much harder for authors.
Authors would have to turn off
 unwanted CSS properties for
    descendant elements.
For example, what would happen
  if the border property was
      inherited by default…
and we then applied a border to
       the <p> element?



 p { border: 1px solid red; }
The <em> inside the <p> would
   also have a red border.




    <em> element
Luckily, borders are not
inherited, so the <em> would not
       have a red border.




     <em> element
Generally speaking, only
properties that make our job
    easier are inherited!
So, which
properties are
  inherited?
The following CSS properties are
           inherited…
azimuth, border-collapse, border-spacing,
 caption-side, color, cursor, direction, elevation,
   empty-cells, font-family, font-size, font-style,
   font-variant, font-weight, font, letter-spacing,
  line-height, list-style-image, list-style-position,
  list-style-type, list-style, orphans, pitch-range,
 pitch, quotes, richness, speak-header, speak-
   numeral, speak-punctuation, speak, speech-
      rate, stress, text-align, text-indent, text-
transform, visibility, voice-family, volume, white-
            space, widows, word-spacing
Yikes! That is a lot of properties.
To simply things, let’s take a look
         at some of the
   key groups of properties.
Text-related properties that are
           inherited:
azimuth, border-collapse, border-spacing,
 caption-side, color, cursor, direction, elevation,
   empty-cells, font-family, font-size, font-style,
   font-variant, font-weight, font, letter-spacing,
  line-height, list-style-image, list-style-position,
  list-style-type, list-style, orphans, pitch-range,
 pitch, quotes, richness, speak-header, speak-
   numeral, speak-punctuation, speak, speech-
      rate, stress, text-align, text-indent, text-
transform, visibility, voice-family, volume, white-
            space, widows, word-spacing
List-related properties that are
           inherited:
azimuth, border-collapse, border-spacing,
 caption-side, color, cursor, direction, elevation,
   empty-cells, font-family, font-size, font-style,
   font-variant, font-weight, font, letter-spacing,
  line-height, list-style-image, list-style-position,
  list-style-type, list-style, orphans, pitch-range,
 pitch, quotes, richness, speak-header, speak-
   numeral, speak-punctuation, speak, speech-
      rate, stress, text-align, text-indent, text-
transform, visibility, voice-family, volume, white-
            space, widows, word-spacing
And, importantly, the
color property is inherited:
azimuth, border-collapse, border-spacing,
 caption-side, color, cursor, direction, elevation,
   empty-cells, font-family, font-size, font-style,
   font-variant, font-weight, font, letter-spacing,
  line-height, list-style-image, list-style-position,
  list-style-type, list-style, orphans, pitch-range,
 pitch, quotes, richness, speak-header, speak-
   numeral, speak-punctuation, speak, speech-
      rate, stress, text-align, text-indent, text-
transform, visibility, voice-family, volume, white-
            space, widows, word-spacing
Is font-size
 inherited?
The simple answer is “yes”.
However, font-size is inherited in
 a different way to many other
           properties.
Rather than the actual value
being inherited, the calculated
       value is inherited.
Before explaining how font-size
 inheritance works, we need to
          look at why
    font-size is not directly
            inherited.
Let’s start with the
same sample of HTML code we
         used earlier:


<p>
      Lorem <em>ipsum</em> dolor
      sit amet consect etuer.
</p>
As before the <em>
sits inside the <p>.
Now, a font-size is applied to the
<p> element only. The <em> has
       not been specified.



 p { font-size: 80%; }
If the font-size value of 80% were
         to be inherited, the
    <em> would be sized to 80%
        of the <p> element…
and the rendered document
   would look like this:




 <em> element
However, this is not the case!
The <em> is the same size as the
              <p>.




    <em> element
So how does inheritance work for
          font-size?
Let’s look at three examples
           in action.
We will use the same HTML
     code as before:



<p>
      Lorem <em>ipsum</em> dolor
      sit amet consect etuer.
</p>
Which produces the same
document tree as before.
Example 1:
  Pixels
The <p> element has been given
      a font-size of 14px.
Note: pixels are not recommended for sizing fonts due to accessibility
    issues associated with older browsers such as IE5 and IE6.




 p { font-size: 14px; }
This pixel value (14px) overrides
  the browsers default font-size
 value (approx 16px). This new
      value is inherited by
         descendants.
So, the <em> element inherits the
                14px value.

element          value          calcuated value

default font size approx 16px

<body>           unspecified    approx 16px

<p>              14px           14px

<em>             unspecified    inherited value = 14px
Example 2:
Percentage
The <p> element has been given
      a font-size of 85%.



 p { font-size: 85%; }
The browsers default font-size
 (16px) and the percentage value
    (85%) are used to create a
  calculated value (16px x 85% =
13.6px). This calculated value is
   inherited by descendants.
So, the <em> element inherits the
          13.6px calculated value.

element          value          calcuated value

default font size approx 16px

<body>           unspecified    approx 16px

<p>              85%            16px x 85% = 13.6px

<em>             unspecified    inherited value = 13.6px
Example 3:
   EMs
The <p> element has been given
     a font-size of .85em.
Note: Avoid using EMs for font-size values under 1em as IE5 renders these
        values in pixels instead of EMs (.8em is rendered as 8px).




   p { font-size: .85em; }
The browsers default font-size
(16px) and the EM value (.85em)
 are used to create a calculated
 value (16px x .85em = 13.6px).
    This calculated value is
  inherited by descendants.
So, the <em> element inherits the
          13.6px calculated value.

element          value          calcuated value

default font size approx 16px

<body>           unspecified    approx 16px

<p>              .85em          16px x .85em = 13.6px

<em>             unspecified    inherited value = 13.6px
Those examples were too simple.
   What about more complex
   examples using different
         elements?
Example 4:
All elements have been specified
    using percentage values.



 body { font-size: 85%; }
 h1 { font-size: 200%; }
 h2 { font-size: 150%; }
The browsers default font-size
 (16px) and the body percentage
value (85%) are used to create a
 calculated value (16px x 85% =
 13.6px). This calculated value is
inherited by descendants unless
   new values are specified.
The font-size inheritance in
                     action
element          value          calculated font-size

default font size approx 16px

<body>           85%            16px x 85% = 13.6px

<h1>             200%           inherited value 13.6px x 200% = 27.2px

<h2>             150%           inherited value 13.6px x 150% = 20.4px

<p>              unspecified    inherited value = 13.6px

<em>             unspecified    inherited value = 13.6px
Using inheritance
  for efficiency
Authors can use inheritance to
     write efficient CSS.
For example, you can set the
color, font-size and font-family on
        the body element.


 body {
     color: #222;
     font-family: arial,
     helvetica, sans-serif;
     font-size: 90%;
 }
These properties will be inherited
  by all descendant elements.
You can then override the
properties as needed, specifying
       new color values...
body {
    color: #222;
    font-family: arial,
    helvetica, sans-serif;
    font-size: 90%;
}

h1, h2, h3 { color: green; }
h4, h5, h6 { color: black; }
new font-family values...
body {
    color: #222;
    font-family: arial,
    helvetica, sans-serif;
    font-size: 90%;
}

h1, h2, h3 { color: green; }
h4, h5, h6 { color: black; }

h1, h2, h3, h4, h5, h6 {
    font-family: georgia,
    times, serif;
}
and new font-size values as
         needed.
}

h1, h2, h3 { color: green; }
h4, h5, h6 { color: black; }

h1, h2, h3, h4, h5, h6 {
    font-family: georgia,
    times, serif;
}

h1 { font-size: 200%; }
h2 { font-size: 150%; }
h3 { font-size: 125%; }
#footer { font-size: 90%; }
Now, go forth and
inherit the world!
We’re done!

More Related Content

PDF
JavaScript Programming
PPT
Html frames
PDF
HTML PPT.pdf
PPTX
Css backgrounds
PPTX
Css pseudo-classes
PPTX
Java script
PPTX
CSS Animations & Transitions
JavaScript Programming
Html frames
HTML PPT.pdf
Css backgrounds
Css pseudo-classes
Java script
CSS Animations & Transitions

What's hot (20)

PDF
jQuery for beginners
PDF
CSS Day: CSS Grid Layout
PDF
Fundamental JavaScript [UTC, March 2014]
PDF
CSS selectors
PPTX
Css types internal, external and inline (1)
PDF
JavaScript - Chapter 6 - Basic Functions
PPTX
HTML Forms
PPT
PPTX
Javascript functions
PDF
Introduction to XHTML
PPTX
Css tables
PDF
ODP
CSS Basics
PPTX
CSS Transitions, Transforms, Animations
PDF
Introduction to CSS3
PPT
Css Ppt
PPTX
Php operators
PDF
JavaScript guide 2020 Learn JavaScript
PPTX
Java script
jQuery for beginners
CSS Day: CSS Grid Layout
Fundamental JavaScript [UTC, March 2014]
CSS selectors
Css types internal, external and inline (1)
JavaScript - Chapter 6 - Basic Functions
HTML Forms
Javascript functions
Introduction to XHTML
Css tables
CSS Basics
CSS Transitions, Transforms, Animations
Introduction to CSS3
Css Ppt
Php operators
JavaScript guide 2020 Learn JavaScript
Java script
Ad

Similar to CSS INHERITANCE (20)

PPTX
Getting started with css
PDF
Introduction to CSS
PDF
Btk creative-web-03
PPT
PPTX
Css Complete Notes
PDF
cascading stylesheet_cssppt-100604051600-phpapp02.pdf
PPT
Css layouts-continued
PPT
CSS for Beginners
PPTX
PDF
CSS Notes in PDF, Easy to understand. For beginner to advanced. ...
PPT
CSS
PDF
Intro to CSS
PDF
Line Height
PPTX
WEB DEVELOPMENT
DOC
Css1 properties
PDF
CSS LINE HEIGHT
PDF
01 Introduction To CSS
PPTX
Lecture-7.pptx
PPT
Css advanced – session 5
Getting started with css
Introduction to CSS
Btk creative-web-03
Css Complete Notes
cascading stylesheet_cssppt-100604051600-phpapp02.pdf
Css layouts-continued
CSS for Beginners
CSS Notes in PDF, Easy to understand. For beginner to advanced. ...
CSS
Intro to CSS
Line Height
WEB DEVELOPMENT
Css1 properties
CSS LINE HEIGHT
01 Introduction To CSS
Lecture-7.pptx
Css advanced – session 5
Ad

More from Anuradha (20)

PPTX
Sql server 2012 - always on deep dive - bob duffy
PDF
J query visual-cheat-sheet-1.4.2
PDF
Inspiration
PPS
Peace Now
PDF
Go Kiss The World
PDF
CSS CASCADE
PPT
Insearchofmahatma 090802094040 Phpapp02
PPS
Mahatma
PDF
Presentation Alphabet
PPS
Dirtywindows
PPS
Dear Son Dear Daughter Slide Show
PPS
Beautiful Motivation
PPS
Great Leaders
PPS
A Present
PPS
Six Keys To Success
PPS
Friendship And Love
PPS
Dr Apj Kalam
PPS
Attitude Is Everything
XLS
Age Character Calculation
PDF
Apictureisworthathousandwords
Sql server 2012 - always on deep dive - bob duffy
J query visual-cheat-sheet-1.4.2
Inspiration
Peace Now
Go Kiss The World
CSS CASCADE
Insearchofmahatma 090802094040 Phpapp02
Mahatma
Presentation Alphabet
Dirtywindows
Dear Son Dear Daughter Slide Show
Beautiful Motivation
Great Leaders
A Present
Six Keys To Success
Friendship And Love
Dr Apj Kalam
Attitude Is Everything
Age Character Calculation
Apictureisworthathousandwords

Recently uploaded (20)

PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Empathic Computing: Creating Shared Understanding
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Modernizing your data center with Dell and AMD
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PDF
Review of recent advances in non-invasive hemoglobin estimation
DOCX
The AUB Centre for AI in Media Proposal.docx
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Spectral efficient network and resource selection model in 5G networks
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
cuic standard and advanced reporting.pdf
PDF
Encapsulation theory and applications.pdf
PDF
Approach and Philosophy of On baking technology
PPTX
Big Data Technologies - Introduction.pptx
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
Reach Out and Touch Someone: Haptics and Empathic Computing
Empathic Computing: Creating Shared Understanding
Unlocking AI with Model Context Protocol (MCP)
Modernizing your data center with Dell and AMD
“AI and Expert System Decision Support & Business Intelligence Systems”
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
Review of recent advances in non-invasive hemoglobin estimation
The AUB Centre for AI in Media Proposal.docx
Digital-Transformation-Roadmap-for-Companies.pptx
Spectral efficient network and resource selection model in 5G networks
20250228 LYD VKU AI Blended-Learning.pptx
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
Chapter 3 Spatial Domain Image Processing.pdf
cuic standard and advanced reporting.pdf
Encapsulation theory and applications.pdf
Approach and Philosophy of On baking technology
Big Data Technologies - Introduction.pptx
Encapsulation_ Review paper, used for researhc scholars
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Building Integrated photovoltaic BIPV_UPV.pdf

CSS INHERITANCE

  • 2. Let’s start with the document tree
  • 3. Before we explore inheritance, we need to understand the document tree.
  • 4. All HTML documents are trees.
  • 5. Document trees are made from HTML elements.
  • 6. The document tree is just like your family tree.
  • 7. An ancestor refers to any element that is connected but further up the document tree. Ancestor
  • 8. A descendant refers to any element that is connected but lower down the document tree. Descendant Descendants
  • 9. A parent is an element that is connected & directly above an element in the document tree. Parent
  • 10. A child is an element that is connected & directly below an element in the document tree. Child
  • 11. A sibling is an element that shares the same parent as another element. Parent Siblings
  • 12. Next, a bit about CSS rules
  • 13. We also need to understand the basics of CSS rules before exploring inheritance.
  • 14. CSS rules tell browsers how to render specific elements on an HTML page.
  • 15. CSS rules are made up of five components.
  • 16. The selector "selects" the elements on an HTML page that are affected by the rule. p { color: red; } Selector
  • 17. The declaration block is a container that consists of anything between (and including) the brackets. p { color: red; } Declaration block
  • 18. The declaration tells a browser how to render any element on a page that is selected. p { color: red; } Declaration
  • 19. The property is the aspect of that element that you are choosing to style. p { color: red; } Property
  • 20. The value is the exact style you wish to set for the property. p { color: red; } Value
  • 21. Now… what is inheritance?
  • 22. Inheritance is where specific CSS properties are passed down to descendant elements.
  • 23. To see inheritance in action, we will use the HTML code below: <p> Lorem <em>ipsum</em> dolor sit amet consect etuer. </p>
  • 24. Note that the <em> element sits inside the <p> element.
  • 25. We will also use this CSS code. Note that the <em> element has not been specified. p { color: red; }
  • 26. In a browser, the <p> and <em> elements will both be colored red. <em> element
  • 27. But why is the <em> element colored red when it has not been styled?
  • 28. Because the <em> element has inherited the color property from the <p> element.
  • 29. Why is inheritance helpful?
  • 30. Inheritance is designed to make it easier for authors.
  • 31. Otherwise we would need to specify properties for all descendant elements. p { color: red; } p em { color: red; }
  • 32. CSS files would be much larger in size, harder to create and maintain as well as slower to download.
  • 34. No. All CSS properties are not inherited!
  • 35. If every CSS property was inherited, it would make things much harder for authors.
  • 36. Authors would have to turn off unwanted CSS properties for descendant elements.
  • 37. For example, what would happen if the border property was inherited by default…
  • 38. and we then applied a border to the <p> element? p { border: 1px solid red; }
  • 39. The <em> inside the <p> would also have a red border. <em> element
  • 40. Luckily, borders are not inherited, so the <em> would not have a red border. <em> element
  • 41. Generally speaking, only properties that make our job easier are inherited!
  • 43. The following CSS properties are inherited…
  • 44. azimuth, border-collapse, border-spacing, caption-side, color, cursor, direction, elevation, empty-cells, font-family, font-size, font-style, font-variant, font-weight, font, letter-spacing, line-height, list-style-image, list-style-position, list-style-type, list-style, orphans, pitch-range, pitch, quotes, richness, speak-header, speak- numeral, speak-punctuation, speak, speech- rate, stress, text-align, text-indent, text- transform, visibility, voice-family, volume, white- space, widows, word-spacing
  • 45. Yikes! That is a lot of properties.
  • 46. To simply things, let’s take a look at some of the key groups of properties.
  • 48. azimuth, border-collapse, border-spacing, caption-side, color, cursor, direction, elevation, empty-cells, font-family, font-size, font-style, font-variant, font-weight, font, letter-spacing, line-height, list-style-image, list-style-position, list-style-type, list-style, orphans, pitch-range, pitch, quotes, richness, speak-header, speak- numeral, speak-punctuation, speak, speech- rate, stress, text-align, text-indent, text- transform, visibility, voice-family, volume, white- space, widows, word-spacing
  • 50. azimuth, border-collapse, border-spacing, caption-side, color, cursor, direction, elevation, empty-cells, font-family, font-size, font-style, font-variant, font-weight, font, letter-spacing, line-height, list-style-image, list-style-position, list-style-type, list-style, orphans, pitch-range, pitch, quotes, richness, speak-header, speak- numeral, speak-punctuation, speak, speech- rate, stress, text-align, text-indent, text- transform, visibility, voice-family, volume, white- space, widows, word-spacing
  • 51. And, importantly, the color property is inherited:
  • 52. azimuth, border-collapse, border-spacing, caption-side, color, cursor, direction, elevation, empty-cells, font-family, font-size, font-style, font-variant, font-weight, font, letter-spacing, line-height, list-style-image, list-style-position, list-style-type, list-style, orphans, pitch-range, pitch, quotes, richness, speak-header, speak- numeral, speak-punctuation, speak, speech- rate, stress, text-align, text-indent, text- transform, visibility, voice-family, volume, white- space, widows, word-spacing
  • 54. The simple answer is “yes”. However, font-size is inherited in a different way to many other properties.
  • 55. Rather than the actual value being inherited, the calculated value is inherited.
  • 56. Before explaining how font-size inheritance works, we need to look at why font-size is not directly inherited.
  • 57. Let’s start with the same sample of HTML code we used earlier: <p> Lorem <em>ipsum</em> dolor sit amet consect etuer. </p>
  • 58. As before the <em> sits inside the <p>.
  • 59. Now, a font-size is applied to the <p> element only. The <em> has not been specified. p { font-size: 80%; }
  • 60. If the font-size value of 80% were to be inherited, the <em> would be sized to 80% of the <p> element…
  • 61. and the rendered document would look like this: <em> element
  • 62. However, this is not the case! The <em> is the same size as the <p>. <em> element
  • 63. So how does inheritance work for font-size?
  • 64. Let’s look at three examples in action.
  • 65. We will use the same HTML code as before: <p> Lorem <em>ipsum</em> dolor sit amet consect etuer. </p>
  • 66. Which produces the same document tree as before.
  • 67. Example 1: Pixels
  • 68. The <p> element has been given a font-size of 14px. Note: pixels are not recommended for sizing fonts due to accessibility issues associated with older browsers such as IE5 and IE6. p { font-size: 14px; }
  • 69. This pixel value (14px) overrides the browsers default font-size value (approx 16px). This new value is inherited by descendants.
  • 70. So, the <em> element inherits the 14px value. element value calcuated value default font size approx 16px <body> unspecified approx 16px <p> 14px 14px <em> unspecified inherited value = 14px
  • 72. The <p> element has been given a font-size of 85%. p { font-size: 85%; }
  • 73. The browsers default font-size (16px) and the percentage value (85%) are used to create a calculated value (16px x 85% = 13.6px). This calculated value is inherited by descendants.
  • 74. So, the <em> element inherits the 13.6px calculated value. element value calcuated value default font size approx 16px <body> unspecified approx 16px <p> 85% 16px x 85% = 13.6px <em> unspecified inherited value = 13.6px
  • 75. Example 3: EMs
  • 76. The <p> element has been given a font-size of .85em. Note: Avoid using EMs for font-size values under 1em as IE5 renders these values in pixels instead of EMs (.8em is rendered as 8px). p { font-size: .85em; }
  • 77. The browsers default font-size (16px) and the EM value (.85em) are used to create a calculated value (16px x .85em = 13.6px). This calculated value is inherited by descendants.
  • 78. So, the <em> element inherits the 13.6px calculated value. element value calcuated value default font size approx 16px <body> unspecified approx 16px <p> .85em 16px x .85em = 13.6px <em> unspecified inherited value = 13.6px
  • 79. Those examples were too simple. What about more complex examples using different elements?
  • 81. All elements have been specified using percentage values. body { font-size: 85%; } h1 { font-size: 200%; } h2 { font-size: 150%; }
  • 82. The browsers default font-size (16px) and the body percentage value (85%) are used to create a calculated value (16px x 85% = 13.6px). This calculated value is inherited by descendants unless new values are specified.
  • 83. The font-size inheritance in action element value calculated font-size default font size approx 16px <body> 85% 16px x 85% = 13.6px <h1> 200% inherited value 13.6px x 200% = 27.2px <h2> 150% inherited value 13.6px x 150% = 20.4px <p> unspecified inherited value = 13.6px <em> unspecified inherited value = 13.6px
  • 84. Using inheritance for efficiency
  • 85. Authors can use inheritance to write efficient CSS.
  • 86. For example, you can set the color, font-size and font-family on the body element. body { color: #222; font-family: arial, helvetica, sans-serif; font-size: 90%; }
  • 87. These properties will be inherited by all descendant elements.
  • 88. You can then override the properties as needed, specifying new color values...
  • 89. body { color: #222; font-family: arial, helvetica, sans-serif; font-size: 90%; } h1, h2, h3 { color: green; } h4, h5, h6 { color: black; }
  • 91. body { color: #222; font-family: arial, helvetica, sans-serif; font-size: 90%; } h1, h2, h3 { color: green; } h4, h5, h6 { color: black; } h1, h2, h3, h4, h5, h6 { font-family: georgia, times, serif; }
  • 92. and new font-size values as needed.
  • 93. } h1, h2, h3 { color: green; } h4, h5, h6 { color: black; } h1, h2, h3, h4, h5, h6 { font-family: georgia, times, serif; } h1 { font-size: 200%; } h2 { font-size: 150%; } h3 { font-size: 125%; } #footer { font-size: 90%; }
  • 94. Now, go forth and inherit the world!