Pen Settings

HTML

CSS

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

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

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

Behavior

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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

HTML

              
                <header id="header" role="banner" class="main-header">
	<div class="header-inner">
 
		<div class="header-logo">
			LOGO
		</div>
 
		<nav class="header-nav nav-is-stuck">
			<ul>
				<li><a href="index.php">Home</a></li>
				<li><a href="#">Our projects</a></li>
				<li><a href="about.php">About us</a></li>
				<li><a href="#">Contact</a></li>
			</ul>
		</nav> 
	    </div>
</header>

<body>
    <div id="BaconIpsum">
        <h1>Ceci est mon premier titre</h1>
        <p>Ceci est mon premier paragraphe</p>
        <p>Bacon ipsum dolor amet ball tip pork chop burgdoggen filet mignon ribeye leberkas cow rump landjaeger prosciutto venison beef ribs tongue. Prosciutto ribeye kielbasa capicola, spare ribs biltong shoulder boudin kevin t-bone cow tenderloin strip
            steak. Pancetta short loin bresaola, tri-tip pork loin spare ribs andouille shank ground round bacon rump drumstick. Ham hock short ribs hamburger, chicken brisket turducken bresaola kielbasa meatloaf drumstick alcatra pork belly. Short loin
            pork picanha ham. Pork loin meatball pastrami jerky, salami shank chuck pork hamburger biltong tongue boudin prosciutto. Porchetta pork chop kielbasa flank, sausage pork loin pig strip steak tongue t-bone chuck bresaola salami ham.</p>
        <p>Filet mignon sausage turkey porchetta drumstick brisket. Pork belly cupim short loin ham hock swine tail. Sirloin flank pork loin, pork chop kevin biltong hamburger ribeye chuck prosciutto ball tip. Short ribs burgdoggen ham, shank bacon meatball
            flank cupim cow. Beef andouille venison, shankle salami pork loin tri-tip landjaeger hamburger pig fatback. Pig venison doner shankle strip steak tenderloin jowl boudin. Fatback pork belly tongue, bresaola tenderloin pancetta porchetta swine
            capicola doner shoulder pork chop short loin cupim.</p>
        <p>Tri-tip andouille tenderloin beef ribs beef, jowl short loin leberkas turducken. Chicken pig bacon cow, drumstick corned beef andouille flank frankfurter burgdoggen tail. Swine turducken meatloaf bresaola filet mignon. Jowl pancetta boudin filet
            mignon beef ribs spare ribs, kevin flank meatball.</p>
        <p>Venison pig fatback hamburger sirloin pastrami alcatra swine. Swine pork belly kevin doner pork shankle spare ribs jowl hamburger cupim. Meatball shankle ball tip burgdoggen, pastrami short loin cupim bresaola. Shankle rump sausage ball tip short
            loin ham fatback turducken tri-tip bresaola boudin kielbasa. Biltong flank boudin, salami short ribs ball tip beef ribs drumstick filet mignon tri-tip prosciutto.</p>
        <p>Venison brisket andouille pastrami swine pig ham kevin beef meatloaf boudin filet mignon shank. Meatloaf ball tip pork loin hamburger spare ribs biltong, tail picanha prosciutto tongue short loin ham turducken. Ham hock beef strip steak pork leberkas
            salami biltong. Ground round t-bone tenderloin, beef ribs turkey shank ribeye drumstick. Brisket shoulder shankle strip steak. Turkey jerky kielbasa corned beef pork belly ham. Tenderloin corned beef chuck kielbasa shoulder turducken sausage
            cow.
        </p>
        <p>Corned beef tri-tip turkey shank shoulder swine venison. Shankle beef ball tip meatloaf burgdoggen short ribs t-bone tenderloin frankfurter brisket capicola shoulder ground round. Alcatra cupim pork loin strip steak chicken pastrami, tri-tip fatback
            flank filet mignon swine ham hock hamburger. Kevin shank sirloin pork leberkas pig. Meatloaf bresaola chicken, cow chuck biltong bacon pastrami beef ribs. Ground round kevin shankle burgdoggen.</p>
        <p>Biltong chicken shank kevin venison meatball pig fatback short ribs alcatra cupim tongue kielbasa. Leberkas filet mignon prosciutto, doner meatball bacon kevin. Capicola alcatra sirloin picanha sausage. Leberkas chicken filet mignon doner shankle
            turducken. Meatball strip steak tenderloin shankle pig tail turkey ground round meatloaf picanha. Short loin pancetta leberkas pork kielbasa, kevin pig spare ribs brisket tri-tip.</p>
        <p>Shoulder swine bacon turkey. Frankfurter pig ribeye short ribs bresaola tongue leberkas strip steak ham hock turducken. Bacon flank tail pork loin beef ribs bresaola strip steak picanha pastrami shank frankfurter. Landjaeger bresaola ground round,
            filet mignon jowl alcatra tail frankfurter capicola shankle pastrami. Pork loin burgdoggen brisket shank bacon spare ribs. Shankle meatloaf leberkas sausage.</p>
        <p>Tail fatback doner ball tip. Rump filet mignon alcatra, ribeye chicken prosciutto spare ribs shoulder boudin beef biltong tongue meatloaf tenderloin drumstick. Kevin ham hock burgdoggen chuck pastrami t-bone alcatra. Landjaeger swine jerky short
            loin ball tip pastrami capicola biltong. Spare ribs chuck pig short loin chicken. Kevin beef pork belly, tongue flank tenderloin turducken chuck turkey ribeye biltong. Andouille ground round corned beef ribeye drumstick burgdoggen landjaeger
            chuck t-bone strip steak venison pork chop short ribs.</p>
        <p>Salami filet mignon ground round bacon boudin. Pastrami kevin spare ribs, beef meatloaf leberkas pork loin biltong shankle bresaola. Pork chop shankle biltong beef ribs ground round spare ribs porchetta pig. Hamburger prosciutto meatloaf spare
            ribs.
        </p>
        <p>Bacon ipsum dolor amet ball tip pork chop burgdoggen filet mignon ribeye leberkas cow rump landjaeger prosciutto venison beef ribs tongue. Prosciutto ribeye kielbasa capicola, spare ribs biltong shoulder boudin kevin t-bone cow tenderloin strip
            steak. Pancetta short loin bresaola, tri-tip pork loin spare ribs andouille shank ground round bacon rump drumstick. Ham hock short ribs hamburger, chicken brisket turducken bresaola kielbasa meatloaf drumstick alcatra pork belly. Short loin
            pork picanha ham. Pork loin meatball pastrami jerky, salami shank chuck pork hamburger biltong tongue boudin prosciutto. Porchetta pork chop kielbasa flank, sausage pork loin pig strip steak tongue t-bone chuck bresaola salami ham.</p>
        <p>Filet mignon sausage turkey porchetta drumstick brisket. Pork belly cupim short loin ham hock swine tail. Sirloin flank pork loin, pork chop kevin biltong hamburger ribeye chuck prosciutto ball tip. Short ribs burgdoggen ham, shank bacon meatball
            flank cupim cow. Beef andouille venison, shankle salami pork loin tri-tip landjaeger hamburger pig fatback. Pig venison doner shankle strip steak tenderloin jowl boudin. Fatback pork belly tongue, bresaola tenderloin pancetta porchetta swine
            capicola doner shoulder pork chop short loin cupim.</p>
        <p>Tri-tip andouille tenderloin beef ribs beef, jowl short loin leberkas turducken. Chicken pig bacon cow, drumstick corned beef andouille flank frankfurter burgdoggen tail. Swine turducken meatloaf bresaola filet mignon. Jowl pancetta boudin filet
            mignon beef ribs spare ribs, kevin flank meatball.</p>
        <p>Venison pig fatback hamburger sirloin pastrami alcatra swine. Swine pork belly kevin doner pork shankle spare ribs jowl hamburger cupim. Meatball shankle ball tip burgdoggen, pastrami short loin cupim bresaola. Shankle rump sausage ball tip short
            loin ham fatback turducken tri-tip bresaola boudin kielbasa. Biltong flank boudin, salami short ribs ball tip beef ribs drumstick filet mignon tri-tip prosciutto.</p>
        <p>Venison brisket andouille pastrami swine pig ham kevin beef meatloaf boudin filet mignon shank. Meatloaf ball tip pork loin hamburger spare ribs biltong, tail picanha prosciutto tongue short loin ham turducken. Ham hock beef strip steak pork leberkas
            salami biltong. Ground round t-bone tenderloin, beef ribs turkey shank ribeye drumstick. Brisket shoulder shankle strip steak. Turkey jerky kielbasa corned beef pork belly ham. Tenderloin corned beef chuck kielbasa shoulder turducken sausage
            cow.
        </p>
        <p>Corned beef tri-tip turkey shank shoulder swine venison. Shankle beef ball tip meatloaf burgdoggen short ribs t-bone tenderloin frankfurter brisket capicola shoulder ground round. Alcatra cupim pork loin strip steak chicken pastrami, tri-tip fatback
            flank filet mignon swine ham hock hamburger. Kevin shank sirloin pork leberkas pig. Meatloaf bresaola chicken, cow chuck biltong bacon pastrami beef ribs. Ground round kevin shankle burgdoggen.</p>
        <p>Biltong chicken shank kevin venison meatball pig fatback short ribs alcatra cupim tongue kielbasa. Leberkas filet mignon prosciutto, doner meatball bacon kevin. Capicola alcatra sirloin picanha sausage. Leberkas chicken filet mignon doner shankle
            turducken. Meatball strip steak tenderloin shankle pig tail turkey ground round meatloaf picanha. Short loin pancetta leberkas pork kielbasa, kevin pig spare ribs brisket tri-tip.</p>
        <p>Shoulder swine bacon turkey. Frankfurter pig ribeye short ribs bresaola tongue leberkas strip steak ham hock turducken. Bacon flank tail pork loin beef ribs bresaola strip steak picanha pastrami shank frankfurter. Landjaeger bresaola ground round,
            filet mignon jowl alcatra tail frankfurter capicola shankle pastrami. Pork loin burgdoggen brisket shank bacon spare ribs. Shankle meatloaf leberkas sausage.</p>
        <p>Tail fatback doner ball tip. Rump filet mignon alcatra, ribeye chicken prosciutto spare ribs shoulder boudin beef biltong tongue meatloaf tenderloin drumstick. Kevin ham hock burgdoggen chuck pastrami t-bone alcatra. Landjaeger swine jerky short
            loin ball tip pastrami capicola biltong. Spare ribs chuck pig short loin chicken. Kevin beef pork belly, tongue flank tenderloin turducken chuck turkey ribeye biltong. Andouille ground round corned beef ribeye drumstick burgdoggen landjaeger
            chuck t-bone strip steak venison pork chop short ribs.</p>
        <p>Salami filet mignon ground round bacon boudin. Pastrami kevin spare ribs, beef meatloaf leberkas pork loin biltong shankle bresaola. Pork chop shankle biltong beef ribs ground round spare ribs porchetta pig. Hamburger prosciutto meatloaf spare
            ribs.
        </p>
    </div>
    </body>
              
            
