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

              
                <nav id="navbar">
  <header>HTML&CSS Documentation</header>
  <ul>
   <li><a class="nav-link" href="#Responsive_Web_Design">Responsive Web Design</a></li>
    <li><a class="nav-link" href="#Basic_HTML_and_HTML5">Basic HTML and HTML5</a></li>
    <li><a class="nav-link" href="#Headline_with_the_h_Element">Headline with the h Element</a></li>
    <li><a class="nav-link" href="#Link_to_External_Pages_with_Anchor_Elements">Link to External Pages with Anchor Elements</a></li>
    <li><a class="nav-link" href="#Adding_Images">Adding Images</a></li>
    <li><a class="nav-link" href="#Nest_an_Anchor_element_within_paragraph">Nest an Anchor element within paragraph</a></li>
    <li><a class="nav-link" href="#Create_a_bulleted_Unordered_list">Create a bulleted Unordered list</a></li>
    <li><a class="nav-link" href="#Introduction_to_basic_CSS">Introduction to basic CSS</a></li>
    <li><a class="nav-link" href="#Change_the_Color_of_Text">Change the Color of Text</a></li>
    <li><a class="nav-link" href="#Size_Your_Images">Size Your Images</a></li>
    <li><a class="nav-link" href="#Add_Borders_Around_your_Elements">Add Borders Around your Elements</a></li>
  </ul>
  </nav>

<main id="main-doc">
<section class="main-section" id="Responsive_Web_Design">
<header>Responsive Web Design</header>
<article>
<p>In this documentation we will learn some very basics of HTML/HTML5 and CSS languages.</p>
<p>HTML (Hypertext Markup Language) is used for content, and CSS (Cascading Style Sheets) for design.</p>
</article>
</section>

<section class="main-section" id="Basic_HTML_and_HTML5">
<header>Basic HTML and HTML5</header>
<article>
  <p>HTML is a markup language that uses a special syntax or notation to describe the structure of a webpage to the browser. HTML elements usually have opening and closing tags that surround and give meaning to content. For example, different elements can describe text as a heading, paragraph, or list item.</p>
  <p>Some HTML topics include:</p>
    <li>Headline with the h element</li>
    <li>Link to External Pages with Anchor Elements</li>
    <li>Adding Images</li>
    <li>Nest an Anchor element within Paragraph</li>
    <li>Create a bulleted Unordered list</li>
</article>
</section>

<section class="main-section" id="Headline_with_the_h_Element">
<header>Headline with the h Element</header>
<article>
<p>This element tells the browser about the structure of your website. <mark><b>h1</b></mark> elements are often used for main headings, while h2 elements are generally used for subheadings. There are also h3, h4, h5 and h6 elements to indicate different levels of subheadings.</p>
<p>Opening tag looks like this:</p>
<code>&lt;h1&gt;</code>
<p>Closing tag example:</p>
<code>&lt;/h1&gt;</code>
</article>
</section>

<section class="main-section" id="Link_to_External_Pages_with_Anchor_Elements">
<header>Link to External Pages with Anchor Elements</header>
<article>
<p>You can use <mark><b>a</b></mark> (anchor) elements to link to content outside of your web page.</p>
<p>a elements need a destination web address called an <mark><b>href</b></mark> attribute. They also need anchor text. Here's an example:</p>
<code>&lt;a href="https://www.cnn.com/">this links to cnn.com&lt;/a&gt;  </code>
</article>
</section>

<section class="main-section" id="Adding_Images">
<header>Adding Images</header>
<article>
  <p>You can add images to your website by using the <mark><b>img</b></mark> element, and point to a specific image's URL using the <mark><b>src</b></mark> attribute.</p>
<code>&lt;img src="http://cdn.akc.org/content/article-body-image/samoyed_puppy_dog_pictures.jpg"&gt; </code>
<p>Note that img elements are self-closing.</p>
</article>
</section>

<section class="main-section" id="Nest_an_Anchor_element_within_paragraph">
<header>Nest an Anchor element within Paragraph</header>
<article>
  <p>You can nest links within other text elements. For example: </p>

  <code>&lt;p&gt;
    Here's a &lt;a target="_blank" href="https://www.freecodecamp.org"> link to www.freecodecamp.org&lt;/a&gt; for you to follow.  </code>
    <p><mark><b>Target</b></mark> is an anchor tag attribute that specifies where to open the link. The value <mark><b>_blank</b></mark> specifies to open the link in a new tab. The href is an anchor tag attribute that contains the URL address of the link:</p>
