Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <!-- Navigation Bar and Main Header -->
<!------------------------------------>
<nav id="navbar">

  <header id="main-header">
    <h1>CSS BASICS</h1>
  </header>

  <div id="navigation" class="hide">
    <div id="nav-link-group">
      <a class="nav-link" href="#introduction">INTRODUCTION</a>
      <a class="nav-link" href="#you_should_know">YOU SHOULD KNOW</a>
      <a class="nav-link" href="#syntax">SYNTAX</a>
      <a class="nav-link" href="#comments">COMMENTS</a>
      <a class="nav-link" href="#selectors">SELECTORS</a>
      <a class="nav-link" href="#box_model">BOX MODEL</a>
      <a class="nav-link" href="#properties">PROPERTIES</a>
    </div>
  </div>

  <a href="javascript:void(0);" class="icon">
    <i id="menu-icon" class="fa fa-bars"></i>
  </a>

</nav>

<!------- Main Documentation ------->
<!---------------------------------->

<main id="main-doc">

  <!-------- Introduction -------->
  <!------------------------------>
  <section id="introduction" class="main-section">
    <header>
      <h2>INTRODUCTION</h2>
    </header>
    <div class="content">
      <p>This documentation was put together to give the very basic knowledge of CSS usage for website design.</p>
    </div>
  </section>

  <!------- You Should Know ------->
  <!------------------------------->
  <section id="you_should_know" class="main-section">
    <header>
      <h2>YOU SHOULD KNOW</h2>
    </header>
    <div class="content">
      <p>Before going further you should already have the knowledge of what CSS is and how to add it to your site via external or internal code.</p>
    </div>
  </section>

  <!---------- Syntax ---------->
  <!---------------------------->
  <section id="syntax" class="main-section">
    <header>
      <h2>SYNTAX</h2>
    </header>
    <div class="content">
      <p>CSS is set up using selectors and declaration blocks as seen below.</p>
      <div class="code-block">
        <div>
          <code class="yellow inline-code">p</code> <code class="green inline-code">{</code>
        </div>
        <div>
          <code class="red inline-code">color</code><span class="inline-code">:</span> <code class="blue inline-code">green</code><span>;</span>
        </div>
        <code class="green">}</code>
      </div>
      <p class="inline">The CSS above will select all <code class="mini-code">&lt;p&gt;</code> elements and color the text green.</p>
      <ul>
        <li>The selector <code class="yellow mini-code">p</code> points to the HTML element you want to style.</li>
        <li>The declaration block <code class="green mini-code">{ }</code> contains one or more declarations separated by semicolons.</li>
        <li>Each declaration includes a CSS <code class="red mini-code">property</code> and a <code class="blue mini-code">value</code>, separated by a colon <code class="mini-code">:</code>.</li>
        <li>Each declaration must be separated by a semicolon <code class="mini-code">;</code> and each declaration block must be surrounded by curly braces <code class="green mini-code">{ }</code>.</li>
      </ul>
    </div>
  </section>

  <!---------- Comments ---------->
  <!------------------------------>
  <section id="comments" class="main-section">
    <header>
      <h2>COMMENTS</h2>
    </header>
    <div class="content">
      <p>Comments are used to explain the code, and may help when you edit the source code at a later date.</p>
      <p>Comments are ignored by browsers, so they will not appear on the page.</p>
      <p>A CSS comment is placed inside the <code class="mini-code">&lt;style&gt;</code> element. It starts with <code class="mini-code">/*</code> and ends with <code class="mini-code">*/</code>.</p>
      <p>Example:</p>
      <div class="code-block">
        <code class="green">/* This is a comment */</code>
        <code style="padding:0;">h1 {</code>
        <code>font-size: 20px;</code>
        <code>}</code>
      </div>
    </div>
  </section>

  <!---------- Selectors ---------->
  <!------------------------------->
  <section id="selectors" class="main-section">
    <header>
      <h2>SELECTORS</h2>
    </header>
    <div class="content">
      <p>CSS selectors are used to "find" (or select) the HTML elements you want to style.</p>
      <p>Here are a few of the basic selectors out of the many that can be used for directing your CSS styles:</p>
      <ul>

        <!---------- Element Selector ---------->
        <li id="element_selector">
          <h3>Element Selector</h3>
          <p>The element selector selects HTML elements based on the element name.</p>
          <p>In the example below, all <code class="mini-code">&lt;p&gt;</code> elements will have text colored green.</p>
          <p>Example:</p>
          <div class="code-block">
            <code>p {</code>
            <code>color: green;</code>
            <code>}</code>
          </div>
        </li>

        <!---------- ID Selector ---------->
        <li id="id_selector">
          <h3>ID Selector</h3>
          <p>The id selector uses the id attribute of an HTML element to select a specific element.</p>
          <p>The id of an element is unique within a page, so the id selector is used to select one unique element!</p>
          <p>To select an element with a specific id, write a hash (#) character, followed by the id of the element.</p>
          <p>In the example below, the element with <code class="mini-code">id="title"</code> will have text colored green.</p>
          <p>Example:</p>
          <div class="code-block">
            <code>#title {</code>
            <code>color: green;</code>
            <code>}</code>
          </div>
        </li>

        <!---------- Class Selector ---------->
        <li id="class_selector">
          <h3>Class Selector</h3>
          <p>The class selector selects HTML elements with a specific class attribute.</p>
          <p>To select elements with a specific class, write a period (.) character, followed by the class name.</p>
          <p>In the example below, the element with <code class="mini-code">class="green"</code> will have text colored green.</p>
          <p>Example:</p>
          <div class="code-block">
            <code>.green {</code>
            <code>color: green;</code>
            <code>}</code>
          </div>
        </li>

        <!---------- Universal Selector ---------->
        <li id="universal_selector">
          <h3>Universal Selector</h3>
          <p>The universal selector <code class="mini-code">*</code> selects all HTML elements on the page.</p>
          <p>In the example below, all elements will have their text colored green.</p>
          <p>Example:</p>
          <div class="code-block">
            <code>* {</code>
            <code>color: green;</code>
            <code>}</code>
          </div>
        </li>

        <!---------- Grouping Selector ---------->
        <li id="grouping_selector">
          <h3>Grouping Selector</h3>
          <p>The grouping selector selects all the HTML elements with the same style definitions.</p>
          <p>To group selectors, simply separate them with a comma <code class="mini-code">,</code>.</p>
          <p>This can be useful when multiple elements are needing the same CSS styles added and will minimize the code.</p>
          <p>In the example below, all <code class="mini-code">&lt;h1&gt;</code>, <code class="mini-code">&lt;h2&gt;</code>, and <code class="mini-code">&lt;p&gt;</code> elements will have their text colored green.</p>
          <p>Example:</p>
          <div class="code-block">
            <code>h1, h2, p {</code>
            <code>color: green;</code>
            <code>}</code>
          </div>
        </li>
      </ul>
    </div>
  </section>

  <!---------- Box Model ---------->
  <!------------------------------->
  <section id="box_model" class="main-section">
    <header>
      <h2>BOX MODEL</h2>
    </header>
    <div class="content">
      <p>All HTML elements can be considered as boxes. In CSS, the term "box model" is used when talking about design and layout.</p>
      <p>The CSS box model is essentially a box that wraps around every HTML element. It consists of: margins, borders, padding, and the actual content.</p>
      <p>The image below illustrates the box model:</p>
      <div id="box-model-diagram">
        <div id="box-model-margin">
          <p>Margin</p>
          <div id="box-model-border">
            <p>Border</p>
            <div id="box-model-padding">
              <p>Padding</p>
              <div id="box-model-content">
                <p>Content</p>
              </div>
            </div>
          </div>
        </div>
      </div>
      <p>Explanation of the different parts:</p>
      <ul>
        <li><strong>Content</strong> - The content of the box, where text and images appear</li>
        <li><strong>Padding</strong> - Clears an area around the content. The padding is transparent</li>
        <li><strong>Border</strong> - A border that goes around the padding and content</li>
        <li><strong>Margin</strong> - Clears an area outside the border. The margin is transparent</li>
      </ul>
      <p>The following section PROPERTIES contains examples of the CSS used to style the box model of elements.</p>
    </div>
  </section>

  <!---------- Properties ---------->
  <!-------------------------------->
  <section id="properties" class="main-section">
    <header>
      <h2>PROPERTIES</h2>
    </header>
    <div class="content">
      <p>CSS properties are many and varied. Below are several common properties and their uses.</p>
      <ul>
        <li id="text">
          <h3>Text</h3>
          <ul>
            <li id="text_color">
              <h4>Text Color</h4>
              <p>The <code class="mini-code">color</code> property is used to set the color of the text.</p>
              <p>The color is specified by:</p>
              <ul>
                <li>a color name - like <code class="mini-code">red</code></li>
                <li>a HEX value - like <code class="mini-code">#ff0000</code></li>
                <li>an RGB value - like <code class="mini-code">rgb(255,0,0)</code></li>
              </ul>
              <p>In the example below, the HEX value of <code class="mini-code">#ff0000</code>, which is red, will be applied to the text of all <code class="mini-code">p</code> elements.</p>
              <p>Example:</p>
              <div class="code-block">
                <code>p {</code>
                <code>color: #ff0000;</code>
                <code>}</code>
              </div>
            </li>
            <li id="text_alignment">
              <h4>Text Alignment</h4>
              <p>The <code class="mini-code">text-align</code> property is used to set the horizontal alignment of a text.</p>
              <p>Text can be left or right aligned, centered, or justified.</p>
              <p>In the example below, center alignment is used which would center the text within its container.</p>
              <p>Example:</p>
              <div class="code-block">
                <code>p {</code>
                <code>text-align: center;</code>
                <code>}</code>
              </div>
            </li>
          </ul>
        </li>
        <li id="background">
          <h3>Background</h3>
          <p>The CSS background properties are used to define the background effects for elements.</p>
          <p>The most basic background property is <code class="mini-code">background-color</code>.</p>
          <p>Background color will take the same color values as discussed earlier in <a class="jump-link" href="#text_color">Text Color</a>.</p>
          <p>In the example below, the background color of the element is changed to light green.</p>
          <p>Example:</p>
          <div class="code-block">
            <code>h1 {</code>
            <code>background-color: lightgreen;</code>
            <code>}</code>
          </div>
        </li>
        <li id="border">
          <h3>Border</h3>
          <p>The CSS <code class="mini-code">border</code> property allows you to specify the style, width, and color of an element's border.</p>
          <ul>
            <li id="border_style" class="drop-top">
              <h4>Border Style</h4>
              <p>The <code class="mini-code">border-style</code> property specifies what kind of border to display.</p>
              <p>The following values are allowed:</p>
              <ul>
                <li><code class="mini-code">none</code> - Defines no border</li>
                <li><code class="mini-code">hidden</code> - Defines a hidden border</li>
                <li><code class="mini-code">solid</code> - Defines a solid border</li>
                <li><code class="mini-code">dotted</code> - Defines a dotted border</li>
                <li><code class="mini-code">dashed</code> - Defines a dashed border</li>
                <li><code class="mini-code">double</code> - Defines a double border</li>
                <li><code class="mini-code">groove</code> - Defines a 3D grooved border. The effect depends on the border-color value</li>
                <li><code class="mini-code">ridge</code> - Defines a 3D ridged border. The effect depends on the border-color value</li>
                <li><code class="mini-code">inset</code> - Defines a 3D inset border. The effect depends on the border-color value</li>
                <li><code class="mini-code">outset</code> - Defines a 3D outset border. The effect depends on the border-color value</li>
              </ul>
              <p>In the example below, a <code class="mini-code">border-style</code> of dashed can be seen around the text following the code.</p>
              <p>Example:</p>
              <div class="code-block">
                <code>p {</code>
                <code>border-style: dashed;</code>
                <code>}</code>
              </div>
              <p id="border-style-ex">The border around this text is dashed.</p>
            </li>
            <li id="border_width" class="drop-top">
              <h4>Border Width</h4>
              <p>The border-width property specifies the width of the four borders.</p>
              <p>The width can be set as a specific size (px, pt, cm, em, etc) or by using one of the three pre-defined values: thin, medium, or thick.</p>
              <p>In the example below, a <code class="mini-code">border-width</code> of 4px can be seen around the text following the code.</p>
              <p>Example:</p>
              <div class="code-block">
                <code>p {</code>
                <code>border-width: 4px;</code>
                <code>}</code>
              </div>
              <p id="border-width-ex">The border around this text is 4px.</p>
            </li>
            <li id="border_color" class="drop-top">
              <h4>Border Color</h4>
              <p>The <code class="mini-code">border-color</code> property is used to set the color of the four borders.</p>
              <p>The color can be set by:</p>
              <ul>
                <li>name - specify a color name, like <code class="mini-code">red</code></li>
                <li>HEX - specify a HEX value, like <code class="mini-code">#ff0000</code></li>
                <li>RGB - specify a RGB value, like <code class="mini-code">rgb(255,0,0)</code></li>
                <li>HSL - specify a HSL value, like <code class="mini-code">hsl(0, 100%, 50%)</code></li>
                <li>transparent - specify 0 opacity, like <code class="mini-code">transparent</code></li>
              </ul>
              <p><strong>Note:</strong> If <code class="mini-code">border-color</code> is not set, it inherits the color of the element.</p>
              <p>In the example below, a <code class="mini-code">border-color</code> of blue can be seen around the text following the code.</p>
              <p>Example:</p>
              <div class="code-block">
                <code>p {</code>
                <code>border-color: blue;</code>
                <code>}</code>
              </div>
              <p id="border-color-ex">The border around this text is blue.</p>
            </li>
            <li id="border_shorthand" class="drop-top">
              <h4>Border Shorthand</h4>
              <p>As seen in the previous section, there are many properties to consider when dealing with borders.</p>
              <p>To shorten the code, it is also possible to specify all the individual border properties in one property.</p>
              <p>The <code class="mini-code">border</code> property is a shorthand property for the following individual border properties:</p>
              <div class="code-block">
                <ul>
                  <li><code class="mini-code">border-width</code></li>
                  <li><code class="mini-code">border-style</code> <span>(required)</span></li>
                  <li><code class="mini-code">border-color</code></li>
                </ul>
              </div>
              <p>In the example below, a <code class="mini-code">border</code> of thick red dotted can be seen around the text following the code.</p>
              <p>Example:</p>
              <div class="code-block">
                <code>p {</code>
                <code>border: thick red dotted;</code>
                <code>}</code>
              </div>
              <p id="border-ex">The border around this text is thick red dotted.</p>
            </li>
            <li id="rounded_border">
              <h4>Rounded Border</h4>
              <p>The <code class="mini-code">border-radius</code> property is used to add rounded borders to an element.</p>
              <p>The radius can be set to a specific size using px, pt, cm, em, etc or by using a percentage.</p>
              <p>In the example below, a <code class="mini-code">border-radius</code> of 10px can be seen around the text following the code.</p>
              <p>Example:</p>
              <div class="code-block">
                <code>p {</code>
                <code>border-radius: 10px;</code>
                <code>}</code>
              </div>
              <p id="border-radius-ex">The border around this text is rounded by 10px.</p>
            </li>
          </ul>
        </li>
        <li id="margin">
          <h3>Margin</h3>
          <p>The CSS <code class="mini-code">margin</code> properties are used to create space around elements, outside of any defined borders.</p>
          <p>There are several ways to specify the margin for elements.</p>
          <ul>
            <li id="margin_individual_sides">
              <h4>Individual Sides</h4>
              <p>CSS has properties for specifying the margin for each side of an element:</p>
              <div class="code-block">
                <ul>
                  <li><code>margin-top</code></li>
                  <li><code>margin-right</code></li>
                  <li><code>margin-bottom</code></li>
                  <li><code>margin-left</code></li>
                </ul>
              </div>
              <p>All margin properties can be defined with values of length (px, pt, cm, etc), percentage, or auto which allows the browser to define the margin.</p>
              <p class="note"><strong>Note:</strong>Negative values are allowed.</p>
              <p>In the example below, all four margins are defined using some different values mentioned before.</p>
              <p>Example:</p>
              <div class="code-block">
                <code>h1 {</code>
                <code>margin-top: 10%;</code>
                <code>margin-right: 15px;</code>
                <code>margin-bottom: auto;</code>
                <code>margin-left: -5pt;</code>
                <code>}</code>
              </div>
            </li>
            <li id="margin_shorthand">
              <h4>Shorthand</h4>
              <p>To shorten the code, it is possible to specify all of the margin values in one property.</p>
              <p>Instead of writing out each margin side separately, the values can be ordered next to one property of <code>margin</code>.</p>
              <p>Next to the <code class="mini-code">margin</code> property, the four values are written starting the the desired value for the top margin, going clockwise to the right margin, bottom margin, and then left margin.</p>
              <p>As before, all margin values can be defined in length (px, pt, cm, etc), percentage, or auto.</p>
              <p>In the example below, <code class="mini-code">&lt;p&gt;</code> elements have their margins defined as follows:</p>
              <div class="code-block">
                <ul>
                  <li><code>margin-top: 20px;</code></li>
                  <li><code>margin-right: 10px;</code></li>
                  <li><code>margin-bottom: 30px;</code></li>
                  <li><code>margin-left: 45px;</code></li>
                </ul>
              </div>
              <p>Example:</p>
              <div class="code-block">
                <code>p {</code>
                <code>margin: 20px 10px 30px 45px;</code>
                <code>}</code>
              </div>
              <p>It is also possible to write the code shorter by using only three, two, or even one value.</p>
              <p>When writing the values like this, the top margin value will be used for the missing bottom margin and a right margin value will be used for the missing left value. If only one value is specified, all sides will be set to the same value.</p>
              <p>The two examples below will show the three and two value methods.</p>
              <p>Three value example:</p>
              <p>In this example, the margins are defined as follows:</p>
              <div class="code-block">
                <ul>
                  <li><code>margin-top: 20px;</code></li>
                  <li><code>margin-right: 10px;</code></li>
                  <li><code>margin-bottom: 30px;</code></li>
                  <li><code>margin-left: 10px;</code></li>
                </ul>
              </div>
              <div class="code-block">
                <code>p {</code>
                <code>margin: 20px 10px 30px;</code>
                <code>}</code>
              </div>
              <p>Two value example:</p>
              <p>In this example, the margins are defined as follows:</p>
              <div class="code-block">
                <ul>
                  <li><code>margin-top: 20px;</code></li>
                  <li><code>margin-right: 10px;</code></li>
                  <li><code>margin-bottom: 20px;</code></li>
                  <li><code>margin-left: 10px;</code></li>
                </ul>
              </div>
              <div class="code-block">
                <code>p {</code>
                <code>margin: 20px 10px;</code>
                <code>}</code>
              </div>
            </li>
            <li id="margin_auto">
              <h4>Auto</h4>
              <p>You can set the margin value to <code class="mini-code">auto</code> to horizontally center the element within its container.</p>
              <p>The element will take up any specified width, and the remaining space will be split equally between the left and right margins essentially centering it.</p>
              <p>The example CSS below is followed by a figure that is 250px wide and using auto for its margin settings.</p>
              <p>Example:</p>
              <div class="code-block">
                <code>div {</code>
                <code>border: 2px solid green;</code>
                <code>margin: auto;</code>
                <code>width: 250px</code>
                <code>}</code>
              </div>
              <div id="margin-auto-ex">
                <p>This box has a margin of auto.</p>
              </div>
            </li>
          </ul>
        </li>
        <li id="padding">
          <h3>Padding</h3>
          <p>The CSS <code class="mini-code">padding</code> properties are used to generate space around an element's content, inside of any defined borders.</p>
          <p>With CSS, you have full control over the padding. There are properties for setting the padding for each side of an element (top, right, bottom, and left).</p>
          <p>There are several ways to specify the padding for elements.</p>
          <ul>
            <li id="padding_individual_sides">
              <h4>Individual Sides</h4>
              <p>CSS has properties for specifying the padding for each side of an element:</p>
              <ul class="code-block">
                <li><code>padding-top</code></li>
                <li><code>padding-right</code></li>
                <li><code>padding-bottom</code></li>
                <li><code>padding-left</code></li>
              </ul>
              <p>All padding properties can be defined with values of length (px, pt, cm, etc) or percentage.</p>
              <p class="note"><strong>Note:</strong>Negative values are not allowed.</p>
              <p>In the example below, all four padding are defined using some different values mentioned before.</p>
              <p>Example:</p>
              <div class="code-block">
                <code>h1 {</code>
                <code>padding-top: 10%;</code>
                <code>padding-right: 15px;</code>
                <code>padding-bottom: 30%;</code>
                <code>padding-left: 5px;</code>
                <code>}</code>
              </div>
            </li>
            <li id="padding_shorthand">
              <h4>Shorthand</h4>
              <p>To shorten the code, it is possible to specify all of the padding values in one property.</p>
              <p>Instead of writing out each padding side separately, the values can be ordered next to one property of <code class="mini-code">padding</code>.</p>
              <p>Next to the <code class="mini-code">padding</code> property, the four values are written starting the the desired value for the top padding, going clockwise to the right padding, bottom padding, and then left padding.</p>
              <p>As before, all padding values can be defined in length (px, pt, cm, etc) or percentage.</p>
              <p>In the example below, <code class="mini-code">&lt;p&gt;</code> elements have their padding defined as follows:</p>
              <div class="code-block">
                <ul>
                  <li><code>padding-top: 20px;</code></li>
                  <li><code>padding-right: 10px;</code></li>
                  <li><code>padding-bottom: 30px;</code></li>
                  <li><code>padding-left: 45px;</code></li>
                </ul>
              </div>
              <p>Example:</p>
              <div class="code-block">
                <code>p {</code>
                <code>padding: 20px 10px 30px 45px;</code>
                <code>}</code>
              </div>
              <p>It is also possible to write the code shorter by using only three, two, or even one value.</p>
              <p>When writing the values like this, the top padding value will be used for the missing bottom padding and a right padding value will be used for the missing left value. If only one value is specified, all sides will be set to the same value.</p>
              <p>The two examples below will show you the three and two value methods.</p>
              <p>Three value example:</p>
              <p>In this example, the paddings are defined as follows:</p>
              <div class="code-block">
                <ul>
                  <li><code>padding-top: 20px;</code></li>
                  <li><code>padding-right: 10px;</code></li>
                  <li><code>padding-bottom: 30px;</code></li>
                  <li><code>padding-left: 10px;</code></li>
                </ul>
              </div>
              <div class="code-block">
                <code>p {</code>
                <code>padding: 20px 10px 30px;</code>
                <code>}</code>
              </div>
              <p>Two value example:</p>
              <p>In this example, the paddings are defined as follows:</p>
              <div class="code-block">
                <ul>
                  <li><code>padding-top: 20px;</code></li>
                  <li><code>padding-right: 10px;</code></li>
                  <li><code>padding-bottom: 20px;</code></li>
                  <li><code>padding-left: 10px;</code></li>
                </ul>
              </div>
              <div class="code-block">
                <code>p {</code>
                <code>padding: 20px 10px;</code>
                <code>}</code>
              </div>
            </li>
          </ul>
        </li>
        <li id="height_width">
          <h3>Height/Width</h3>
          <p>The <code class="mini-code">height</code> and <code class="mini-code">width</code> properties are used to set the height and width of an element.</p>
          <p>The height and width properties do not include padding, borders, or margins. It sets the height/width of the area inside the padding, border, and margin of the element.</p>
          <p>The <code class="mini-code">height</code> and <code class="mini-code">width</code> properties may have the values of length (px, pt, cm, etc), percentage, or auto which will allow the browser to define the height or width.</p>
          <p>The example CSS below is followed by a figure that is 300px wide and 100px high.</p>
          <div class="code-block">
            <code>div {</code>
            <code>background-color: lightgreen;</code>
            <code>height: 100px;</code>
            <code>width: 300px;</code>
            <code>}</code>
          </div>
          <div id="height-width-ex">
            <p>This box is 300px wide and 100px high.</p>
          </div>
        </li>
      </ul>
    </div>
  </section>

