Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs 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 its URL and the proper URL extension.

+ 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

Auto Save

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

              
                This is just some random text. 

We can tag it, but we don't have to.

Notice that the browser does not honor any whitespace, except 
single
    whitespace
      characters
        and
          single
            carriage returns (ENTER key).



<h1>Normal Document Flow in HTML</h1>
<div>This is a div.</div>

<div>
  This is a div. 
  With some ENTER keys.
  This is a div.
</div>

<div>This is a div.</div>


<div>This is a div.</div>

<span>This is a span.</span>

<div>This is a div.</div>

<span>This is a span.</span> <span>This is a span.</span>

<span>This is a span.</span>
<span>This is a span.</span>

<div>A div is a block-level element.</div>
<span>A span is an inline element.</div>
              
            
!

CSS

              
                h1 { background: plum; border: 1px solid blue }

/* 
div { background: plum; border: 1px solid blue } 
*/

/* 
p { background: plum; border: 1px solid blue } 
*/


/*
HTML Conclusions:
1. HTML elements flow on a web page (web document), kind of like a river.
2. This what normal document flow looks like:
----------------
| ------------> |
| ------------> |
| ------------> |
| ------------> |
| ------------> |
-----------------
Normal document flow means that elements flow:
2.1. top-to-bottom
2.2. left-to-right

3. Normal document flow when we only have divs:

-----------------------------
| <div>..............</div> |
| <div>..............</div> |
| <div>..............</div> |
| <div>..............</div> |
| <div>..............</div> |
| <div>..............</div> |
| <div>..............</div> |
| <div>..............</div> |
-----------------------------

Regardless of how long is the text content inside a div, each div will fill the entire available width of its parent. That's why the <div> element is what's known as a block-level element. In a normal document flow, a bunch of divs look like a bunch of blocks stacked on top of one another.

4. Normal document flow when we have span tags only:

------------------------------------------------------
| <span>...</span> <span>...</span> <span>...</span> |
| <span>...</span> <span>...</span> <span>...</span> |
| <span>...</span> <span>...</span> <span>...</span> |
| <span>...</span> <span>...</span> <span>...</span> |
| <span>...</span> <span>...</span> <span>...</span> |
| <span>...</span> <span>...</span> <span>...</span> |
| <span>...</span> <span>...</span> <span>...</span> |
| <span>...</span> <span>...</span> <span>...</span> |
                      ...etc...
------------------------------------------------------

This is why the <span> element is called an INLINE element.

*/

/* CSS Conclusions:
 3. We can comment out single lines in CSS files with two consecutive backslash characters.
 
 4. A multi-line comment starts with:
/* 
... and ends with: */

              
            
!

JS

              
                
              
            
!
999px

Console