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


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


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.


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.


                <script src=""></script>

<nav id="navbar">
  <header id="nav-header">CSS Shorthand Properties</header> 
  <ul id="nav-links">
    <li><a class="nav-link" href="#shorthand_properties">Shorthand Properties</a></li>
    <li><a class="nav-link" href="#tricky_edge_cases">Tricky Edge Cases</a></li>
    <li><a class="nav-link" href="#background_properties">Background Properties</a></li>
    <li><a class="nav-link" href="#font_properties">Font Properties</a></li>
    <li><a class="nav-link" href="#border_properties">Border Properties</a></li>
    <li><a class="nav-link" href="#margin_and_padding_properties">Margin and Padding Properties</a></li>
    <li><a class="nav-link" href="#universal_shorthand_property">Universal Shorthand Property</a></li>
    <li><a class="nav-link" href="#reference">Reference</a></li>

<main id="main-doc">
  <section class="main-section" id="shorthand_properties">
    <header>Shorthand Properties</header>
    <p>Shorthand properties are CSS properties that let you set the values of multiple other CSS properties simultaneously. Using a shorthand property, you can write more concise (and often more readable) style sheets, saving time and energy.</p>
    <p>The CSS specification defines shorthand properties to group the definition of common properties acting on the same theme. For instance, the CSS background property is a shorthand property that's able to define the values of background-color, background-image, background-repeat, and background-position. Similarly, the most common font-related properties can be defined using the shorthand font, and the different margins around a box can be defined using the margin shorthand.</p>
    <section class="main-section" id="tricky_edge_cases">
      <header>Tricky Edge Cases</header>
      <p>Even if they are very convenient to use, there are a few edge cases to keep in mind when using them:</p>
        <li>A value which is not specified is set to its initial value. That sounds anecdotal, but it really means that it overrides previously set values. Therefore: <code>background-color: red;<br>
background: url(images/bg.gif) no-repeat left top;<br></code>will not set the color of the background to red but to background-color's default, transparent, as the second rule has precedence.</li>
        <li>Only the individual properties values can inherit. As missing values are replaced by their initial value, it is impossible to allow inheritance of individual properties by omitting them. The keyword inherit can be applied to a property, but only as a whole, not as a keyword for one value or another. That means that the only way to make some specific value to be inherited is to use the longhand property with the keyword inherit.</li>
        <li>Shorthand properties try not to force a specific order for the values of the properties they replace. This works well when these properties use values of different types, as the order has no importance, but this does not work as easily when several properties can have identical values. Handling of these cases are grouped in several categories:
            <li>Shorthands handling properties related to edges of a box, like border-style, margin or padding, always use a consistent 1-to-4-value syntax representing those edges:
                <li>The 1-value syntax:<code>border-width: 1em</code> The unique value represents all edges</li>
                <li>The 2-value syntax: <code>border-width: 1em 2em</code> The first value represents the vertical, that is top and bottom, edges, the second the horizontal ones, that is the left and right ones.</li>
                <li>The 3-value syntax: <code>border-width: 1em 2em 3em</code> The first value represents the top edge, the second, the horizontal, that is left and right, ones, and the third value the bottom edge</li>
                <li>The 4-value syntax:<code> border-width: 1em 2em 3em 4em </code> The four values represent the top, right, bottom and left edges respectively, always in that order, that is clock-wise starting at the top (The initial letter of Top-Right-Bottom-Left matches the order of the consonant of the word trouble: TRBL) (You can also remember it as the order that the hands would rotate on a clock: 1em starts in the 12 o'clock position, then 2em in the 3 o'clock position, then 3em in the 6 o'clock position, and 4em in the 9 o'clock position).</li>
            <li>Similarly, shorthands handling properties related to corners of a box, like border-radius, always use a consistent 1-to-4-value syntax representing those corners:
                <li>The 1-value syntax: <code>border-radius: 1em </code> The unique value represents all corners</li>
                <li>The 2-value syntax: <code>border-radius: 1em 2em </code> The first value represents the top left and bottom right corner, the second the top right and bottom left ones.</li>
                <li>The 3-value syntax: <code>border-radius: 1em 2em 3em </code> The first value represents the top left corner, the second the top right and bottom left ones, and the third value the bottom right corner</li>
                <li>The 4-value syntax:<code> border-radius: 1em 2em 3em 4em </code> The four values represent the top left, top right, bottom right and bottom left corners respectively, always in that order, that is clock-wise starting at the top left.</li>
  <section class="main-section" id="background_properties">
      <header>Background Properties</header>
    <p>A background with the following properties ...</p><code>background-color: #000;<br>
background-image: url(images/bg.gif);<br>
background-repeat: no-repeat;<br>
    background-position: left top;</code>
    <p>... can be shortened to just one declaration:</p><code>background: #000 url(images/bg.gif) no-repeat left top;</code>
    <p>(The shorthand form is actually the equivalent of the longhand properties above plus background-attachment: scroll and, in CSS3, some additional properties.)</p>
  <section class="main-section" id="font_properties">
      <header>Font Properties</header>
    <p>The following declarations ...</p>
    <code>font-style: italic;<br>
