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

              
                <body>
  <span class="container">
    <nav id="navbar">
      <header>HTML 5 Elements</header>
      <ul>
        <li>
          <a class="nav-link" href="#root_element" id="re__link">
            Root Element
          </a>
        </li>
        <li>
          <a class="nav-link" href="#document_metadata" id="dm__link">
            Document Metadata
          </a>
        </li>
        <li>
          <a class="nav-link" href="#inline_text_semantics" id="its__link">
            Inline Text Semantics
          </a>
        </li>
        <li>
          <a class="nav-link" href="#scripting" id="s__link">Scripting</a>
        </li>
        <li>
          <a class="nav-link" href="#text_content" id="txc__link">
            Text Content
          </a>
        </li>
        <li><a class="nav-link" href="#forms" id="f__link">Forms</a></li>
        <li>
          <a class="nav-link" href="#embedded_content" id="ec__link">
            Embedded Content
          </a>
        </li>
        <li>
          <a class="nav-link" href="#image_and_multimedia" id="iam__link">
            Image and Multimedia
          </a>
        </li>
        <li>
          <a class="nav-link" href="#table_content" id="tbc__link">
            Table Content
          </a>
        </li>
        <li>
          <a class="nav-link" href="#interactive_elements" id="ie__link">
            Interactive Elements
          </a>
        </li>
        <li>
          <a class="nav-link" href="#content_sectioning" id="cs__link">
            Content Sectioning
          </a>
        </li>
        <li>
          <a class="nav-link" href="#obsolete_and_deprecated" id="oad__link">
            Obsolete and Deprecated
          </a>
        </li>
      </ul>
    </nav>
    <main id="main-doc">
      <section class="main-section" id="root_element">
        <header>Root Element</header>
        <ul>
          <li>html</li>
        </ul>
        <pre>
            <code>
              * All your website code goes in between here

              <span class="opening-tag">html</span>
                <span class="opening-tag">head</span>
                  <span class="opening-tag">title</span>
                    This is the title
                  <span class="closing-tag">title</span>
                <span class="closing-tag">head</span>
                <span class="opening-tag">body</span>
                  <span class="opening-tag">div id="something"</span>
                    Content goes here
                  <span class="closing-tag">div</span>
                <span class="closing-tag">body</span>
              <span class="closing-tag">html</span>
            </code>
          </pre>
        <p>Code example</p>
      </section>
      <section class="main-section" id="document_metadata">
        <header>Document Metadata</header>
        <ul>
          <li>head</li>
          <li>title</li>
          <li>meta</li>
          <li>base</li>
          <li>link</li>
          <li>style</li>
        </ul>
        <pre>
            <code>
              * Include an external stylesheet
              <span class="opening-tag">link rel="stylesheet" href="style.css"</span>
            </code>
          </pre>
        <p>Code example</p>
      </section>
      <section class="main-section" id="inline_text_semantics">
        <header>Inline Text Semantics</header>
        <ul>
          <li>span</li>
          <li>u</li>
          <li>a</li>
          <li>s</li>
          <li>rt</li>
          <li>dfn</li>
          <li>em</li>
          <li>i</li>
          <li>small</li>
          <li>ins</li>
          <li>br</li>
          <li>abbr</li>
          <li>time</li>
          <li>b</li>
          <li>strong</li>
          <li>del</li>
          <li>bdi</li>
          <li>q</li>
          <li>var</li>
          <li>sub</li>
          <li>mark</li>
          <li>kbd</li>
          <li>wbr</li>
          <li>rtc</li>
          <li>cite</li>
          <li>samp</li>
          <li>sup</li>
          <li>ruby</li>
          <li>bdo</li>
          <li>code</li>
          <li>rp</li>
        </ul>
        <pre>
            <code>
              * Include a hyperlink within your page

              <span class="opening-tag">a href="a-fictious-url.com"</span>
                Visit our store
              <span class="closing-tag">a</span>
            </code>
          </pre>
        <p>Code example</p>
      </section>
      <section class="main-section" id="scripting">
        <header>Scripting</header>
        <ul>
          <li>canvas</li>
          <li>noscript</li>
          <li>script</li>
        </ul>
        <pre>
            <code>
              * Include an external JavaScript file

              <span class="opening-tag">script src="a-fancy-piece-of-javascript.js"</span>
            </code>
          </pre>
        <p>Code example</p>
      </section>
      <section class="main-section" id="text_content">
        <header>Text Content</header>
        <ul>
          <li>p</li>
          <li>div</li>
          <li>blockquote</li>
          <li>figcaption</li>
          <li>ol</li>
          <li>dl</li>
          <li>main</li>
          <li>dt</li>
          <li>hr</li>
          <li>pre</li>
          <li>ul</li>
          <li>dd</li>
          <li>figure</li>
          <li>li</li>
        </ul>
        <pre>
            <code>
              <span class="opening-tag">figure</span>
                <span class="opening-tag">img src="an-image.jpg" alt="alt text related to this image"</span>
                <span class="opening-tag">figcaption</span>
                  This text describes your image
                <span class="closing-tag">figcaption</span>
              <span class="closing-tag">html</span>
            </code>
          </pre>
        <p>Code example</p>
      </section>
      <section class="main-section" id="forms">
        <header>Forms</header>
        <ul>
          <li>fieldset</li>
          <li>form</li>
          <li>meter</li>
          <li>select</li>
          <li>legend</li>
          <li>optgroup</li>
          <li>label</li>
          <li>textarea</li>
        </ul>
        <pre>
            <code>
              * A simple form with an input field for name and email, along with a submit button

              <span class="opening-tag">form action="this-page.php" method="post"</span>
                <span class="opening-tag">label for="name"</span>Name:<span class="closing-tag">label</span>
                <span class="opening-tag">input type="text" name="text" value="text"</span>
                <span class="opening-tag">label for="email"</span>Email:<span class="closing-tag">label</span>
                <span class="opening-tag">input type="email" name="email" value="email"</span>
                <span class="opening-tag">input type="submit" value="Submit"</span>
              <span class="closing-tag">form</span>
            </code>
          </pre>
        <p>Code example</p>
      </section>
      <section class="main-section" id="embedded_content">
        <header>Embedded Content</header>
        <ul>
          <li>object</li>
          <li>iframe</li>
          <li>source</li>
          <li>embed</li>
          <li>param</li>
        </ul>
        <pre>
            <code>
              * Embed an iframe in your page

              <span class="opening-tag">iframe src="https://url.co.uk" title="The website title"</span>
              <span class="closing-tag">iframe</span>
            </code>
          </pre>
        <p>Code example</p>
      </section>
      <section class="main-section" id="image_and_multimedia">
        <header>Image and Multimedia</header>
        <ul>
          <li>map</li>
          <li>track</li>
          <li>img</li>
          <li>video</li>
          <li>audio</li>
          <li>area</li>
        </ul>
        <pre>
            <code>
              * Include an image on your page

              <span class="opening-tag">img src="path-to-image.jpg" alt="alt text for the image"</span>
            </code>
          </pre>
        <p>Code example</p>
      </section>
      <section class="main-section" id="table_content">
        <header>Table Content</header>
        <ul>
          <li>col</li>
          <li>table</li>
          <li>colgroup</li>
          <li>tr</li>
          <li>caption</li>
          <li>td</li>
          <li>th</li>
          <li>tbody</li>
          <li>thead</li>
          <li>tfoot</li>
        </ul>
        <pre>
            <code>
              * A two-columned table

              <span class="opening-tag">table</span>
                <span class="opening-tag">thead</span>
                  <span class="opening-tag">tr</span>
                    <span class="opening-tag">th</span>Customer ID<span class="closing-tag">th</span>
                    <span class="opening-tag">th</span># of purchases<span class="closing-tag">th</span>
                  <span class="closing-tag">tr</span>
                <span class="closing-tag">thead</span>
                <span class="opening-tag">tbody</span>
                  <span class="opening-tag">tr</span>
                    <span class="opening-tag">td</span>02341550<span class="closing-tag">td</span>
                    <span class="opening-tag">td</span>77<span class="closing-tag">td</span>
                  <span class="closing-tag">tr</span>
                  <span class="opening-tag">tr</span>
                    <span class="opening-tag">td</span>07653941<span class="closing-tag">td</span>
                    <span class="opening-tag">td</span>51<span class="closing-tag">td</span>
                  <span class="closing-tag">tr</span>
                  <span class="opening-tag">tr</span>
                    <span class="opening-tag">td</span>08199320<span class="closing-tag">td</span>
                    <span class="opening-tag">td</span>25<span class="closing-tag">td</span>
                  <span class="closing-tag">tr</span>
                <span class="closing-tag">tbody</span>
                <span class="opening-tag">tfoot</span>
                <span class="opening-tag">tr</span>
                  <span class="opening-tag">td</span>Total<span class="closing-tag">td</span>
                  <span class="opening-tag">td</span>153<span class="closing-tag">td</span>
                <span class="closing-tag">tr</span>
                <span class="closing-tag">tfoot</span>
              <span class="closing-tag">table</span>
            </code>
          </pre>
        <p>Code example</p>
      </section>
      <section class="main-section" id="interactive_elements">
        <header>Interactive Elements</header>
        <ul>
          <li>menu</li>
          <li>command</li>
          <li>summary</li>
          <li>details</li>
        </ul>
        <pre>
            <code>
              *

              <span class="opening-tag">details</span>
                <span class="opening-tag">summary</span>Summary text to display<span class="closing-tag">summary</span>
                <span class="opening-tag">p</span>Lorem ipsum dolor sit amet consectetu dipisicing elit.<span class="closing-tag">p</span>
                <span class="opening-tag">p</span>Porro eum itaque iste possimus omnis excepturi iusto expedita.<span class="closing-tag">p</span>
                <span class="opening-tag">p</span>
                  Blanditiis, aliquam? Maxime nemo accusantium nostrum repudiandae reprehenderit
                  corporis unde error praesentium laudantium?
                <span class="closing-tag">p</span>
              <span class="closing-tag">details</span>
            </code>
          </pre>
        <p>Code example</p>
      </section>
      <section class="main-section" id="content_sectioning">
        <header>Content Sectioning</header>
        <ul>
          <li>footer</li>
          <li>aside</li>
          <li>header</li>
          <li>section</li>
          <li>hgroup</li>
          <li>address</li>
          <li>h1</li>
          <li>h2</li>
          <li>h3</li>
          <li>h4</li>
          <li>h5</li>
          <li>h6</li>
          <li>body</li>
          <li>article</li>
          <li>nav</li>
        </ul>
        <pre>
            <code>
              * A simple nav element with 4 links

              <span class="opening-tag">nav</span>
                <span class="opening-tag">ul</span>
                  <span class="opening-tag">li</span>
                    <span class="opening-tag">a href="path-to-url.html"</span>
                      Link
                    <span class="closing-tag">a</span>
                  <span class="opening-tag">li</span>
                  <span class="opening-tag">li</span>
                    <span class="opening-tag">a href="path-to-url.html"</span>
                      Link
                    <span class="closing-tag">a</span>
                  <span class="opening-tag">li</span>
                  <span class="opening-tag">li</span>
                    <span class="opening-tag">a href="path-to-url.html"</span>
                      Link
                    <span class="closing-tag">a</span>
                  <span class="opening-tag">li</span>
                  <span class="opening-tag">li</span>
                    <span class="opening-tag">a href="path-to-url.html"</span>
                      Link
                    <span class="closing-tag">a</span>
                  <span class="opening-tag">li</span>
                <span class="closing-tag">ul</span>
              <span class="closing-tag">nav</span>
            </code>
          </pre>
        <p>Code example</p>
      </section>
      <section class="main-section" id="obsolete_and_deprecated">
        <header>Obsolete and Deprecated</header>
        <ul>
          <li>frameset</li>
          <li>acronym</li>
          <li>xmp</li>
          <li>dialog</li>
          <li>bgsound</li>
          <li>noembed</li>
          <li>applet</li>
          <li>frame</li>
          <li>strike</li>
          <li>big</li>
          <li>font</li>
          <li>centre</li>
          <li>tt</li>
          <li>plaintext</li>
          <li>dir</li>
          <li>basefont</li>
          <li>noframes</li>
          <li>blink</li>
          <li>isindex</li>
        </ul>
        <pre>
            <code>
              /* Now deprecated, the below tag allowed for the content to flash

              <span class="opening-tag">blink</span>
                This text blinks
              <span class="closing-tag">blink</span>
            </code>
          </pre>
        <p>Code example</p>
      </section>
    </main>
    </div>
</body>
              
            
!

CSS

              
                @import url("https://fonts.googleapis.com/css2?family=Poppins:wght@200;400;700&display=swap");
* {
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

:root {
  /* base colours **/
  --highlight-light: #efefef;
  /* custom colours */
  --re__green: #43aa4f;
  --dm__blue: #07a9f4;
  --its__pink: #e82c8b;
  --s__beige: #b6a16a;
  --tc__yellow: #fdef2c;
  --f__pink: #af4398;
  --ec__blue: #6087c0;
  --iam__blue: #0199ae;
  --tc__red: #ef3646;
  --ie__grey: #8f9d9d;
  --cs__orange: #f48e22;
  --oad__blue: #81d0ba;
  --dark__bg: #30292f;
  --dark__bg__highlight: #201d20;
  /* typography */
  --ff: Poppins, sans-serif;
  --fw__light: 200;
  --fw__medium: 400;
  --fw__bold: 700;
}

