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

              
                <div class="content">
<header>
  <h1>フローティングメニュー</h1>
</header>

<nav>
  <ul>
    <li><a href="#">menu01</a></li>
    <li><a href="#">menu02</a></li>
    <li><a href="#">menu03</a></li>
    <li><a href="#">menu04</a></li>
  </ul>
</nav>
  
  <main>
  <p>
    Aliqua velit laboris non eiusmod veniam proident aute mollit veniam. Irure reprehenderit incididunt occaecat laborum ea id culpa eu. Laboris cillum ullamco cupidatat dolor eu minim et tempor officia cillum aliqua ad duis. Sit pariatur nisi nisi pariatur veniam consectetur Lorem nostrud cillum. Id elit dolore quis magna exercitation irure dolore laboris exercitation sunt veniam magna id. Anim velit Lorem occaecat Lorem adipisicing minim exercitation veniam do occaecat cupidatat. Consequat elit excepteur minim ea anim ullamco anim velit.
    </p>
     <p>
    Aliqua velit laboris non eiusmod veniam proident aute mollit veniam. Irure reprehenderit incididunt occaecat laborum ea id culpa eu. Laboris cillum ullamco cupidatat dolor eu minim et tempor officia cillum aliqua ad duis. Sit pariatur nisi nisi pariatur veniam consectetur Lorem nostrud cillum. Id elit dolore quis magna exercitation irure dolore laboris exercitation sunt veniam magna id. Anim velit Lorem occaecat Lorem adipisicing minim exercitation veniam do occaecat cupidatat. Consequat elit excepteur minim ea anim ullamco anim velit.
    </p>
  </main>
  </div>
              
            
!

CSS

              
                .content {
  width:320px;
 background-color: #fff7f7;
  margin: 0 auto 0 auto;
  position: relative;
}

h1 {
  text-align: center;
  font-size: 18px;  
}

p {
  padding-left: 8px;
}

main {
  width: 220px;
}
nav {
  position: absolute;
  top: 50px;
  left: 230px;
  border: solid 1px #000;
}

ul {
  display: flex;
  flex-direction: column;
  gap: 8px;
  list-style-type: none;
  padding-left: 0px;
  
}

li a {
  padding: 0 10px;
  color: #000;
  text-decoration: none;
}

              
            
!

JS

              
                $(function(){
  $(window).scroll(function(){
    $("nav").stop().animate({"top" : $(window).scrollTop() + 50}, 600);    
  });  
});
              
            
!
999px

Console