</article>
</section>

<section class="main-section" id="Create_a_bulleted_Unordered_list">
<header>Create a bulleted Unordered list</header>
<article>
<p> Unordered lists start with an opening <mark><b>&lt;ul&gt;</b></mark> element, followed by any number of <mark><b>&lt;li&gt;</b></mark> elements. Finally, unordered lists close with a <mark><b>&lt;/ul&gt;</b></mark>.  </p>
<p>For example:</p>

<br><code>&lt;ul&gt;</code>
<code>&lt;li&gt;pen&lt;/li&gt; </code>
<code>&lt;li&gt;notebook&lt;/li&gt; </code>
<code>&lt;/ul&gt;</code></br>
<p>This would create a bullet point style of list of pen and notebook.</p>
</article>
</section>

<section class="main-section" id="Introduction_to_basic_CSS">
<header>Introduction to basic CSS</header>
<article>
  <p>CSS, or Cascading Style Sheets, tell the browser how to display the text and other content that you write in HTML. With CSS, you can control the color, font, size, spacing, and many other aspects of HTML elements. </p>
  <p>Some CSS topics below:</p>
   <li>Change the Color of Text</li>
    <li>Size Your Images</li>
    <li>Add Borders Around your Elements</li>
</article>
</section>

<section class="main-section" id="Change_the_Color_of_Text">
<header>Change the Color of Text</header>
<article>
<p>We can do this by changing the style of your h element.</p>
   <li>Change the Color of Text</li>
    <li>Size Your Images</li>
    <li>Add Borders Around your Elements</li>
<code>&lt;h2 style="color: blue;">Insert text here&lt;/h2&gt; </code>
</article>
</section>

<section class="main-section" id="Size_Your_Images">
  <header>Size Your Images</header>
  <article>
    <p>CSS has a property called <mark><b>width</b></mark> that controls an element's width. Just like with fonts, we'll use px (pixels) to specify the image's width.</p>
    <p>For example, if we wanted to create a CSS class called larger-image that gave HTML elements a width of 500 pixels, we'd use:</p>
<br><code>&lt;style&gt;</code>
<code>.larger-image{ width: 500px; }</code>
<code>&lt;/style&gt;</code> </br>
  </article>
</section>

<section class="main-section" id="Add_Borders_Around_your_Elements">
<header>Add Borders Around your Elements</header>
<article>
<p> if we wanted to create a red, 5 pixel border around an HTML element, we could use this class:</p>
<br><code>&lt;style&gt;</code>
<code>.thin-red-border {</code>
<code>border-color: red;</code>
<code>border-width: 5px;</code>
<code>border-style: solid;
  }</code>
<code>&lt;/style&gt;</code> </br>
</article>
</section>
</main>
              
            
!

CSS

              
                  
body{
  min-width: 290px;
  background-color: azure;
  font-family:sans-serif;
  color:dark grey;

}

#navbar{
position: fixed;
border-right: solid;
border-color:bisque;
top: 0px;
left: 0px;
width: 300px;
height: 90%;
padding: 10px;
}

#main-doc{
position: absolute;
margin-left: 300px;
padding:20px;
font-size:smaller
}

#main-doc header{
text-align: left;
color:black;
font-size:large;

}

header{
color: black;
text-align: center;
font-weight: bolder;
}

code{
display: block;
text-align: left;
padding: 10px;
background-color: antiquewhite;
border-radius: 2px;
width: 50%;
}

mark{
background-color: lightgray;
}

#navbar ul{
height: 100%;
padding: 0;
overflow-y: auto;
overflow-x: hidden;
}

#navbar li{
border: 1px solid;
position: relative;
padding: 10px;
width: auto;
font-size:medium;
border-radius: 10px;
}

#navbar a{
text-decoration:none;
display: block;
color: darkcyan
}

#section article{
margin: 10px;
font-size: 0.96em;
}




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

#navbar {
  background-color: white;
  position: absolute;
  top: 0;
  padding: 0;
  margin: 0;
  width: 100%;
  max-height: 275px;
  border: none;
  z-index: 1;
  border-bottom: 2px solid;
}

#main-doc {
  position: relative;
  margin-left: 0px;
  margin-top: 270px;
}
}

@media only screen and (max-width: 400px) {
#main-doc {
  margin-left: -10px;
}

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

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