!

CSS

              
                /*https://www.creativejuiz.fr/blog/tutoriels/creer-menu-sticky-avec-javascript-css*/

/* micro reset */
* {
	box-sizing: border-box;
}

html, body, ul {
	padding: 0; margin: 0;
}

/* Quelques styles de base */
body {
	font-family: Helvetica Neue, Helvetica, Arial, sans-serif;
	color: black;
	background: #F2F2F2; /* Je l'ai mis vert pour que tu comprenne. */
    background-size: cover; 
    width: 75%;
    line-height: 1.5;
    margin-right: auto;
    margin-left: auto;
}
.header-inner {
	color: #B13C2E;
	background: #FFF;
}

/* Les éléments sont placés l'un à côté de l'autre */
.header-inner {
	display: table;
	width: 100%;
	max-width: 1200px;
	margin: 0 auto; /* on centre l'élément */
	padding: 20px 25px; /* on ventile un peu */
}
.header-inner > * {
	display: table-cell;
	vertical-align: middle;
}

/* Alignement du menu */
.header-nav {
	text-align: right;
}
/*
   Faire passer le menu en inline (inline-block, inline-table ou inline-flex) pour le rendre sensible à l'alignement à droite. Ses items aussi sont en inline.
*/
.header-nav ul,
.header-nav li {
	display: inline;
	list-style: none;
}
.header-nav a {
	position: relative;
	display: inline-block;
	padding: 8px 20px;
	vertical-align: middle;
	font-weight: 300; /* entre regular et light */
	letter-spacing: 0.025em;
	color: inherit;
	text-decoration: none;
}

