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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ 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>
    <nav id="navbar">
    <header>HTML Tutorial</header>
    <ul>
      <li><a class="nav-link" href="#Introduction">Introduction</a></li>
      <li><a class="nav-link" href="#HTML_Basics">HTML Basics</a></li>
      <li><a class="nav-link" href="#HTML_Elements">HTML Elements</a></li>
      <li><a class="nav-link" href="#HTML_Attributes">HTML Attributes</a></li>
      <li><a class="nav-link" href="#HTML_Headings">HTML Headings</a></li>
      <li><a class="nav-link" href="#HTML_Paragraphs">HTML Paragraphs</a></li>
      <li><a class="nav-link" href="#HTML_Styles">HTML Styles</a></li>
      <li><a class="nav-link" href="#HTML_Comments">HTML Comments</a></li>
      <li><a class="nav-link" href="#Reference">Reference</a></li>
    </ul>
    </nav>
    <main id="main-doc">
            <section class="main-section" id="Introduction">
        <header>Introduction</header>
          <article>
           <p>HTML is the standard markup language for Web pages. With HTML you can create your own Website.</p>

            <p>In this HTML tutorial, you will find plenty of examples, making it easy to learn.</p>
            <h2>What is HTML?</h2>
            <ul>
              <li>HTML stands for Hyper Text Markup Language</li>
              
<li>HTML is the standard markup language for creating Web pages</li>
<li>HTML describes the structure of a Web page</li>
<li>HTML consists of a series of elements</li>
<li>HTML elements tell the browser how to display the content</li>
<li>HTML elements label pieces of content such as "this is a heading", "this is a paragraph", "this is a link", etc.</li>
            </ul>
            </article>
          </section>
      <section class="main-section" id="HTML_Basics">
        <header>HTML Basics</header>
          <article>
            <p>In this section we will show some basic HTML examples.</p>
  <h2>HTML Documents</h2>
  <ul>
<li>All HTML documents must start with a document type declaration: &lt;!DOCTYPE html&gt;.</li>

<li>The HTML document itself begins with &lt;html&gt; and ends with &lt;/html&gt;.</li>
            <li>The visible part of the HTML document is between &lt;body&gt; and &lt;/body&gt;</li>
            <pre>
            <code>
&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;body&gt;

&lt;h1&gt;My First Heading&lt;/h1&gt;
&lt;p&gt;My first paragraph.&lt;/p&gt;

&lt;/body&gt;
&lt;/html&gt;
</code>
</pre>
            </ul>
              <h2>The &lt;!DOCTYPE&gt; Declaration</h2>
            <ul>
            <li>The &lt;!DOCTYPE&gt; declaration represents the document type, and helps browsers to display web pages correctly.</li>
            <li>It must only appear once, at the top of the page (before any HTML tags).</li>
            <li>The &lt;!DOCTYPE&gt; declaration is not case sensitive.</li>
  </ul>
   <h2>HTML Headings</h2>
      <ul>
<li>HTML headings are defined with the &lt;h1&gt; to &lt;h6&gt; tags.</li>
  <li> &lt;h1&gt; defines the most important heading. &lt;h6&gt; defines the least important heading:</li>
    <pre>
    <code>
&lt;h1&gt;This is heading 1&lt;/h1&gt;
&lt;h2&gt;This is heading 2&lt;/h2&gt;
&lt;h3&gt;This is heading 3&lt;/h3&gt;
</code>
</pre>
      </ul>
      <h2>HTML Paragraphs</h2>
      <ul>
      <li>HTML paragraphs are defined with the &lt;p&gt; tag:</li>
    <pre>
    <code>
&lt;p&gt;This is a paragraph.&lt;/p&gt;
&lt;p&gt;This is another paragraph.&lt;/p&gt;
    </code>
    </pre>
      </ul>
      <h2>HTML Links</h2>
      <ul>
      <li>HTML links are defined with the &lt;a&gt; tag:</li>
    <pre>
    <code>