</main>

<footer>
  <p>Cory OBrien 2020</p>
</footer>
              
            
!

CSS

              
                /*******

Colors 
Light - E7E6E2
LAccent 84A294
Main -- C17D29
DAccent 7C6C3F
Dark -- 2F3027

********/

/************** Global CSS ***********/
/*************************************/
*,
*::before,
*::after {
  box-sizing: border-box;
  list-style: none;
}

body {
  background-color: #E7E6E2;
  font-family: "roboto", sans-serif;
  margin: 0 0 0 260px;
  padding: 0;
}

p,
code {
  font-size: 16px;
}

/************* Navigation *************/
/**************************************/

h1 {
  background-color: #c17d29;
  color: #e7e6e2;
  font-size: 30px;
  line-height: 50px;
  margin: 0;
  padding: 0 45px;
  width: 100%;
}

#navbar a.icon {
  display: none;
}

#navbar {
  left: 0;
  margin: 0;
  padding: 0;
  position: fixed;
  text-align: left;
  top: 0;
  width: 260px;
}

.nav-link {
  border-bottom: 1px solid #2F3027;
  color: #C17D29;
  display: block;
  font-size: 20px;
  height: 60px;
  line-height: 60px;
  margin: 0;
  padding: 0 0 0 10px;
  text-decoration: none;
  width: 260px;
}