/* Animation du lien */
.header-nav a:after {
	content: "";
	position: absolute;
	bottom: 0; right: 20px; left: 20px;
	height: 2px;
	background-color: #B13C2E;

	/* Préparation de notre animation */
	opacity: 0;
	transform: translateY(5px);
	transition: all .4s;
}
/* Le trait va remonter et apparaitre */
.header-nav a:hover:after,
.header-nav a:focus:after {
	opacity: .6;
	transform: translateY(0);
}
/* Je vire outline car juste au-dessus je définis un style :focus */
.header-nav a:focus {
	outline: none;
}

/* Nous allons utiliser uniquement du CSS pour faire notre animation, et si jamais l’animation CSS n’est pas comprise par le navigateur (ce qui devient rare), et bien il n’en aura pas, tout simplement. */
.nav-is-stuck .main-header {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	animation: stickAnim .5s;
}
.nav-is-stuck .header-inner {
    width: 75%;
  	box-shadow: 0px 8px 5px rgba(0, 0, 0, 0.15);
}
 
@keyframes stickAnim {
	0% {
		transform: translateY(-100px);
	}
	100% {
		transform: translateY(0);
	}
}
              
            
!

JS

              
                /*
	RequestAnimationFrame Polyfill

	http://paulirish.com/2011/requestanimationframe-for-smart-animating/
	http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
	by Erik Möller, fixes from Paul Irish and Tino Zijdel

	MIT license
 */ 

