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. 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.
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.
If the stylesheet 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 CSS 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.
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.
<b id="click" style='display:block;background:rgb(80,80,80);text-align:center;color:white;padding: 1em 0 1em;cursor:pointer;'>DISCLAIMER (click to view)</b><b id='caring' style='display:none;padding: 10px;border-top: 15px solid #f1bc1a'><u>This piece of CSS magic is free for everyone.</u><br />Use it, steal it, claim it your own. I don't care. <span style="font-size:24px">Actually,</span> I care if it was helpful and you managed to create something new and amazing. If you like this experiment, I would love to hear from you via <a href="https://twitter.com/intent/user?screen_name=christian_fei">Twitter</a> to see how you implemented this in your project :) <br /><br /> <br /> <br /> Credit where credit is due: <br /> I wanted to create my own timeline after seeing Paul Stamatious' one over at <a href="http://paulstamatiou.com/posts"> his website</a></b>
<!-- THE CODE | THE CODE | THE CODE | THE CODE | THE CODE -->
<!-- Each event is wrapper inside an anchor with the class 'event' -->
<!-- The i-tag inside the anchor creates the little arrow beside an event (see v1.0) -->
<!-- FORK AWAY AND PLEASE LET ME KNOW IF YOU HAVE SUGGESTIONS AND FEEDBACK :) -->
<a class='ad' href="http://christian-fei.com/tutorials/simple-vertical-timeline-with-css/">Check out this article for more information (open it in a new tab)</a>
<br />
<br />
<span class="padd center">Do I need to tell you to resize your browser window?<br/>*cough* responsive *cough*</span>
<h1 class='padd'>v2.0</h1>
<ul class='timeline'>
<li class="year first">2013</li>
<li class='event offset-first'>
Something amazing happened today, but it's a secret
</li>
<li class='event' href="#">
Timeline.css is <b>dynamic</b>, <b>responsive</b> and optimized to <b>demonstrate events</b> in your life in a <b>simple and clear</b> way
</li>
<li class="event">
<a href="http://christian-fei.com" title="christian fei">
made with <3 by <img src="https://s3-eu-west-1.amazonaws.com/cf.img/var/face.svg" alt="christian fei"/>
</a>
</li>
<li class="event">
<a href="https://codepen.io/christian-fei/pen/BJily">
Open source project on codepen.io
<img src="http://davidwalsh.name/demo/codepenLogo.png" alt=""/>
</a>
</li>
<li class='event'>
Look, a sleepy kitten: <br/>
<img src="http://ih2.redbubble.net/image.10311838.0354/flat,550x550,075,f.jpg"/>
<a href='http://ih2.redbubble.net/image.10311838.0354/flat,550x550,075,f.jpg'>©</a>
</li>
<li class="year">2012</li>
<li class="event offset-first">
<p>To infinity ... </p>
<img class='centered' src="http://upload.wikimedia.org/wikipedia/en/7/75/Buzz-lightyear-toy-story-3-wallpaper.jpg" alt=""/>
<a href='http://upload.wikimedia.org/wikipedia/en/7/75/Buzz-lightyear-toy-story-3-wallpaper.jpg'>©</a>
</li>
<li class="event">
<p>... and beyond!</p>
<img class='centered' src="https://brandstyle.com.br/wp-content/uploads/2012/05/Woody-7.jpg" alt=""/>
<a href='https://brandstyle.com.br/wp-content/uploads/2012/05/Woody-7.jpg'>©</a>
</li>
</ul>
@import "compass/css3";
/* v2.0 */
/* v2.0 */
/* v2.0 */
/* v2.0 */
/* v2.0 */
$text-color: rgb(77, 77, 77);
$bg-entry: rgb(80,80,80);
*,*:after,*:before{-webkit-box-sizing: border-box;-moz-box-sizing: border-box;box-sizing: border-box;}
.timeline {
margin: 0px auto;
max-width: 40em;
overflow:hidden;
height: auto;
position: relative;
padding:0px;
list-style-type:none;
/*thanks to
https://twitter.com/JacoKoster
*/
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAEElEQVQIW2NMTEz8z8gABAAPKwIlXWq1kgAAAABJRU5ErkJggg==);
background-repeat:repeat-y;
background-position:50% 0;
.year {
background: $bg-entry;
font-size: 3em;
max-width: 4em;
clear: both;
margin: 1em auto 2em;
color: white;
border-radius: 30% / 100%;
text-align: center;
margin-top: 2em;
&:first-of-type {
margin-top: 0 !important;
}
}
/*
elements 1,(2),3,(4), etc.
elements in brackets inherit these properties, some are overridden below (2n)
beginning at 0
*/
.event {
position:relative;
text-align:center;
float: right;
clear: right;
width: 45%;
margin: 1em 2.5%;
border-radius: 5px;
list-style-type: none;
display: block;
padding: .4em;
background: white;
z-index: 15;
color: $text-color;
border: 1px solid lighten($bg-entry,30%);
text-decoration: none;
-webkit-transition: background .15s linear;
-moz-transition: background .15s linear;
-ms-transition: background .15s linear;
-o-transition: background .15s linear;
transition: background .15s linear;
&.featured {
width: 95% !important;
background: lighten(#ccc,11%);
&:after, &:before {
display: none;
}
}
@media all and (max-width: 600px) {
width: 85%;
}
&.offset-first {
margin-top: -1.5em!important;
}
img {
margin-top: 10px;
max-width: 100%;
}
&:hover {
background: lighten($bg-entry,60%);
&:after {
background: $bg-entry;
}
}
&:nth-of-type(2n) {
float: left;
clear: left;
@media all and(min-width:600px){
margin-top:2em;
}
}
&:after {
@media all and (min-width: 650px) {
display: block;
content: ' ';
height: 9px; width: 9px;
background: lighten($bg-entry,30%);
border-radius: 50%;
position:absolute;
left: -5%;
top: 1.5em;
border: 2px solid white;
}
}
&:nth-child(2n):after {
right: -5%;
/* reset the standard declaration I defined before*/
left: auto;
}
}
}
.padd {
display:block;padding: 10px;
&.center {
text-align:center;
}
}
.ad {
display: block;
background: rgba(50,50,50,0.5);
color: white;
text-decoration: none;
text-align:center;
padding: 15px;
font-weight: 800;
border-bottom: 2px solid black;
border-top: 2px solid black;
}
a{
text-decoration:none;
color:black;
}
/* JUST SOME DISCLAIMER STUFF
REMEMBER: NO JS USED */
var caring = document.querySelector('#caring'),
click = document.querySelector('#click'),
vis=false;
click.onclick = function() {
if(!vis)
caring.style.display = 'block';
else
caring.style.display = 'none';
vis = !vis;
}
Also see: Tab Triggers