HTML preprocessors can make writing HTML more powerful or convenient. For instance, Markdown is designed to be easier to write and read for text documents and you could write a loop in Pug.
In CodePen, whatever you write in the HTML editor is what goes within the <body>
tags in a basic HTML5 template. So you don't have access to higher-up elements like the <html>
tag. If you want to add classes there that can affect the whole document, this is the place to do it.
In CodePen, whatever you write in the HTML editor is what goes within the <body>
tags in a basic HTML5 template. If you need things in the <head>
of the document, put that code here.
The resource you are linking to is using the 'http' protocol, which may not work when the browser is using https.
CSS preprocessors help make authoring CSS easier. All of them offer things like variables and mixins to provide convenient abstractions.
It's a common practice to apply CSS to a page that styles elements such that they are consistent across all browsers. We offer two of the most popular choices: normalize.css and a reset. Or, choose Neither and nothing will be applied.
To get the best cross-browser support, it is a common practice to apply vendor prefixes to CSS properties and values that require them to work. For instance -webkit-
or -moz-
.
We offer two popular choices: Autoprefixer (which processes your CSS server-side) and -prefix-free (which applies prefixes via a script, client-side).
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.
You can apply CSS to your Pen from any stylesheet on the web. Just put a URL to it here and we'll apply it, in the order you have them, before the CSS in the Pen itself.
You can also link to another Pen here (use the .css
URL Extension) and we'll pull the CSS from that Pen and include it. If it's using a matching preprocessor, use the appropriate URL Extension and we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
JavaScript preprocessors can help make authoring JavaScript easier and more convenient.
Babel includes JSX processing.
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.
You can apply a script from anywhere on the web to your Pen. Just put a URL to it here and we'll add it, in the order you have them, before the JavaScript in the Pen itself.
If the script you link to has the file extension of a preprocessor, we'll attempt to process it before applying.
You can also link to another Pen here, and we'll pull the JavaScript from that Pen and include it. If it's using a matching preprocessor, we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
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.
Using packages here is powered by Skypack, which makes packages from npm not only available on a CDN, but prepares them for native JavaScript ES6 import
usage.
All packages are different, so refer to their docs for how they work.
If you're using React / ReactDOM, make sure to turn on Babel for the JSX processing.
If active, Pens will autosave every 30 seconds after being saved once.
If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.
If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.
Visit your global Editor Settings.
<script type="application/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script type="application/javascript" src="URL/jquery.stickyZone.min.js"></script>
<header id="header">
<h2>Lorem Ipsum</h2>
<h4>"Neque porro quisquam est qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit..."</h4>
</header>
<hr>
<div id="content">
<div id="bloc-sticky">
<p>Ceci est un bloc que l'on souhaite figer également, en plus de l'entête.</p>
</div>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque diam dui, vehicula ut blandit non, varius et ex. Suspendisse sodales dolor leo, quis vehicula dui euismod ac. Nulla mi orci, sagittis semper ligula quis, gravida porttitor arcu. Duis arcu dui, tincidunt ac dui id, placerat euismod metus. Etiam eleifend gravida justo, et rutrum velit vehicula sed. Pellentesque eget facilisis lorem. Pellentesque quis tristique nisl, sed condimentum dui. Mauris placerat nisi mi, a tempor nibh rhoncus sit amet. Etiam vulputate tellus porta eros varius tempor. Suspendisse turpis nisl, condimentum vel mattis eu, mollis in tortor. Praesent pellentesque enim a lacus lacinia condimentum. Ut orci lectus, imperdiet id pharetra id, fringilla ut nulla. Duis elementum sapien quis ipsum fringilla, at mattis nibh consectetur. Phasellus non est lacus.</p>
<p>Duis sagittis turpis eget sagittis vehicula. Fusce imperdiet lobortis nisi at dictum. Pellentesque vel faucibus mi. Integer finibus posuere quam sit amet porta. Duis maximus metus id ornare bibendum. Praesent varius leo eget varius laoreet. Etiam venenatis nisl nunc. Suspendisse elementum nunc vitae urna faucibus auctor. Quisque tincidunt pellentesque erat ac faucibus. Curabitur vel sollicitudin ligula. Nulla pharetra blandit molestie. In at quam libero. In at lectus varius, imperdiet dui hendrerit, eleifend lectus. Mauris ac justo sed tortor feugiat euismod. Vestibulum id molestie dolor.</p>
<p>Sed ullamcorper, lacus non molestie blandit, justo lectus vestibulum metus, sit amet rhoncus orci quam at sem. Sed sit amet sodales arcu, ut congue nulla. Pellentesque mattis ac arcu ut venenatis. Nam euismod massa eu odio elementum vestibulum. Nam feugiat magna quis mollis porttitor. Praesent ut sem a arcu volutpat lacinia in et est. Vivamus mattis elit felis, tempus ornare sapien vulputate nec. Nullam ut ligula et purus aliquam sodales in in mi. Etiam id luctus felis. Donec eget tempor sem. Etiam vel elit libero.</p>
<p>Donec pretium erat magna, lobortis dapibus justo molestie sed. Proin eu ipsum varius, varius nibh eu, molestie justo. Aliquam rhoncus facilisis magna sed iaculis. Proin vel facilisis eros, et bibendum tortor. Sed tincidunt nisl quis sapien suscipit, nec tristique neque porta. Fusce non lectus tincidunt nibh fermentum bibendum. Mauris feugiat semper felis eget euismod. Pellentesque tempus ultrices nisi, a volutpat metus iaculis id. Praesent augue quam, maximus eget pretium sed, eleifend at nulla. Sed lobortis nulla nisl, consequat gravida elit tempus eu. Quisque non urna vel mauris cursus pellentesque. Pellentesque at vulputate dolor.</p>
<p>Suspendisse ac pharetra libero. Etiam orci nisl, scelerisque id est quis, scelerisque luctus sapien. Quisque elementum nunc in efficitur blandit. Quisque nibh velit, tempus a dui eget, tristique sagittis sapien. Morbi finibus velit at pulvinar viverra. Praesent mollis luctus lectus, ut eleifend magna imperdiet lobortis. Etiam elementum ex magna, sit amet tincidunt felis hendrerit sed. Mauris ac tempus libero. Duis porttitor egestas porttitor. Etiam a orci in metus auctor egestas sit amet quis quam. Nulla ac arcu in orci tempus ultrices. Mauris nec ultricies elit.</p>
</div>
<footer id="footer">
<p>Creation : <a href="http://www.testeur.ml" target="_blank">Mathieu Chartier</a></p>
<p>© <a href="https://www.internet-formation.fr" target="_blank">Internet-Formation</a></p>
</footer>
/* Style : general */
* {margin:0; padding:0}
body{font-family:arial, helvetica;}
#header {padding:3em 0; transition:.5s; text-align:center}
h2 {font-size:2em; margin-bottom:1em;}
h4 {font-size:1.2em;}
hr {margin-bottom:3em}
#content {padding:0 2em; font-size:1.2em;}
#footer {background:#222; margin-top:3em; padding:2em; color:#eee; text-align:center; line-height:2em}
#footer a {color:#999; text-decoration:none}
/* Style : bloc Sticky */
#bloc-sticky {float:right; padding:.8em; background:#16f5e9; margin:1em 0 .8em .8em;}
/* Style : mode Sticky */
#header.is-sticky {background:#242424; color:#eee; padding:1em 0 .5em; transition:.5s}
#header.is-sticky h2 {font-size:1.6em; transition:.2s}
#header.is-sticky h4 {font-size:1em; transition:.2s}
jQuery(document).ready(function($) {
// Entête Sticky
$('#header').stickyZone();
// Bloc Sticky dans le contenu
var options2 = {
stickyTrigger : 0, // Active le déclenchement de l'effet Sticky dès le début du défilement
stickyPrevBlock : true, // Récupérer l'espace entre l'élément sticky bleu et le précédent bloc sticky
stickyLeftAuto : true, // Récupérer la position gauche du bloc Sticky bleu
stickyActiveCSS : {
"position":"fixed", // Position "fixed" pour le mode Sticky. Ne pas modifier !
"z-index":9999, // Recommandé de fixer un fort z-index pour passer au-dessus des contenus
// "top":"160px" // Adaptation de la position Top pour que le rendu soit joli (optionnel)
},
};
$('#bloc-sticky').stickyZone(options2);
});
Also see: Tab Triggers