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 esm.sh, which makes packages from npm not only available on a CDN, but prepares them for native JavaScript ESM 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.
<div id="demo">
<progress class="progress is-primary progress" v-bind:value="step" max="6">15%</progress>
<div class="field is-grouped">
<div class="control">
<button v-if="step>1" v-on:click="step = step - 1;" class="button">
Previous
</button>
</div>
<div class="control">
<button v-if="step<6" v-on:click="step = step + 1;" class="button">
Next
</button>
</div>
</div>
<transition name="slide-fade">
<div v-if="this.step==1">
<div class="card" @touchstart="touchStart">
<div class="card-content">
<div class="content">
<h1>Step 1</h1>
<p>Bacon ipsum dolor amet buffalo jowl filet mignon, meatloaf ribeye chuck fatback porchetta kevin pig andouille. Ribeye short ribs landjaeger, frankfurter drumstick kielbasa pig. Short ribs tenderloin ham shoulder sirloin t-bone jowl ground round fatback drumstick cupim salami corned beef turkey venison. Landjaeger pancetta beef ham hock meatloaf rump cow porchetta chuck ground round tail jerky pork loin sausage. Brisket meatball capicola beef ribs tail t-bone doner biltong burgdoggen pastrami buffalo ham hock.</p>
<p>Shank salami landjaeger kevin venison pork loin chislic sirloin rump chicken filet mignon. Ground round drumstick burgdoggen tongue. Biltong chuck pancetta sausage swine. Rump biltong beef ribs bacon shank ground round ribeye ham.</p>
<p>Strip steak spare ribs pancetta, sausage doner fatback boudin tail cupim shank. Brisket chislic tenderloin pork loin cow ham hock picanha. Ball tip tongue frankfurter corned beef alcatra beef. Pork chop strip steak corned beef sausage burgdoggen buffalo jerky capicola cupim pork belly, sirloin flank. Strip steak corned beef sirloin bresaola pork loin ribeye kevin.</p>
</div>
</div>
</div>
</div>
</transition>
<transition name="slide-fade">
<div v-if="this.step==2">
<div class="card" @touchstart="touchStart">
<div class="card-content">
<div class="content">
<h1>Step 2</h1>
<p>Bacon ipsum dolor amet pig tongue tenderloin filet mignon alcatra boudin salami leberkas capicola chicken shank. Pork swine pork chop ribeye salami t-bone flank leberkas prosciutto bacon chuck landjaeger frankfurter. Shoulder tongue sausage cow tail, fatback tenderloin. Pastrami spare ribs drumstick, shankle chislic sausage burgdoggen frankfurter doner pig turkey sirloin hamburger.</p>
<p>Chislic sirloin turducken pork belly sausage, picanha tail pork short ribs flank bresaola fatback. Jerky pork chop burgdoggen spare ribs kielbasa turkey beef meatball ham chuck filet mignon cow pig pork belly. Buffalo chicken shankle, salami sirloin swine tongue ham. Pork burgdoggen meatball pig alcatra pancetta chislic, shoulder ground round t-bone pork chop pork belly. Andouille ham hock short loin pork loin, picanha tri-tip ball tip meatloaf. Chislic alcatra kielbasa corned beef tongue shankle cupim leberkas pork belly, ball tip turkey flank chuck. Rump salami cupim porchetta sirloin, pancetta ham biltong doner ground round.</p>
</div>
</div>
</div>
</div>
</transition>
<transition name="slide-fade">
<div v-if="this.step==3">
<div class="card" @touchstart="touchStart">
<div class="card-content">
<div class="content">
<h1>Step 3</h1>
<p>Bacon ipsum dolor amet chicken pork cupim porchetta bresaola spare ribs. Tongue pastrami cow capicola picanha corned beef. Bacon filet mignon flank chicken, swine cow frankfurter picanha. Bresaola shank doner rump, cupim picanha bacon porchetta spare ribs jerky sausage pork chop. Cow short loin pork loin spare ribs rump pork belly. Strip steak burgdoggen ball tip pig pork belly rump shank. T-bone pig short ribs swine bresaola spare ribs shankle ham hock turducken.</p>
<p>Capicola filet mignon kielbasa, ball tip pork shoulder spare ribs sirloin. Ribeye shankle beef ribs, corned beef swine short loin pork drumstick bacon chuck buffalo pork loin beef pastrami fatback. Chislic tri-tip hamburger leberkas short loin, drumstick porchetta alcatra. Hamburger brisket cupim frankfurter, buffalo cow corned beef porchetta rump pig short loin burgdoggen pork chop. Pastrami boudin ribeye, cupim porchetta beef ribs ground round.</p>
</div>
</div>
</div>
</div>
</transition>
<transition name="slide-fade">
<div v-if="this.step==4">
<div class="card" @touchstart="touchStart">
<div class="card-content">
<div class="content">
<h1>Step 4</h1>
<p>Bacon ipsum dolor amet shank buffalo ham boudin venison. Cow ground round hamburger salami kevin. Sausage tri-tip shankle ham, pork loin drumstick rump strip steak prosciutto brisket spare ribs landjaeger pork. Pastrami porchetta turkey, kielbasa jerky burgdoggen prosciutto shank t-bone ham hock doner rump bresaola flank ground round. Pork loin jerky swine tri-tip. Strip steak drumstick brisket pork. Corned beef picanha strip steak, shankle sirloin spare ribs biltong pastrami leberkas jerky chicken shank ham.</p>
<p>Salami flank pork tail strip steak, cupim meatball ground round tongue filet mignon pork belly. Burgdoggen biltong ball tip spare ribs, pork loin shankle pastrami landjaeger porchetta. Ribeye ball tip sausage, chislic tenderloin brisket beef ribs jowl chuck turkey flank boudin venison. Turkey leberkas shankle salami burgdoggen buffalo beef ribs ribeye.</p>
</div>
</div>
</div>
</div>
</transition>
<transition name="slide-fade">
<div v-if="this.step==5">
<div class="card" @touchstart="touchStart">
<div class="card-content">
<div class="content">
<h1>Step 5</h1>
<p>Bacon ipsum dolor amet pork belly sirloin frankfurter cow, pancetta chuck leberkas doner chislic. Meatball bresaola cow porchetta short ribs hamburger tenderloin beef ribs shoulder pig picanha shankle. Bacon jowl sausage beef ribs. Ham hock swine tenderloin brisket turkey shank turducken. Meatloaf drumstick short loin filet mignon turducken bacon tri-tip, rump andouille shankle prosciutto strip steak. Jerky tenderloin andouille boudin doner.</p>
</div>
</div>
</div>
</div>
</transition>
<transition name="slide-fade">
<div v-if="this.step==6">
<div class="card" @touchstart="touchStart">
<div class="card-content">
<div class="content">
<h1>Step 6</h1>
<p>Bacon ipsum dolor amet frankfurter beef filet mignon jerky tenderloin tail turducken. Cow turducken fatback spare ribs tenderloin frankfurter, boudin shank pig swine pancetta capicola andouille leberkas. Turkey short ribs chislic, ribeye ground round porchetta pig meatball jerky bresaola sausage. Kevin spare ribs alcatra salami swine beef. Short ribs filet mignon pork chop kielbasa tail porchetta spare ribs beef ribs leberkas.</p>
<p>Salami doner fatback swine, picanha short ribs pork chop corned beef rump porchetta spare ribs tongue sausage biltong. Landjaeger pig alcatra, prosciutto kevin chuck buffalo tail fatback kielbasa cupim corned beef. Pork belly chislic venison alcatra buffalo. Shank ground round beef jerky ham chislic cow kielbasa ribeye capicola chuck. Leberkas drumstick spare ribs fatback, rump pork chuck.</p>
</div>
</div>
</div>
</div>
</transition>
</div>
.card {
width: 400px;
margin: auto;
margin-top:30px;
margin-bottom: 30px;
}
.progress {
width: 400px;
margin: auto;
margin-top:30px;
margin-bottom: 30px;
}
.field {
margin-top:10px;
margin-left:10px;
}
.slide-fade-enter-active {
transition: all .35s ease;
}
.slide-fade-leave-active {
transition: all .3s cubic-bezier(1.0, 0.5, 0.8, 1.0);
}
.slide-fade-enter, .slide-fade-leave-to {
transform: translateX(-1000px);
opacity: 0;
}
new Vue({
el: '#demo',
data: {
step: 1
},
methods: {
touchStart (touchEvent) {
if (touchEvent.changedTouches.length !== 1) { // We only care if one finger is used
return;
}
const posXStart = touchEvent.changedTouches[0].clientX;
addEventListener('touchend', (touchEvent) => this.touchEnd(touchEvent, posXStart), {once: true});
},
touchEnd (touchEvent, posXStart) {
if (touchEvent.changedTouches.length !== 1) { // We only care if one finger is used
return;
}
const posXEnd = touchEvent.changedTouches[0].clientX;
if (posXStart < posXEnd && this.step > 1) {
this.step = this.step - 1;
} else if (posXStart > posXEnd && this.step < 6) {
this.step = this.step + 1;
}
}
}
})
Also see: Tab Triggers