Pen Settings



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


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.


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.


  <h1>Sticky Navigation Example</h1>

  <li><a href="#">Home</a></li>
  <li><a href="#">About</a></li>
  <li><a href="#">Services</a></li>
  <li><a href="#">Contact</a></li>

 <h2>Main Content</h2>
 <p>One morning, when Gregor Samsa woke from troubled dreams, he found himself transformed in his bed into a horrible vermin.<br>He lay on his armour-like back, and if he lifted his head a little he could see his brown belly, slightly domed and divided by arches into stiff sections.<br>The bedding was hardly able to cover it and seemed ready to slide off any moment. His many legs, pitifully thin compared with the size of the rest of him, waved about helplessly as he looked.<br>"What's happened to me?" he thought.</p>



                * {
  margin: 0;
  padding: 0;

body {
   font-family: Arial, sans-serif;

header {
   background-color: #B0AB99;
   color: #fff;
   padding: 20px;
   text-align: center;

nav {
 background-color: #3EE2FF;
 padding: 10px;
 position: sticky;
 top: 0; /* スクロール領域の上端からの位置 */
 z-index: 100; /* 他の要素より上に配置 */

nav ul {
  display: flex;
  justify-content: space-between;
  padding: 0 20px; 

nav ul li {
  list-style: none;

nav ul li a {
  color: #333;
  text-decoration: none;

section {
  padding: 20px;
  margin: 10px;
  border: 1px solid #ddd;
  height: 1200px; /* スクロールが可能な範囲を作成するために追加 */

section h2 {
  margin-bottom: 20px;

section div {
  width: 400px;
  height: 300px;
  line-height: 300px;
  text-align: center;
  background-color: #E1EDED;
  margin-bottom: 40px;