Pen Settings

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

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation

     

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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              <!DOCTYPE html>
<html lang="en">

<head>
<script src="https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js"></script>
</head>

<body>
<nav id="navbar">
<header>CSS Documentation</header>
<ul>
<li><a class="nav-link" href="#CSS_first_steps">CSS first steps</a></li>
<li>
<a class="nav-link" href="#Styling_text">Styling text</a>
</li>
<li>
<a class="nav-link" href="#CSS_building_blocks">CSS building blocks</a>
</li>
<li><a class="nav-link" href="#CSS_layout">CSS layout</a></li>
<li><a class="nav-link" href="#CSS_Flexible_Box_Layout">CSS Flexible Box Layout</a></li>
<li>
<a class="nav-link" href="#CSS_Grid_Layout">CSS Grid Layout</a>
</li>
<li><a class="nav-link" href="#Media_queries">Media queries</a></li>
<li>
<a class="nav-link" href="#animation">animation</a>
</li>
<li><a class="nav-link" href="#Reference">Reference</a></li>
</ul>
</nav>
<main id="main-doc">
    <section class="main-section" id="CSS_first_steps">
    <header>CSS first steps</header>
    <article>
    <p>
        Cascading Style Sheets (CSS) is a stylesheet language used to describe the presentation of a document written in HTML or XML (including XML dialects such as SVG, MathML or XHTML). CSS describes how elements should be rendered on screen, on paper, in speech, or on other media.
    </p>
    <p>
        CSS is one of the core languages of the open Web and is standardized across Web browsers according to the W3C specification. Developed in levels, CSS1 is now obsolete, CSS2.1 is a recommendation, and CSS3, now split into smaller modules, is progressing on the standardization track.
    </p>
    </article>
    </section>
    <section class="main-section" id="Styling_text">
    <header>Styling text</header>
    <article>
    <p>This guide assumes you have the following basic background:</p>
    <ul>
    <li>
    A general understanding of the Internet and the World Wide Web (WWW).
    </li>
    <li>Good working knowledge of HyperText Markup Language (HTML).</li>
    <li>
    Some programming experience. If you are new to programming, try one of
    the tutorials linked on the main page about JavaScript.
    </li>
    </ul>
    </article>
    </section>
    <section class="main-section" id="CSS_building_blocks">
    <header>CSS building blocks</header>
    <article>
    <p>
            This module carries on where CSS first steps left off — now you've gained familiarity with the language and its syntax, and got some basic experience with using it, its time to dive a bit deeper. This module looks at the cascade and inheritance, all the selector types we have available, units, sizing, styling backgrounds and borders, debugging, and lots more.

            The aim here is to provide you with a toolkit for writing competent CSS and help you understand all the essential theory, before moving on to more specific disciplines like text styling and CSS layout.
    </p>
    </article>
    </section>
    <section class="main-section" id="CSS_layout">
    <header>CSS layout</header>
    <article>
        <p>
            At this point we've already looked at CSS fundamentals, how to style text, and how to style and manipulate the boxes that your content sits inside. Now it's time to look at how to place your boxes in the right place in relation to the viewport, and one another. We have covered the necessary prerequisites so we can now dive deep into CSS layout, looking at different display settings, modern layout tools like flexbox, CSS grid, and positioning, and some of the legacy techniques you might still want to know about.
        </p>
    <code>
        <p style="margin:-20px 10px -10px 10px;padding: -20px;">I love my cat.</p>
        <ul style="margin:-20px 10px -10px 10px;padding: -20px;">
          <li style="margin:-20px 10px -10px 10px;padding: -20px;">Buy cat food</li>
          <li style="margin:-20px 10px -10px 10px;padding: -20px;">Exercise</li>
          <li style="margin:-20px 10px -10px 10px;padding: -20px;">Cheer up friend</li>
        </ul>  
        <p style="margin:-20px 10px -10px 10px;padding: -20px;">The end!</p>
    </code>
    </article>
    </section>
    <section class="main-section" id="CSS_Flexible_Box_Layout">
    <header>CSS Flexible Box Layout</header>
    <p>
            Flexbox is the short name for the Flexible Box Layout Module, designed to make it easy for us to lay things out in one dimension — either as a row or as a column. To use flexbox, you apply display: flex to the parent element of the elements you want to lay out; all its direct children then become flex items. We can see this in a simple example.

            The HTML markup below gives us a containing element, with a class of wrapper, inside which are three <div> elements. By default these would display as block elements, below one another, in our English language document.
            
            However, if we add display: flex to the parent, the three items now arrange themselves into columns. This is due to them becoming flex items and using some initial values that flexbox gives them. They are displayed as a row, because the initial value of flex-direction is row. They all appear to stretch to the height of the tallest item, because the initial value of the align-items property is stretch. This means that the items stretch to the height of the flex container, which in this case is defined by the tallest item. The items all line up at the start of the container, leaving any extra space at the end of the row.
    </p>
    <code>
    .wrapper { display: flex;}
    </code>
    </section>
    <section class="main-section" id="CSS_Grid_Layout">
            <header>CSS Grid Layout</header>
            <article>
                    CSS Grid Layout excels at dividing a page into major regions or defining the relationship in terms of size, position, and layer, between parts of a control built from HTML primitives.

                    Like tables, grid layout enables an author to align elements into columns and rows. However, many more layouts are either possible or easier with CSS grid than they were with tables. For example, a grid container's child elements could position themselves so they actually overlap and layer, similar to CSS positioned elements.