.nav-link:hover {
  background-color: rgba(0, 0, 0, 0.1);
}

.hide {
  display: block;
}

/*********** Main Content ***********/
/************************************/

main {
  background-color: #e7e6e2;
  border-left: 1px solid #2F3027;
  color: #2f3027;
}

h2 {
  background-color: #2f3027;
  color: #e7e6e2;
  display: block;
  font-family: "arimo", sans-serif;
  line-height: 50px;
  margin: 0;
  padding: 0;
  text-align: center;
  width: 100%;
}

.content {
  margin: 0 auto;
  padding: 10px 20px;
  max-width: 800px;
}

ul {
  margin-left: -25px;
}

.jump-link {
  color: #c17d29;
  text-decoration: none;
}

.mini-code {
  background-color: #84a294;
  border-radius: 5px;
  color: #e7e6e2;
  display: inline-block;
  padding: 0 4px;
  vertical-align: middle;
}

code {
  display: block;
}

.inline-code {
  display: inline-block;
}

.code-block {
  background-color: #84a294;
  border-radius: 5px;
  box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19),
    inset 0 3px 4px 0 rgba(0, 0, 0, 0.1);
  color: #e7e6e2;
  display: inline-block;
  font-family: "source code pro", monospace;
  margin: 10px auto;
  padding: 8px 15px;
}

