Pen Settings



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


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


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.


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.


                <header id="site-header">
    <h1 id="site-logo">logo</h1>

<main id="main">


                /* Google FontsからNoto Sansを読み込む */
@import url('');

/* ヘッダ */
header {
	overflow: hidden;
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	z-index: 100;
	background-color: #00a8ff;
	text-align: center;
	transition: height 0.3s;
	/* サイトロゴ */
	h1#site-logo {
		line-height: 1.5;
		font-size: 5rem;
		font-family: 'Noto Sans', sans-serif;
		color: #fff;
		transition: all 0.3s;
	/* 縮小時のサイトロゴ */
	&.smaller {
		h1#site-logo {
			line-height: 1;
			font-size: 2rem;

/* メインカラム */
#main {
	height: 20000px;


                // 何ピクセルスクロールしたらヘッダを変化させるか
var px_page_y   = 300;
// HEADER要素の取得
var header = document.getElementById( "site-header" );

// スクロールのイベントハンドラを登録
window.addEventListener( "scroll" , function(e){
	// 変化するポイントまでスクロールしたかを判定
	if ( window.pageYOffset > px_page_y ) {
		// クラスを追加
		header.classList.add( "smaller" );

	// スクロール位置が変化するポイント以前で、さらにsmallerクラスがあるか判定
	} else if ( header.classList.contains( "smaller" ) ) {
		// クラスを削除
		header.classList.remove( "smaller" );
} );