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

              
                <h1>Menu horizontal sticky HTML et CSS</h1>
<nav>
  <ul>
    <li><a href="#">Cours Complets</a></li>
    <li><a href="#">Articles</a></li>
    <li><a href="#">Contact</a></li>
    <li><a href="#">A propos</a></li>
  </ul>
</nav>

<div class="conteneur">
  <p>Du contenu sous le menu</p>
</div>
              
            
!

CSS

              
                /*Reset CSS*/
*{
    margin: 0px;
    padding: 0px;
    font-family: Avenir, sans-serif;
}

nav{
    width: 100%;
    margin: 0px auto 40px auto;
    background-color: white;
    position: sticky;
    top: 0px;
}

nav ul{
    list-style-type: none;
}

nav li{
    float: left;
    width: 25%;/*100% divisé par le nombre d'éléments de menu*/
    text-align: center;/*Centre le texte dans les éléments de menu*/
}

/*Evite que le menu n'ait une hauteur nulle*/
nav ul::after{
    content: "";
    display: table;
    clear: both;
}

nav a{
    display: block; /*Toute la surface sera cliquable*/
    text-decoration: none;
    color: black;
    border-bottom: 2px solid transparent;/*Evite le décalage des éléments sous le menu à cause de la bordure en :hover*/
    padding: 10px 0px;/*Agrandit le menu et espace la bordure du texte*/
}

nav a:hover{
    color: orange;
    border-bottom: 2px solid gold;
}

.conteneur{
  margin: 0px 20px;
  height: 1500px;
}
              
            
!

JS

              
                
              
            
!
999px

Console