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

              
                <div id="block">
	<diV id="fixed-block-head">
		here is the block title (fixed).
	</div>
	<diV id="scrollable-content">
		<p>Scroll meh 1</p>
		<p>Scroll meh 2</p>
		<p>Scroll meh 3</p>
		<p>Scroll meh 4</p>
		<p>Scroll meh 5</p>
	</div>
</div>
              
            
!

CSS

              
                /* fancy CSS */
body {
	background: #eee;
	padding: 5em;
}

#block {
	box-shadow: 0 0 20px rgba(0, 0, 0, .6);
	border-radius: 3px;
	background: white;
	resize: both; /* makes it resizeable  */
	overflow: hidden; /* "hidden" for outer #block. "scroll" for inner block. */
}

#fixed-block-head {
	padding: 25px;
}

#scrollable-content {
	line-height: 10em;
	padding: 25px;
}


/* the positionning (make the right element scroll / resize) ! */

#block {
	height: 600px;
  display: flex;
  flex-direction: column;
}


#scrollable-content {
	overflow-y: scroll; /* scroll is here */
}


/* the MAGIC (let the shadow be) ! */

#fixed-block-head {
	position: relative;
}

#fixed-block-head::after { /* this pseudo-elements contains the actual shadow (it’s fixed)*/
	content: "";
	display: block;
	background: transparent;
	height: 5px;
	width: 100%;
	position: absolute;
	left: 0;
	bottom: 0;
	z-index: 1;
	box-shadow: 0 3px 3px silver;
}

#scrollable-content {
	position: relative;
}

#scrollable-content::before { /* this pseudo-element scrolls with the content.*/
	/* it hides the previously declared shadow when not scrolled and unveils it when scrolled"*/
	content: "";
	display: block;
	background: linear-gradient(white 50%, transparent); /* could be plaine white, this is more smooth */
	height: 8px;
	width: 100%;
	position: absolute;
	top: 0px;
	z-index: 1;
	border-top: 1px solid silver; /* not required. Try without for yourself */
	left: 0;
}
              
            
!

JS

              
                
              
            
!
999px

Console