<code>
    .wrapper {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        grid-gap: 10px;
        grid-auto-rows: minmax(100px, auto);
        }
        .one {
        grid-column: 1 / 3;
        grid-row: 1;
        }
        .two { 
        grid-column: 2 / 4;
        grid-row: 1 / 3;
        }
        .three {
        grid-column: 1;
        grid-row: 2 / 5;
        }
        .four {
        grid-column: 3;
        grid-row: 3;
        }
        .five {
        grid-column: 2;
        grid-row: 4;
        }
        .six {
        grid-column: 3;
        grid-row: 4;
        }
</code>
            </article>
            </section>
    <section class="main-section" id="Media_queries">
    <header>Media queries</header>
    <article>
    <p>
            Media queries let you adapt your site or app depending on the presence or value of various device characteristics and parameters.

            They are a key component of responsive design. For example, a media query can shrink the font size on small devices, increase the padding between paragraphs when a page is viewed in portrait mode, or bump up the size of buttons on touchscreens.
            
            In CSS, use the @media at-rule to conditionally apply part of a style sheet based on the result of a media query. Use @import to conditionally apply an entire style sheet.
    </p>
    </article>
    </section>
    <section class="main-section" id="animation">
    <header>animation</header>
    <article>
    <p>
            The animation shorthand CSS property applies an animation between styles. It is a shorthand for animation-name, animation-duration, animation-timing-function, animation-delay, animation-iteration-count, animation-direction, animation-fill-mode, and animation-play-state.
    </p>
    <p>
            Blinking and flashing animation can be problematic for people with cognitive concerns such as Attention Deficit Hyperactivity Disorder (ADHD). Additionally, certain kinds of motion can be a trigger for Vestibular disorders, epilepsy, and migraine and Scotopic sensitivity.
    </p>
    <code>
        div {
            width: 100px;
            height: 100px;
            background-color: red;
            -webkit-animation-name: example; /* Safari 4.0 - 8.0 */
            -webkit-animation-duration: 4s; /* Safari 4.0 - 8.0 */
            animation-name: example;
            animation-duration: 4s;
            }
    </code>
    <p>
            The following example uses the value "alternate-reverse" to make the animation run backwards first, then forwards:

            Example
    </p>
    <code>
        div {
            width: 100px;
            height: 100px;
            position: relative;
            background-color: red;
            animation-name: example;
            animation-duration: 4s;
            animation-iteration-count: 2;
            animation-direction: alternate-reverse;
            }
    </code>
    </article>
    </section>
    <section class="main-section" id="Reference">
    <header>Reference</header>
    <article>
    <ul>
    <li>
   Sources:
    <a href="https://developer.mozilla.org/en-US/docs/Web/CSS" target="_blank">MDN</a>
    <a href="https://www.w3schools.com/css/css3_animations.asp" target="_blank">W3S</a>
    </li>
    </ul>
    </article>
    </section>
    </main>
  </body>
</html>
            
          
!
            
              nav {
  width: 40%;
  margin-right: 30px;
  line-height: 3.5;
  text-align: center;
  height: 100%;
}
#navbar {
  position: fixed;
  min-width: 290px;
  top: 0px;
  left: 0px;
  width: 300px;
  height: 100%;
}

#main-doc {
  position: absolute;
  margin-left: 310px;
  margin-top: 30px;
}

header {
  font-size: 1.8em;
}

nav ul {
  padding: 0px;
}
nav li a {
  text-decoration: none;
  color: black;
}
nav li {
  list-style: none;
  border: 1px solid black;
}
code {
  display: block;
  text-align: left;
  white-space: pre;
  position: relative;
  word-break: normal;
  word-wrap: normal;
  line-height: 2;
  background-color: #f7f7f7;
  padding: 15px;
  margin: 10px;
  border-radius: 5px;
}
@media only screen and (max-width: 815px) {
  body {
    flex-flow: column;
  }
  #navbar {
    position: relative;
    width: 100%;
  }
  nav {
    width: 100%;
    line-height: 5;
  }
  #main-doc {
    margin-top: 30px;
    position: absolute;
    margin-left: 0;
  }
}

            
          
!
            
              // !! IMPORTANT README:

// You may add additional external JS and CSS as needed to complete the project, however the current external resource MUST remain in place for the tests to work. BABEL must also be left in place.

/***********
INSTRUCTIONS:
  - Select the project you would 
    like to complete from the dropdown 
    menu.
  - Click the "RUN TESTS" button to
    run the tests against the blank 
    pen.
  - Click the "TESTS" button to see 
    the individual test cases. 
    (should all be failing at first)
  - Start coding! As you fulfill each
    test case, you will see them go   
    from red to green.
  - As you start to build out your 
    project, when tests are failing, 
    you should get helpful errors 
    along the way!
    ************/

// PLEASE NOTE: Adding global style rules using the * selector, or by adding rules to body {..} or html {..}, or to all elements within body or html, i.e. h1 {..}, has the potential to pollute the test suite's CSS. Try adding: * { color: red }, for a quick example!

// Once you have read the above messages, you can delete all comments.

            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.

Console