&lt;a href="https://www.w3schools.com"&gt;This is a link&lt;/a&gt;
      </code>
    </pre>
    <li>The link's destination is specified in the href attribute.</li>
      <li>Attributes are used to provide additional information about HTML elements.</li>
      </ul>
    <h2>HTML Images</h2>
      <ul>
      <li>HTML images are defined with the &lt;img&gt; tag.</li>
      <li>The source file (src), alternative text (alt), width, and height are provided as attributes:</li>
    <pre>
      <code>
&lt;img src="w3schools.jpg" alt="W3Schools.com" width="104" height="142"&gt;
      </code>
    </pre>
      </ul>
             </article>
          </section>
            <section class="main-section" id="HTML_Elements">
        <header>HTML Elements</header>
          <article>
            <p>An HTML element is defined by a start tag, some content, and an end tag.</p>
            <pre>
            <code>
&lt;tagname&gt; Content goes here...&lt;/tagname&gt;
            </code>
            </pre>

<p>The HTML element is everything from the start tag to the end tag:</p>
            <pre>
            <code>
&lt;h1&gt;My First Heading&lt;/h1&gt;
&lt;p&gt;My first paragraph.&lt;/p&gt;
</code>
</pre>
                <h2>Nested HTML Elements</h2>
                <ul>
                <li>HTML elements can be nested (this means that elements can contain other elements).</li>

<li>All HTML documents consist of nested HTML elements.</li>

<p>The following example contains four HTML elements (&lt;html&gt;, &lt;body&gt;, &lt;h1&gt; and &lt;p&gt;):</p>
                </ul>
                  <pre>
                  <code>
&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;body&gt;

&lt;h1&gt;My First Heading&lt;/h1&gt;
&lt;p&gt;My first paragraph.&lt;/p&gt;

&lt;/body&gt;
&lt;/html&gt;
                  </code>
                  </pre>
                  <p>The &lt;html&gt; element is the root element and it defines the whole HTML document.</p>

<p>It has a start tag &lt;html&gt; and an end tag &lt;/html&gt;.</p>

<p>Then, inside the &lt;html&gt; element there is a &lt;body&gt; element</p>
  <p>The &lt;body&gt; element defines the document's body.</p>

<p>It has a start tag &lt;body&gt; and an end tag &lt;/body&gt;.</p>

<p>Then, inside the &lt;body&gt; element there are two other elements: &lt;h1&gt; and &lt;p&gt;</p>
                   </article>
          </section>
                  <section class="main-section" id="HTML_Attributes">      
        <header>HTML Attributes</header>
          <article>
            <p>HTML attributes provide additional information about HTML elements.</p>
            <ul>
              <li>All HTML elements can have attributes</li>
<li>They provide additional information about elements</li>
<li>They are always specified in the start tag</li>
<li>They usually come in name/value pairs like: name="value"</li>
              </ul>
              <h2>The href Attribute</h2>
              <ul>
              <li>The &lt;a&gt; tag defines a hyperlink. The href attribute specifies the URL of the page the link goes to:</li>
                <pre>
                <code>
&lt;a href="https://www.w3schools.com"&gt;Visit W3Schools&lt;/a&gt;
                </code>
                </pre>
              </ul>
<h2>The src Attribute</h2>
  <ul>
  <li>The &lt;img&gt; tag is used to embed an image in an HTML page. The src attribute specifies the path to the image to be displayed:</li>
  <pre>
    <code>
&lt;img src="img_girl.jpg"&gt;
    </code>
  </pre>
  </ul>
            
            <p>There are two ways to specify the URL in the src attribute:</p>
<ol>
<li> Absolute URL - Links to an external image that is hosted on another website. Example: src="https://www.w3schools.com/images/img_girl.jpg".</li>

<p>Notes: External images might be under copyright. If you do not get permission to use it, you may be in violation of copyright laws. In addition, you cannot control external images; it can suddenly be removed or changed.</p>

<li>Relative URL - Links to an image that is hosted within the website. Here, the URL does not include the domain name. If the URL begins without a slash, it will be relative to the current page. Example: src="img_girl.jpg". If the URL begins with a slash, it will be relative to the domain. Example: src="/images/img_girl.jpg".</li>
             

