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.


  <!-- Content -->


    <h1>Cool Navigation</h1>

 <!-- Classe "scroll" sur les liens, href et id sont les mêmes comme sur une ancre normale -->

      <a class="scroll" href="#section-1">Section 1</a>
      <a class="scroll" href="#section-2">Section 2</a>
      <a class="scroll" href="#section-3">Section 3</a>
      <a class="scroll" href="#section-4">Section 4</a>   
<section id="section-1"><span>Section 1</span></section>
 <section id="section-2"><span>Section 2</span></section>
 <section id="section-3"><span>Section 3</span></section>
 <section id="section-4"><span>Section 4</span></section>     




                /* ************ */  
/* Basic styles */   
/* ************ */ 

* {box-sizing: border-box;}

html, body, a {font-family: "Ubuntu", sans-serif; font-weight: 300; color: #9498a7;}

body {background: #eff7ff;}

a {text-decoration: none;}

h1 {padding: 170px 0 100px; text-align: center; font-size: 2.4em; color: #35394b;}

/* *************** */
/* Specific styles */
/* *************** */

nav {
    position: fixed;
    width: 100%;
    text-align: center; 
    height: 70px;
    padding: 10px;
    line-height: 50px;
    background: none;
    -webkit-transition: all 0.3s;
    transition: all 0.3s;
    z-index: 999;
nav a {
    padding: 0 20px;
    margin: 0 10px;
    display: inline-block;
    border: 1px solid #9498a7;

.scrolled {
    background-color: rgba(239, 247, 255, 0.7);
    opacity: 1;
    top: 0px;
    border-bottom: 1px solid gainsboro;

section {
    position: relative;
    height: 100vh;

/* Petit trick pour centrer horizontalement et verticalement un élément, merci Codyhouse */

section span {
    position: absolute;
    top: 50%;
    left: 50%;
    -webkit-transform: translate3d(-50%,-50%,0);
    transform: translate3d(-50%,-50%,0);
    font-size: 2em;
    color: #35394b;

#section-1 {background: #40b1d0;}
#section-2 {background: #f4d246;}
#section-3 {background: #ff987e;}
#section-4 {background: #ad8bd4;}



                //Sticky Header
$(window).scroll(function() {

    if ($(window).scrollTop() > 100) {
    } else {

// Au clic des liens qui ont la classe scroll, on "anime" (scroll) le body (html corrige un bug sur firefox/IE) jusqu'à l'élément dont l'ID correspond au href du lien cliqué

// Le chiffre (500) correspond à la vitesse en millisecondes de l'animation. Ici, 0.5 secondes.



        $('html, body').animate({

            scrollTop: $( $.attr(this, 'href') ).offset().top
        }, 500);
        return false;