.code-block > * {
  margin: 0;
  padding-left: 15px;
}

.code-block > *:first-child,
.code-block > *:last-child {
  padding: 0;
}

.yellow {
  color: yellow;
}

.green {
  color: green;
}

.red {
  color: red;
}

.blue {
  color: blue;
}

.code-inline {
  display: inline-block;
}

/************* Box Model *************/
/*************************************/

#box-model-diagram {
  margin: 20px auto;
  width: 100%;
}

#box-model-diagram p {
  margin: 0;
  padding: 3px;
}

#box-model-margin {
  background-color: #7c6c3f;
  color: #e7e6e2;
  height: 200px;
  margin: 0 auto;
  text-align: center;
  width: 340px;
}

#box-model-border {
  background-color: #e7e6e2;
  color: #2f3027;
  height: 150px;
  margin: 0 auto;
  width: 300px;
}

#box-model-padding {
  background-color: #7c6c3f;
  color: #e7e6e2;
  height: 100px;
  margin: 0 auto;
  width: 260px;
}

#box-model-content {
  background-color: #e7e6e2;
  color: #2f3027;
  height: 50px;
  margin: 0 auto;
  width: 220px;
}

#box-model-content p {
  line-height: 50px;
  padding: 0;
}

/********** Border Examples **********/
/*************************************/