body {
  background-color: var(--dark__bg);
  color: var(--highlight-light);
  font-family: var(--ff);
  font-weight: 400;
}

.container {
  -webkit-box-align: center;
  -ms-flex-align: center;
  align-items: center;
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-orient: vertical;
  -webkit-box-direction: normal;
  -ms-flex-direction: column;
  flex-direction: column;
  min-height: 100vh;
  padding: 1rem;
}
@media (min-width: 50em) {
  .container {
    grid-template-columns: 300px 1fr;
    padding: 2rem;
  }
}

/* Nav */
nav {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-orient: vertical;
  -webkit-box-direction: normal;
  -ms-flex-direction: column;
  flex-direction: column;
  height: auto;
  width: 100%;
}
@media (min-width: 50em) {
  nav {
    height: 100%;
    left: 0;
    padding-left: 1rem;
    position: fixed;
    top: 50px;
    width: 300px;
  }
}
nav header {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  font-size: 1.4rem;
  -webkit-box-pack: center;
  -ms-flex-pack: center;
  justify-content: center;
  padding-bottom: 1.6rem;
  text-transform: uppercase;
}
@media (min-width: 50em) {
  nav header {
    -webkit-box-pack: start;
    -ms-flex-pack: start;
    justify-content: flex-start;
  }
}
nav ul {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-orient: vertical;
  -webkit-box-direction: normal;
  -ms-flex-direction: column;
  flex-direction: column;
  max-width: 100%;
}
@media (min-width: 50em) {
  nav ul {
    max-width: 300px;
  }
}
nav ul li {
  list-style-type: none;
}
nav ul li a {
  border-bottom: 1px solid var(--dark__bg__highlight);
  color: var(--highlight-light);
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  font-size: 0.9rem;
  letter-spacing: 0.02rem;
  padding: 0.6rem;
  text-decoration: none;
  text-transform: lowercase;
  -webkit-transition: all 1s;
  transition: all 1s;
}
@media (min-width: 50em) {
  nav ul li a {
    padding-left: 0;
  }
}
nav ul li a:hover {
  color: var(--dark__bg__highlight);
  padding-left: 2rem;
}
nav ul li a:before {
  background-color: white;
  color: white;
  content: "";
  margin-right: 1rem;
  padding: 0.1rem;
}
@media (min-width: 50em) {
  nav ul li a:before {
    margin-right: 1rem;
  }
}
nav ul li a#re__link:hover,
nav ul li a#re__link:before {
  background-color: var(--re__green);
}
nav ul li a#dm__link:hover,
nav ul li a#dm__link:before {
  background-color: var(--dm__blue);
}
nav ul li a#its__link:hover,
nav ul li a#its__link:before {
  background-color: var(--its__pink);
}
nav ul li a#s__link:hover,
nav ul li a#s__link:before {
  background-color: var(--s__beige);
}
nav ul li a#txc__link:hover,
nav ul li a#txc__link:before {
  background-color: var(--tc__yellow);
}
nav ul li a#f__link:hover,
nav ul li a#f__link:before {
  background-color: var(--f__pink);
}
nav ul li a#ec__link:hover,
nav ul li a#ec__link:before {
  background-color: var(--ec__blue);
}
nav ul li a#iam__link:hover,
nav ul li a#iam__link:before {
  background-color: var(--iam__blue);
}
nav ul li a#tbc__link:hover,
nav ul li a#tbc__link:before {
  background-color: var(--tc__red);
}
nav ul li a#ie__link:hover,
nav ul li a#ie__link:before {
  background-color: var(--ie__grey);
}
nav ul li a#cs__link:hover,
nav ul li a#cs__link:before {
  background-color: var(--cs__orange);
}
nav ul li a#oad__link:hover,
nav ul li a#oad__link:before {
  background-color: var(--oad__blue);
}