<p>Tip: It is almost always best to use relative URLs. They will not break if you change domain.</p>
  </ol>
           <h2> The width and height Attributes</h2>
<p>The &lt;img&gt; tag should also contain the width and height attributes, which specifies the width and height of the image (in pixels):</p>
            <pre>
              <code>
&lt;img src="img_girl.jpg" width="500" height="600"&gt;
              </code>
            </pre>
            <h2>The alt Attribute</h2>
<p>The required alt attribute for the &lt;img&gt; tag specifies an alternate text for an image, if the image for some reason cannot be displayed. This can be due to slow connection, or an error in the src attribute, or if the user uses a screen reader.</p>
            <pre>
              <code>
&lt;img src="img_girl.jpg" alt="Girl with a jacket"&gt;
              </code>
            </pre>
  
<h2>The style Attribute</h2>
<p>The style attribute is used to add styles to an element, such as color, font, size, and more.</p>
<pre>
  <code>
&lt;p style="color:red;"&gt;This is a red paragraph.&lt;/p&gt;
  </code>
</pre>
            <h2>The title Attribute</h2>
<p>The title attribute defines some extra information about an element.</p>

<p>The value of the title attribute will be displayed as a tooltip when you mouse over the element:</p>
<pre>
  <code>
&lt;p title="I'm a tooltip"&gt;This is a paragraph.&lt;/p&gt;
  </code>
</pre>
             </article>
          </section>
                        <section class="main-section" id="HTML_Headings">
        <header>HTML Headings</header>
          <article>
            <p>HTML headings are titles or subtitles that you want to display on a webpage.</p>
            <p>HTML headings are defined with the &lt;h1&gt; to &lt;h6&gt; tags.</p>

<p>&lt;h1&gt; defines the most important heading. &lt;h6&gt; defines the least important heading.</p>
            <h2>Headings Are Important</h2>
            <ul>
<li>Search engines use the headings to index the structure and content of your web pages.</li>

<li>Users often skim a page by its headings. It is important to use headings to show the document structure.</li>

<li>&lt;h1&gt; headings should be used for main headings, followed by &lt;h2&gt; headings, then the less important &lt;h3&gt;, and so on.</li>
              </ul>
            </article>
          </section>
                              <section class="main-section" id="HTML_Paragraphs">   
        <header>HTML Paragraphs</header>
          <article>
            <p>A paragraph always starts on a new line, and is usually a block of text.</p>

<p>The HTML &lt;p&gt; element defines a paragraph.</p>

<p>A paragraph always starts on a new line, and browsers automatically add some white space (a margin) before and after a paragraph.</p>
            <pre>
              <code>
&lt;p&gt;This is a paragraph.&lt;/p&gt;
&lt;p&gt;This is another paragraph.&lt;/p&gt;
              </code>
            </pre>
            <h2>HTML Horizontal Rules</h2>
<p>The &lt;hr&gt; tag defines a thematic break in an HTML page, and is most often displayed as a horizontal rule.</p>

<p>The &lt;hr&gt; element is used to separate content (or define a change) in an HTML page:</p>
            <p>The &lt;hr&gt; tag is an empty tag, which means that it has no end tag.</p>
            <pre>
              <code>
&lt;h1&gt;This is heading 1&lt;/h1&gt;
&lt;p&gt;This is some text.&lt;/p&gt;
&lt;hr&gt;
&lt;h2&gt;This is heading 2&lt;/h2&gt;
&lt;p&gt;This is some other text.&lt;/p&gt;
&lt;hr&gt;
              </code>
            </pre>
            <h2>HTML Line Breaks</h2>
<p>The HTML &lt;br&gt; element defines a line break.</p>

<p>Use &lt;br&gt; if you want a line break (a new line) without starting a new paragraph:</p>
       
            <p>The &lt;br&gt; tag is an empty tag, which means that it has no end tag.</p>
<pre>
  <code>