font-weight: bold;<br>
font-size: .8em;<br>
line-height: 1.2;<br>
font-family: Arial, sans-serif;<br></code>
    <p>... can be shortened to the following:</p>
    <code>font: italic bold .8em/1.2 Arial, sans-serif;</code>
    <p>This shorthand declaration is actually equivalent to the longhand declarations above plus font-variant: normal and font-size-adjust: none (CSS2.0 / CSS3), font-stretch: normal (CSS3).</p>
  <section class="main-section" id="border_properties">
      <header>Border Properties</header>
    <p>With borders, the width, color, and style can be simplified into one declaration. For example, the following CSS ...</p>
    <code>border-width: 1px;
border-style: solid;
border-color: #000;</code>
    <p>... can be simplified as:</p>
    <code>border: 1px solid #000;</code>
  <section class="main-section" id="margin_and_padding_properties">
      <header>Margin and Padding Properties</header>
    <p>Shorthand versions of margin and padding values work similarly; the margin property allows for shorthand values to be specified using one, two, three, or four values. The following CSS declarations ...</p>
    <code>margin-top: 10px;<br>
margin-right: 5px;<br>
margin-bottom: 10px;<br>
margin-left: 5px;</code>
    <p>... are the same as the following declaration using the four value shorthand. Note that the values are in clockwise order, beginning at the top: top, right, bottom, then left (TRBL, the consonants in "trouble").</p>
    <code>margin: 10px 5px 10px 5px;</code>
    <p>Margin shorthand rules for one, two, three and four value declarations are:</p>
      <li>When <strong>one value</strong> is specified, it applies the same margin to all four sides.</li>
      <li>When <strong>two values</strong> are specified, the first margin applies to the top and bottom, the second to the left and right.</li>
      <li>When <strong>three values</strong> are specified, the first margin applies to the top, the second to the left and right, the third to the bottom.</li>
      <li>When <strong>four values</strong> are specified, the margins apply to the top, right, bottom, and left in that order (clockwise).</li>
  <section class="main-section" id="universal_shorthand_property">
      <header>Universal Shorthand Property</header>
    <p>CSS provides a universal shorthand property, all, which applies its value to every property in the document. Its purpose is to change the properties' inheritance model to one of:</p>
    <p>CSS provides four special universal property values for controlling inheritance. Every CSS property accepts these values.</p>
    <p>Sets the property value applied to a selected element to be the same as that of its parent element. Effectively, this "turns on inheritance".</p>
    <p>Sets the property value applied to a selected element to the initial value of that property.</p>
    <p>Resets the property to its natural value, which means that if the property is naturally inherited it acts like inherit, otherwise it acts like initial.</p>
  <section class="main-section" id="reference">
  <p>All the documentation on this page is from <a href="" target="_blank">MDN</a></p>


                /*font-family: 'Roboto', sans-serif;*/

@import url(';400;700&display=swap');

html { 
  font-family: 'Roboto', sans-serif;
  font-size: 14px; 

body {
  min-width: 290px; 
  max-width: 80vw; 
  color: #4d4e53;
  background-color: #fff;
  left: 35%;  

#navbar {
  position: fixed;
  min-width: 290px;
  top: 0px;
  left: 0px;
  width: 40%;
  height: 100%;
  border-right: solid;

header {
  color: black;
  margin: 10px;
  text-align: center;
  font-size: 1.8rem;
  font-weight: 400;

.nav-link {
  text-decoration: none;
  color: #333; 
  font-size: 1.5rem;
  font-weight: 100; 
  width: 100%; 
  margin: 30px 10px; 

.nav-link:hover {
  color: #b87bdf;
  font-weight: 400;

#nav-links {
  list-style-type: none; 

p, li {
  line-height: 25px; 

#navbar li {
  border-top: 1px solid;
  list-style: none;
  position: relative;
  width: 100%;
  margin: 5px 0; 
  padding: 15px 0; 
  text-align: left; 

code {
  color: #b87bdf; 
  background: #d3d3d3; 
  padding: 4px; 
  line-height: 20px; 

main {
  grid-area: doc;

.main-section header {
  font-size: 2rem; 
  text-align: left;
  margin: 25px 0; 

h3 {
  font-size: 1.3rem; 

@media only screen and (max-width: 400px) {
  #navbar {
    position: relative; 
    overflow: scroll; 
    height: 40vh;
  header {
    font-size: 1.3rem;
  .nav-link {
    font-size: 1rem;



                // !! 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. 

  - Select the project you would 
    like to complete from the dropdown 
  - Click the "RUN TESTS" button to
    run the tests against the blank 
  - 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.