/* Main */
section {
  padding-top: 0.5rem;
  padding-bottom: 5rem;
}
section header {
  margin-bottom: 2.4rem;
  text-transform: lowercase;
}
section ul {
  display: grid;
  grid-gap: 0.4rem;
  grid-template-columns: repeat(2, 1fr);
  margin-bottom: 2rem;
}
@media (min-width: 50em) {
  section ul {
    display: grid;
    grid-gap: 1rem;
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (min-width: 75em) {
  section ul {
    grid-template-columns: repeat(4, 1fr);
  }
}
@media (min-width: 100em) {
  section ul {
    grid-template-columns: repeat(6, 1fr);
  }
}
section li {
  background-color: var(--dark__bg__highlight);
  border: 3px solid var(--dark__bg__highlight);
  border-radius: 1rem;
  list-style-type: none;
  min-width: 200px;
  padding: 3rem 1rem;
  text-align: center;
  -webkit-transition: border-color 1s;
  transition: border-color 1s;
}

.main-section p {
  color: #bdbdbd;
  font-size: 0.72rem;
  font-weight: var(--fw__bold);
  letter-spacing: 0.35rem;
  line-height: 1rem;
  margin-top: -1.6rem;
  margin-right: 0.5rem;
  text-transform: uppercase;
  text-align: right;
}
.main-section pre {
  background-color: #3a3339;
  border-radius: 1rem;
  font-family: monospace;
  font-size: 0.72rem;
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  padding: 2rem 0.2rem;
  white-space: pre-wrap;
  overflow-x: auto;
  word-wrap: normal;
}
@media (min-width: 40em) {
  .main-section pre {
    font-size: 0.84rem;
  }
}
.main-section pre code {
  margin-left: -6.5rem;
  padding: 0;
}
@media (min-width: 50em) {
  .main-section pre {
    margin-left: 0;
    padding: 2rem;
  }
}
.main-section pre .opening-tag::before {
  content: "<";
}
.main-section pre .opening-tag:after {
  content: ">";
}
.main-section pre .closing-tag::before {
  content: "</";
}
.main-section pre .closing-tag::after {
  content: ">";
}
.main-section pre .closing-no-slash-tag::before {
  content: "";
}

main {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-orient: vertical;
  -webkit-box-direction: normal;
  -ms-flex-direction: column;
  flex-direction: column;
  padding: 6rem 1rem 1rem 1rem;
}
@media (min-width: 50em) {
  main {
    margin-left: 250px;
    padding: 4rem;
    position: absolute;
    width: calc(100vw - 300px);
  }
}
@media (min-width: 75em) {
  main {
    margin-left: 300px;
  }
}

#root_element header {
  border-bottom: 2px solid var(--re__green);
}
#root_element ul li:hover {
  border-color: var(--re__green);
}
#root_element p {
  color: var(--re__green);
}