&lt;p&gt;This is&lt;br&gt;a paragraph&lt;br&gt;with line breaks.&lt;/p&gt;
  </code>
</pre>
           <p> The HTML &lt;pre&gt; element defines preformatted text.</p>

<p>The text inside a &lt;pre&gt; element is displayed in a fixed-width font (usually Courier), and it preserves both spaces and line breaks:</p>
            <p>This can be used with poems:</p>
            <pre>
              <code>
&lt;pre&gt;
  My Bonnie lies over the ocean.

  My Bonnie lies over the sea.

  My Bonnie lies over the ocean.

  Oh, bring back my Bonnie to me.
&lt;/pre&gt;
              </code>
            </pre>
             </article>
          </section>    
                      <section class="main-section" id="HTML_Styles">
        <header>HTML Styles</header>
          <article> 
            <p>The HTML style attribute is used to add styles to an element, such as color, font, size, and more.</p>
            <h2>The HTML Style Attribute</h2>
<p>Setting the style of an HTML element, can be done with the style attribute.</p>
<ul>
<li>The HTML style attribute has the following syntax:</li>
  <pre>
  <code>
  &lt;tagname style="property:value;"&gt;
  </code>
  </pre>
            <li>The property is a CSS property. The value is a CSS value.</li>
              </ul>
            <h2>Background Color</h2>
            <ul>
<li>The CSS background-color property defines the background color for an HTML element.</li>
              <pre>
              <code>
              &lt;body style="background-color:powderblue;"&gt;

&lt;h1&gt;This is a heading&lt;/h1&gt;
&lt;p&gt;This is a paragraph.&lt;/p&gt;

&lt;/body&gt;
              </code>
              </pre>
              </ul>
            <h2>Text Color</h2>
            <ul>
<li>The CSS color property defines the text color for an HTML element:</li>
              <pre>
              <code>
              &lt;h1 style="color:blue;"&gt;This is a heading&lt;/h1&gt;
&lt;p style="color:red;"&gt;This is a paragraph.&lt;/p&gt;
              </code>
            </pre>
              </ul>
            
            
                        <h2>Fonts</h2>
            <ul>
<li>The CSS font-family property defines the font to be used for an HTML element:</li>
              <pre>
              <code>
&lt;h1 style="font-family:verdana;"&gt;This is a heading&lt;/h1&gt;
&lt;p style="font-family:courier;"&gt;This is a paragraph.&lt;/p&gt;
              </code>
            </pre>
              </ul>
            
            
                                    <h2>Text Size</h2>
            <ul>
<li>The CSS font-size property defines the text size for an HTML element:</li>
              <pre>
              <code>
&lt;h1 style="font-size:300%;"&gt;This is a heading&lt;/h1&gt;
&lt;p style="font-size:160%;"&gt;This is a paragraph.&lt;/p&gt;
              </code>
            </pre>
              </ul>
            <h2>Text Alignment</h2>
            <ul>
              <li>The CSS text-align property defines the horizontal text alignment for an HTML element:</li>
              <pre>
              <code>
              &lt;h1 style="text-align:center;"&gt;Centered Heading&lt;/h1&gt;
&lt;p style="text-align:center;"&gt;Centered paragraph.&lt;/p&gt;
              </code>
              </pre>
              </ul>
            
            </article>
            </section>
       <section class="main-section" id="HTML_Comments">
        <header>HTML Comments</header>
          <article>  
            <p>HTML comments are not displayed in the browser, but they can help document your HTML source code.</p>
            <h2>HTML Comment Tags</h2>
            <ul>
<li>You can add comments to your HTML source by using the following syntax:</li>
            <pre>
              <code>
              &lt;!-- Write your comments here --&gt;
                       </code>
            </pre>
              <p>Notice that there is an exclamation point (!) in the start tag, but not in the end tag.</p>

<p>Note: Comments are not displayed by the browser, but they can help document your HTML source code.</p>

<li>With comments you can place notifications and reminders in your HTML code:</li>
            <pre>
            <code>
            &lt;!-- This is a comment --&gt;