(function() {
	var lastTime = 0;
	var vendors = ['ms', 'moz', 'webkit', 'o'];
	for(var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) {
		window.requestAnimationFrame = window[vendors[x]+'RequestAnimationFrame'];
		window.cancelAnimationFrame = window[vendors[x]+'CancelAnimationFrame'] || window[vendors[x]+'CancelRequestAnimationFrame'];
	}

	if ( ! window.requestAnimationFrame ) {
		window.requestAnimationFrame = function(callback, element) {
			var currTime = new Date().getTime();
			var timeToCall = Math.max(0, 16 - (currTime - lastTime));
			var id = window.setTimeout(function() { callback(currTime + timeToCall); }, 
			timeToCall);
			lastTime = currTime + timeToCall;
			return id;
		};
	}

	if ( ! window.cancelAnimationFrame ) {
		window.cancelAnimationFrame = function(id) {
			clearTimeout(id);
		};
	}
}());

/*
	Sticky menu script
 */

(function(w,d,undefined){
 
	var el_html = d.documentElement,
		el_body = d.getElementsByTagName('body')[0],
		header = d.getElementById('header'),
		menuIsStuck = function() {


			var wScrollTop	= w.pageYOffset || el_body.scrollTop,
				regexp		= /(nav\-is\-stuck)/i,
				classFound	= el_html.className.match( regexp ),
				navHeight	= header.offsetHeight,
				bodyRect	= el_body.getBoundingClientRect(),
				scrollValue	= 90;
 
			// si le scroll est d'au moins 90 et
			// la class nav-is-stuck n'existe pas sur HTML
			if ( wScrollTop > scrollValue && !classFound ) {
				el_html.className = el_html.className + ' nav-is-stuck';
				el_body.style.paddingTop = navHeight + 'px';
			}
 
			// si le scroll est inférieur à 2 et
			// la class nav-is-stuck existe
			if ( wScrollTop < 2 && classFound ) {
				el_html.className = el_html.className.replace( regexp, '' );
				el_body.style.paddingTop = '0';
			}

		},
		onScrolling = function() {
			// on exécute notre fonction menuIsStuck()
			// dans la fonction onScrolling()
			menuIsStuck();
			// on pourrait faire plein d'autres choses ici 
		};
 
	// quand on scroll
	w.addEventListener('scroll', function(){
		// on exécute la fonction onScrolling()
		w.requestAnimationFrame( onScrolling );
	});
 
}(window, document));
              
            
!
999px

Console