#border-style-ex {
  border-style: dashed;
  border-width: 2px;
  padding: 4px;
  text-align: center;
}

#border-width-ex {
  border-style: solid;
  border-width: 4px;
  padding: 4px;
  text-align: center;
}

#border-color-ex {
  border-color: blue;
  border-style: solid;
  border-width: 3px;
  padding: 4px;
  text-align: center;
}

#border-ex {
  border-color: red;
  border-style: dotted;
  border-width: thick;
  padding: 4px;
  text-align: center;
}

#border-radius-ex {
  border-color: green;
  border-radius: 10px;
  border-style: solid;
  border-width: 2px;
  padding: 4px;
  text-align: center;
}

/********** Margin Examples **********/
/*************************************/

#margin-auto-ex {
  border: 2px solid green;
  margin: 10px auto;
  text-align: center;
  width: 250px;
}

/********** Height-Width Examples **********/
/*******************************************/

#height-width-ex {
  background-color: lightgreen;
  height: 100px;
  margin: 10px auto;
  text-align: center;
  width: 300px;
}

#height-width-ex > p {
  line-height: 100px;
}

/*************** Footer ***************/
/**************************************/

footer p {
  background-color: #c17d29;
  bottom: 0;
  color: #e7e6e2;
  line-height: 20px;
  margin: 0;
  padding: 0 10px;
  text-align: right;
}