&lt;p&gt;This is a paragraph.&lt;/p&gt;

&lt;!-- Remember to add more information here --&gt;
            </code>
            </pre>
              <li>Comments are also great for debugging HTML, because you can comment out HTML lines of code, one at a time, to search for errors:</li>
              <pre>
              <code>
              &lt;!-- Do not display this image at the moment
&lt;img border="0" src="pic_trulli.jpg" alt="Trulli"&gt;
--&gt;
              </code>
              </pre>
              </ul>
            </article>
            </section>
            <section class="main-section" id="Reference">               
    <header>Reference</header>
          <article>
                <p>All the documentation in this page is taken from
            <a href="https://www.w3schools.com/html/default.asp" target="_blank">w3schools</a></p>
             </article>
          </section>
      </main>
    </body>
              
            
!

CSS

              
                @import url('https://fonts.googleapis.com/css2?family=Padauk:wght@700&display=swap');
html,
body {
  min-width: 300px;
  height: 0%;
  color: #eeeeee;
  background-color: rgba(24, 57, 43, 0.5);
  font-family: 'Padauk', sans-serif;
  line-height: 1.5;
}

#navbar {
  position: fixed;
  min-width: 55px;
  top: 0px;
  left: 0px;
  width: 250px;
  height: 100%;
  border-right: solid;
  border-color: #eeeeee;
}

header {
  color: #eeeeee;
  margin: 0 0 15px 1px;
  padding-top: 5px;
  text-align: center;
  font-size: 30px;
  font-weight: 700;
  text-shadow: 5px 5px 3px #000000, 0 0 3px #000000;
}

h2 {
  color: #282e2b;
  font-size: 24px;
  font-weight: bold;
  text-shadow: 1px 1px 3px white, 0 0 3px white;
}

#main-doc  header {
  text-align: left;
}

#navbar  ul {
  height: 88%;
  padding: 0px 0 0 5px;
  display: inline-block;
  overflow-y: auto;
  overflow-x: hidden;
}

#navbar  li {
  color: #a3a2a2;
  display: inline-block;
  border-top: solid;
  list-style: none;
  position: relative;
  width: 100%;
}

#navbar a {
  display: block;
  padding: 5px;
  color: #eeeeee;
  text-decoration: none;
  cursor: pointer;
  font-size: 20px;
  text-shadow: 3px 1px 5px #000000;
}

#main-doc {
  position: relative;
  margin-left: 20%;
  padding: 1px 0 0 5px;
  margin-bottom: 1px;
}

section article {
  color: #eeeeee;
  margin: 1px;
  font-size: 20px;
  word-break: break-all;
}

section li {
  margin: 1px;
}

code {
  display: block;
  text-align: left;
  white-space: pre-line;
  position: relative;
  word-break: break-all;
  word-wrap: normal;
  line-height: 1.5;
  background-color: #a3a2a2;
  padding: 0px 0px 25px 40px;
  margin-right:  120px;
  margin-bottom: 1px;
  border-radius: 15px;
}

@media only screen and (max-width: 767px) {
  /* For mobile phones: */
  #navbar ul {
    display: block;
    border: 1px solid;
    height: 207px;
  }
  #navbar li {
     display: block;
  }

  #navbar {
    background-color: rgba(24, 57, 43, 0.5);
    position: fixed;
    top: 0;
    left: 0;
    right: initial;
    padding: 0;
    width: 40%;
    height: 100%;
    border: none;
    z-index: 1;
    border-bottom:  2px solid;
    /*width: 0%;*/
  }

  #main-doc {
    position: relative;
    margin-left: 5px;
    margin-top: 5px;
    padding-left: 40%;
  }
}

@media only screen and (max-width: 400px) {
  #main-doc {
    position: relative;
    margin-left: 25px;
    padding-left: 40px;
    width: 699vw;
  }

  code {
    margin-left: 5px;
    width: 100%;
    padding: 15px;
    padding-left: 10px;
    padding-right: 45px;
    min-width: 233px;
    word-break: break-all;
  }
}
              
            
!

JS

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

Console