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 URL's 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 it's URL and the proper URL extention.
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.
<h1>step by step CSS slider</h1>
<p><a href="https://codepen.io/gcyrillus/full/vqkgf" target="_blank">test in full page </a></p>
<section class="slidestuff">
<!-- prepare navigation for each contents to reach/slide with or without CSS3 ,
remenber adjacent selector is the only way to style ,
there's no way to wrap those element into a parent -->
<!-- links for obsolete browser ? -->
<a href="#a" title=" Content A " tabindex="-1">Slide A</a>
<a href="#b" title=" Content B " tabindex="-1">Slide B</a>
<a href="#c" title=" Content C " tabindex="-1">Slide C</a>
<a href="#d" title=" Content D " tabindex="-1">Slide D</a>
<!-- empty links to style via CSS3 to provide arrows to click -->
<!-- we see A and might slide to D or B --><span id="g-go-last" class="no-jump"></span>
<a class="g-go-last" title="" href="#g-go-3" tabindex="-1"></a>
<a id="d-go-2" title="" href="#g-go-first" tabindex="-1"></a>
<!-- we see B and might slide to A or C --><span id="g-go-first" class="no-jump"></span>
<a class="g-go-first" title="" href="#g-go-last" tabindex="-1"></a>
<a id="d-go-3" title="" href="#g-go-2" tabindex="-1"></a>
<!-- we see C and might slide to B or D --><span id="g-go-2" class="no-jump"></span>
<a class="g-go-2" title="" href="#g-go-first" tabindex="-1"></a>
<a id="d-go-last" title="" href="#g-go-3" tabindex="-1"></a>
<!-- we see D and and might slide to C or A --><span id="g-go-3" class="no-jump"></span>
<a class="g-go-3" title="" href="#g-go-2" tabindex="-1"></a>
<a id="d-go-first" title="" href="#g-go-last" tabindex="-1"></a>
<!-- now our slider box -->
<section class="slider" >
<div class="fixeOpera"><!--
--><a id="a"></a>
<article class="first">
<aside>
<figure>
<img src="http://lorempixel.com/300/200/nature/5" />
<figcaption>
Cocotiers
</figcaption>
</figure>
</aside>
<section>
<header>
<h1>A noixem cocotum</h1>
</header>
<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.
Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero
sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.</p>
<footer><a href="#" title=" a link to whatever you like">Just a link </a> tempor sit amet, ante.
</footer>
</section>
</article><!--
--><a id="b"></a><article> <aside>
<figure>
<img src="http://lorempixel.com/300/200/nature/6" />
<figcaption>
Pensée
</figcaption>
</figure>
</aside>
<section>
<header>
<h1>B Pansyec blaun</h1>
</header>
<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.
Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero
sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.</p>
<footer><a href="#" title=" a link to whatever you like">Just a link </a> tempor sit amet, ante.
</footer>
</section>
</article><!--
--><a id="c"></a><article> <aside>
<figure>
<img src="http://lorempixel.com/300/200/nature/7" />
<figcaption>
Orchidée
</figcaption>
</figure>
</aside>
<section>
<header>
<h1>C Ochicies déetrisque</h1>
</header>
<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.
Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero
sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.</p>
<footer><a href="#" title=" a link to whatever you like">Just a link </a> tempor sit amet, ante.
</footer>
</section>
</article><!--
--><a id="d"></a><article>
<aside>
<figure>
<img src="http://lorempixel.com/300/200/nature/10" />
<figcaption>
Plouf
</figcaption>
</figure>
</aside>
<section>
<header>
<h1>D plotant ufpor</h1>
</header>
<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.
Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero
sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.</p>
<footer><a href="#" title=" a link to whatever you like">Just a link </a> tempor sit amet, ante.
</footer>
</section>
</article>
</div>
</section>
<span class="spots"></span>
</section>
/* http://dabblet.com/gist/4323453
another full css slider , Gcyrillus */
html {background:purple center;font-size:65%;width:100%;height:100%;
background-image:linear-gradient(0deg,transparent 0%, rgba(255,255,255,0.15) 50%, transparent 100%),
linear-gradient(90deg,transparent 0%, rgba(255,255,255,0.15) 50%, transparent 100%);
}
body {background:yellow;width:50%;min-width:820px;background-image:linear-gradient(0deg,transparent 0%, rgba(255,255,255,0.15) 50%, transparent 100%),
linear-gradient(90deg,transparent 0%, rgba(255,255,255,0.15) 50%, transparent 100%);margin: 50px auto;font-size:1.3em;font-family:georgia;line-height:21px;
box-shadow:0 0 15px white;border-radius:1em;padding:5em 2em;
}
body>section {
width:800px;margin: auto;padding:10px;box-shadow:0 0 15px black;background:white;
text-align:center/* to set spots position below slider */;
}
.slidestuff {
position:relative;padding:5px 10px 0;border-radius:1.2em;
}
/* mise en place slider */
.slider {
white-space:nowrap;overflow:hidden;margin:20px 0;height:250px;width:800px;
border-radius:1em;box-shadow:0 0 5px black;box-sizing:border-box;
}
.fixeOpera {margin:0;padding:0;}/* classname tells itself */
article {
background-color:beige;
background-image:linear-gradient(90deg,transparent 2%, rgba(255,255,255,0.15) 40%, transparent 90%),
linear-gradient(0deg,transparent 2%, rgba(255,255,255,0.15) 40%, transparent 90%);
white-space:normal;display:inline-block;vertical-align:top;
width:800px;height:250px;margin:0;padding:0px;overflow:auto;border-radius:1em;
text-align:left;box-sizing:border-box;box-shadow:inset 0 0 3px #eee , inset 0 0 5px #333 ;
}
img {vertical-align:top;
}
.slider article aside {
float:left;margin:0 1em 0 0;
box-shadow: inset -10px 0 25px -12px gray, 0 0 25px 3px gray ;
}
.slider article h1:first-letter {
font-size:2em;color:turquoise;text-shadow:0 0 1px gray;font-style:italic;border-radius:2em;
display:inline-block;background:#579;padding:0 0.25em;
}
figure {margin:25px 1em;position:relative;overflow:hidden;
}
figcaption {position:absolute;bottom:-41px;transition:2s;background:rgba(50,50,50,0.7);color:#fff;
text-align:center;width:100%;height:40px;line-height:40px;
box-shadow:200px -180px 60px #fff,100px -70px 40px -20px #fff,
100px -50px 40px -20px #fff,60px -30px 40px -10px #fff,50px -10px 40px -10px #fff;
background-image:linear-gradient(90deg,transparent 2%, rgba(255,255,255,0.15) 40%, transparent 90%),
linear-gradient(0deg,transparent 2%, rgba(255,255,255,0.15) 40%, transparent 90%);
}
figure:hover figcaption , a[id*="g-"]:hover ~ .slider figure figcaption {bottom:0;transition:2s;}
article section {padding:0 40px 0 20px;overflow:hidden;
}
.slidestuff > a[title*="C"]:not([class]) {
display:none;transform:scale(0);
}
.slidestuff > a[href^="#"]:focus
{background:rgba(00,150,250,0.9);transition:2s;outline:none;
}
.slidestuff > a[href^="#"]:focus::after { background:inherit;
}
.sliderstuff > a[href^="#"] {line-height:1em;
}
a[href*="go-"] {
text-decoration:none;color:inherit;position:absolute;z-index:2;margin:0;padding:0;height:1.5em;width:1.5em;
line-height:1.5em;border-radius:100%;border:1px solid gray;background-color:#ccc;
background:gray linear-gradient(gray,white);font-family:tahoma;text-shadow:1px 1px 1px #333, 0 0 2px white;
top:140px;box-shadow:0 0 5px #999;}
a[class*="g-"] {left:15px;
}
a[id*="d-"] {right:15px;
}
a[id*="d-"]::before {content:'>';background:inherit;height:100%;width:100%;
border-radius:100%;display:inline-block;z-index:1;left:0;position:absolute;
}
a[class*="g-"]::before {content:'<';
}
.slidestuff > a:hover::after {content:attr(id) attr(class);white-space:nowrap;
display:inline-block;padding-right:0.25em;
}
.slidestuff > a::after {text-indent:-0.75em;overflow:hidden;width:auto;
margin:1em 1em 0 0 ; background-color:pink; background:linear-gradient(pink,white);border-radius:5px ;
box-shadow:0 0 5px ;text-align:left;
}
a[id^="d-"]::after {margin:3em 0 0 -2em;
}
a:focus {outline:none;
}
/* now slide */
/* first we hide the arrows */
a[id*="go"], a[class*="go"] {z-index:-1;}
/* then we show them when needed */
/* default one to show to start with */
a[class*="g-go-last"]:not([id]), a[id*="d-go-2"]:not([class])
{z-index:3;
}
/* show target */
span[id*="g-go"]:target + a:not([id]) ,
span[id*="g-go"]:target + a + a[id*="d-go"]:not([class])
{z-index:4;
}
/* make it move */
.slider article.first,
.slidestuff span[id*="go-last"]:target ~ .slider article.first,
.slidestuff a[href="#a"]:focus ~ .slider article.first
{margin-left:0;transition:2s}
.slidestuff span[id*="go-first"]:target ~ .slider article.first,
.slidestuff > a[href="#b"]:focus ~ .slider article.first
{margin-left:-800px;transition:2s}
.slidestuff span[id="g-go-2"]:target ~ .slider article.first,
.slidestuff > a[href="#c"]:focus ~ .slider article.first
{margin-left:-1600px;transition:2s}
.slidestuff span[id="g-go-3"]:target ~ .slider article.first,
.slidestuff > a[href="#d"]:focus ~ .slider article.first
{margin-left:-2400px;transition:2s;}
/* turn around IES VS others */
.slidestuff .slider a {display:block;}
.slidestuff .slider a:not([alt]) {display:inline;}
.slidestuff .slider > a[id]:not(:link) , .no-jump {position:fixed;height:100%;left:-100%;display:inline-block;/* avoid jumping and buggy sliding */}
/*reset focused links before bluish them */
a[href^="#"]:focus ~ .spots {box-shadow:
-1.9em 0em 1px 4px white, -1.9em 0em 0px 6px #777, -1.9em 0em 2px 8px #ccc,
-0.7em 0em 1px 4px white,-0.7em 0em 0px 6px #777, -0.7em 0em 2px 8px #ccc,
0.45em 0em 1px 4px white, 0.45em 0em 0px 6px #777, 0.45em 0em 2px 8px #ccc,
1.6em 0em 1px 4px white ,1.6em 0em 0px 6px #777, 1.6em 0em 2px 8px #ccc ;
transition:2s:
}
/* first one blue */
.slidestuff > .spots {
box-shadow:
-1.9em 0em 1px 4px turquoise, -1.9em 0em 0px 6px #777, -1.9em 0em 2px 8px #ccc,
-0.7em 0em 1px 4px white,-0.7em 0em 0px 6px #777, -0.7em 0em 2px 8px #ccc,
0.45em 0em 1px 4px white, 0.45em 0em 0px 6px #777, 0.45em 0em 2px 8px #ccc,
1.6em 0em 1px 4px white ,1.6em 0em 0px 6px #777, 1.6em 0em 2px 8px #ccc ;
transition:2s;
display:inline-block;
height:2px;
width:2px;
border-radius:2px;
line-height:0;
vertical-align:top;
margin:2px 40px 1em ;
position:relative;
z-index:1;
background:#777;
}
span[id="g-go-last"]:target ~ .spots {
box-shadow:
-1.9em 0em 1px 4px turquoise, -1.9em 0em 0px 6px #777, -1.9em 0em 2px 8px #ccc,
-0.7em 0em 1px 4px white,-0.7em 0em 0px 6px #777, -0.7em 0em 2px 8px #ccc,
0.45em 0em 1px 4px white, 0.45em 0em 0px 6px #777, 0.45em 0em 2px 8px #ccc,
1.6em 0em 1px 4px white ,1.6em 0em 0px 6px #777, 1.6em 0em 2px 8px #ccc ;
transition:2s;
}
span[id="g-go-first"]:target ~ .spots {
box-shadow:
-1.9em 0em 1px 4px white, -1.9em 0em 0px 6px #777, -1.9em 0em 2px 8px #ccc,
-0.7em 0em 1px 4px turquoise,-0.7em 0em 0px 6px #777, -0.7em 0em 2px 8px #ccc,
0.45em 0em 1px 4px white, 0.45em 0em 0px 6px #777, 0.45em 0em 2px 8px #ccc,
1.6em 0em 1px 4px white ,1.6em 0em 0px 6px #777, 1.6em 0em 2px 8px #ccc ;
transition:2s;
}
span[id="g-go-2"]:target ~ .spots {
box-shadow:
-1.9em 0em 1px 4px white, -1.9em 0em 0px 6px #777, -1.9em 0em 2px 8px #ccc,
-0.7em 0em 1px 4px white,-0.7em 0em 0px 6px #777, -0.7em 0em 2px 8px #ccc,
0.45em 0em 1px 4px turquoise, 0.45em 0em 0px 6px #777, 0.45em 0em 2px 8px #ccc,
1.6em 0em 1px 4px white ,1.6em 0em 0px 6px #777, 1.6em 0em 2px 8px #ccc ;
transition:2s;
}
span[id="g-go-3"]:target ~ .spots {
box-shadow:
-1.9em 0em 1px 4px white, -1.9em 0em 0px 6px #777, -1.9em 0em 2px 8px #ccc,
-0.7em 0em 1px 4px white ,-0.7em 0em 0px 6px #777, -0.7em 0em 2px 8px #ccc,
0.45em 0em 1px 4px white, 0.45em 0em 0px 6px #777, 0.45em 0em 2px 8px #ccc,
1.6em 0em 1px 4px turquoise ,1.6em 0em 0px 6px #777, 1.6em 0em 2px 8px #ccc ;
transition:2s;
}
.slider {z-index:1;position:relative;}
.slidestuff::after , .slidestuff::before {
content:'';
position:absolute;
left:1.5em;
right:1.5em;
height:1px;
transform:rotate(0.95deg);
z-index: 0 ;
bottom:40px;
margin-bottom:0.49em;
box-shadow:0 0 20px 5px black;
}
.slidestuff:before { transform:rotate(-2.5deg);margin-bottom:1.3em;
}
</style>
<!--[if lte IE 8]><script src="https://html5shiv.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
<style>
Also see: Tab Triggers