/*************** Media Query ***************/
/*******************************************/
@media only screen and (max-width: 20cm) {
  
  body {
    margin: 0;
    padding: 50px 0 0;
  }
  
  main {
    border: none;
  }
  
  .main-section::before {
    content: "";
    display: block;
    padding: 50px 0 0 0;
    margin: -50px 0 0 0;
  }
  
  .hide {
    display: none;
  }

  /* Style the navigation menu */
  #navbar {
    margin: initial;
    overflow: hidden;
    padding: initial;
    position: fixed;
    top: 0;
    width: 100%;
  }

  /* Style navigation menu links */
  #nav-link-group {
    background-color: #2f3027;
    border-radius: 5px;
    float: right;
    height: 370px;
    width: 215px;
  }

  #nav-link-group:first-child {
    padding-top: 10px;
  }

  #navbar a {
    border-radius: 5px;
    display: block;
    font-size: 17px;
    line-height: 50px;
    padding: 0 10px;
    text-align: center;
    text-decoration: none;
  }

  .nav-link {
    background-color: #e7e6e2;
    border: none;
    color: #323835;
    display: inline-block;
    font-size: initial;
    height: initial;
    line-height: initial;
    margin: 0 auto;
    padding: initial;
    text-decoration: initial;
    width: 200px;
  }

  /* Style the hamburger menu */
  #navbar a.icon {
    color: #e7e6e2;
    background-color: #c17d29;
    display: block;
    font-size: 20px;
    position: absolute;
    right: 0;
    top: 0;
    width: 50px;
  }

  /* Add a background color on mouse-over */
  .nav-link:hover {
    background-color: #c17d29;
    color: #e7e6e2;
  }
}
              
            
!

JS

              
                /********* NavBar Javascript *********/
/*************************************/
document.addEventListener("mouseup", (evt) => {
  const icon = document.getElementById("menu-icon");
  const menu = document.getElementById("navigation");
  var point = evt.target;
  if ((point == icon || point == icon.parentNode) && menu.classList.contains("hide")) {
    menu.classList.remove("hide");
  } else {
    menu.classList.add("hide");
  }
});
              
            
!
999px

Console