#document_metadata header {
  border-bottom: 2px solid var(--dm__blue);
}
#document_metadata ul li:hover {
  border-color: var(--dm__blue);
}
#document_metadata p {
  color: var(--dm__blue);
}

#inline_text_semantics header {
  border-bottom: 2px solid var(--its__pink);
}
#inline_text_semantics ul li:hover {
  border-color: var(--its__pink);
}
#inline_text_semantics p {
  color: var(--its__pink);
}

#scripting header {
  border-bottom: 2px solid var(--s__beige);
}
#scripting ul li:hover {
  border-color: var(--s__beige);
}
#scripting p {
  color: var(--s__beige);
}

#text_content header {
  border-bottom: 2px solid var(--tc__yellow);
}
#text_content ul li:hover {
  border-color: var(--tc__yellow);
}
#text_content p {
  color: var(--tc__yellow);
}

#forms header {
  border-bottom: 2px solid var(--f__pink);
}
#forms ul li:hover {
  border-color: var(--f__pink);
}
#forms p {
  color: var(--f__pink);
}

#embedded_content header {
  border-bottom: 2px solid var(--ec__blue);
}
#embedded_content ul li:hover {
  border-color: var(--ec__blue);
}
#embedded_content p {
  color: var(--ec__blue);
}

#image_and_multimedia header {
  border-bottom: 2px solid var(--iam__blue);
}
#image_and_multimedia ul li:hover {
  border-color: var(--iam__blue);
}
#image_and_multimedia p {
  color: var(--iam__blue);
}

#table_content header {
  border-bottom: 2px solid var(--tc__red);
}
#table_content ul li:hover {
  border-color: var(--tc__red);
}
#table_content p {
  color: var(--tc__red);
}

#interactive_elements header {
  border-bottom: 2px solid var(--ie__grey);
}
#interactive_elements ul li:hover {
  border-color: var(--ie__grey);
}
#interactive_elements p {
  color: var(--ie__grey);
}

#content_sectioning header {
  border-bottom: 2px solid var(--cs__orange);
}
#content_sectioning ul li:hover {
  border-color: var(--cs__orange);
}
#content_sectioning p {
  color: var(--cs__orange);
}

#obsolete_and_deprecated header {
  border-bottom: 2px solid var(--oad__blue);
}
#obsolete_and_deprecated ul li:hover {
  border-color: var(--oad__blue);
}
#obsolete_and_deprecated p {
  color: var(--oad__blue);
}

/*# sourceMappingURL=index.css.map */

              
            
!

JS

              
                
              
            
!
999px

Console