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.
<div id="container" class="holder red">
<div id="view-one" class="view active">
<h1>Title</h1>
<img src="http://hfchristiansen.com/wp-content/uploads/2014/05/Johnny-Loco-2-400x200.jpg" alt="" />
<p>Chirp at birds. Pooping rainbow while flying in a toasted bread costume in space claws in your leg but sleep on dog bed, force dog to sleep on floor or chew iPad power cord, and roll on the floor purring your whiskers off run in circles. Hate dog get video posted to internet for chasing red dot but spread kitty litter all over house. Where is my slave? I'm getting hungry hide head under blanket so no one can see. Under the bed meow for food, then when human fills food dish, take a few bites of food and continue meowing so pooping rainbow while flying in a toasted bread costume in space or pee in human's bed until he cleans the litter box missing until dinner time. Has closed eyes but still sees you toy mouse squeak roll over drink water out of the faucet.</p>
</div>
<div id="view-two" class="view">
<img src="http://orig08.deviantart.net/0fb2/f/2011/004/5/2/joker_signature_by_applay-d36ehw1.jpg" alt="" />
<h1>the joker</h1>
<hr />
<p>Rub face on everything climb leg, yet i am the best paw at your fat belly. Sleep on keyboard run outside as soon as door open, but lay on arms while you're using the keyboard toy mouse squeak roll over for eat a plant, kill a hand sleep on keyboard. Spot something, big eyes, big eyes, crouch, shake butt, prepare to pounce. Kitty power! poop in the plant pot for stare at wall turn and meow stare at wall some more meow again continue staring . See owner, run in terror attack the dog then pretend like nothing happened. </p>
</div>
<div id="view-three" class="view">
<h1>deadpool</h1>
<h2>Merc with the mouth</h2>
<p>Meet all of Spideys deadly enemies, from the Green Goblin and Doctor Octopus to Venom and Carnage, plus see Peter Parker fall in love, face tragedy and triumph, and learn that with great power comes great responsibility. Realizing that rules were needed to prevent people from behaving badly, young Matt decided to study law however, when he saved a man from an oncoming truck, it spilled a radioactive cargo that rendered Matt blind while enhancing his remaining senses. Join Spider-Man and some of his Amazing friends as they tackle threats that only a mighty Marvel team-up can handle. Plus: Jessica travels to upstate New York to investigate the disappearance of a teenage girl rumored to be a mutant in a prejudiced small town, goes on a date with the Astonishing Ant-Man, teams up with Jessica Drew, the original Spider-Woman and confronts the demons of her past.</p>
<img src="https://2.bp.blogspot.com/-s-SfyfQsVe0/VsQIFfDKwLI/AAAAAAAAL90/dzEUhgltyE4/s400/Wolverine-vs-Deadpool-Video-Game-Concept-Art.jpg" alt="" />
</div>
<div class="btnHolder">
<div id="one" class="nav"></div>
<div id="two" class="nav"></div>
<div id="three" class="nav"></div>
</div>
</div>
body, html{
margin:0;
padding:0;
}
.holder{
position:relative;
width:100%;
height:100vh;
}
.red{
background: rgba(222,126,109,1);
background: -moz-radial-gradient(center, ellipse cover, rgba(222,126,109,1) 0%, rgba(237,54,33,1) 86%, rgba(184,21,6,1) 100%);
background: -webkit-gradient(radial, center center, 0px, center center, 100%, color-stop(0%, rgba(222,126,109,1)), color-stop(86%, rgba(237,54,33,1)), color-stop(100%, rgba(184,21,6,1)));
background: -webkit-radial-gradient(center, ellipse cover, rgba(222,126,109,1) 0%, rgba(237,54,33,1) 86%, rgba(184,21,6,1) 100%);
background: -o-radial-gradient(center, ellipse cover, rgba(222,126,109,1) 0%, rgba(237,54,33,1) 86%, rgba(184,21,6,1) 100%);
background: -ms-radial-gradient(center, ellipse cover, rgba(222,126,109,1) 0%, rgba(237,54,33,1) 86%, rgba(184,21,6,1) 100%);
background: radial-gradient(ellipse at center, rgba(222,126,109,1) 0%, rgba(237,54,33,1) 86%, rgba(184,21,6,1) 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#de7e6d', endColorstr='#b81506', GradientType=1 );
}
.blue{
background: rgba(139,156,227,1);
background: -moz-radial-gradient(center, ellipse cover, rgba(139,156,227,1) 0%, rgba(44,98,191,1) 85%, rgba(12,66,148,1) 100%);
background: -webkit-gradient(radial, center center, 0px, center center, 100%, color-stop(0%, rgba(139,156,227,1)), color-stop(85%, rgba(44,98,191,1)), color-stop(100%, rgba(12,66,148,1)));
background: -webkit-radial-gradient(center, ellipse cover, rgba(139,156,227,1) 0%, rgba(44,98,191,1) 85%, rgba(12,66,148,1) 100%);
background: -o-radial-gradient(center, ellipse cover, rgba(139,156,227,1) 0%, rgba(44,98,191,1) 85%, rgba(12,66,148,1) 100%);
background: -ms-radial-gradient(center, ellipse cover, rgba(139,156,227,1) 0%, rgba(44,98,191,1) 85%, rgba(12,66,148,1) 100%);
background: radial-gradient(ellipse at center, rgba(139,156,227,1) 0%, rgba(44,98,191,1) 85%, rgba(12,66,148,1) 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#8b9ce3', endColorstr='#0c4294', GradientType=1 );
}
.green{
background: rgba(141,227,171,1);
background: -moz-radial-gradient(center, ellipse cover, rgba(141,227,171,1) 0%, rgba(45,189,91,1) 85%, rgba(13,148,29,1) 100%);
background: -webkit-gradient(radial, center center, 0px, center center, 100%, color-stop(0%, rgba(141,227,171,1)), color-stop(85%, rgba(45,189,91,1)), color-stop(100%, rgba(13,148,29,1)));
background: -webkit-radial-gradient(center, ellipse cover, rgba(141,227,171,1) 0%, rgba(45,189,91,1) 85%, rgba(13,148,29,1) 100%);
background: -o-radial-gradient(center, ellipse cover, rgba(141,227,171,1) 0%, rgba(45,189,91,1) 85%, rgba(13,148,29,1) 100%);
background: -ms-radial-gradient(center, ellipse cover, rgba(141,227,171,1) 0%, rgba(45,189,91,1) 85%, rgba(13,148,29,1) 100%);
background: radial-gradient(ellipse at center, rgba(141,227,171,1) 0%, rgba(45,189,91,1) 85%, rgba(13,148,29,1) 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#8de3ab', endColorstr='#0d941d', GradientType=1 );
}
.nav{
position:relative;
z-index:10;
top:90%;
width:40px;
height:40px;
background-color:black;
border-radius:50%;
display:inline-block;
margin-right:10px;
cursor: pointer;
}
.view{
position:absolute;
width:40%;
right: 80px;
}
var views={
'one':{
id:'one',
bg:'red'
},
'two':{
id:'two',
bg:'blue'
},
'three':{
id:'three',
bg:'green'
}
};
var $holder = $('.holder'),
$container = $('#container'),
$viewOne = $('#view-one'),
$viewTwo = $('#view-two'),
$viewThree = $('#view-three'),
$one = $("#one"),
$two = $('#two'),
$three = $('#three'),
$view = $('.view'),
$active = $('.active'),
fx = TweenMax,
tl = new TimelineMax();
time=500;
function change(style){
$container.attr('class', 'holder ' + views[style].bg);
}
function goToTile(sildeIn, slideOut){
tl
tl
.set(slideIn, {x:'200%', autoAlpha:1, className:'+=active'})
.set(slideOut, {className: '-=active'})
.to(slideOut, 0.5, {x:'200%', ease:Power3.easeInOut}, 0)
.to(slideIn, 0.75, {x:'-=200%', ease:Power3.easeInOut}, 0);
}
$('.btnHolder .nav').click(function(){
change($(this).attr('id'))
var slideOut = $('.view.active'),
index = $(this).index();
slideIn = slideOut.parent().children('.view').eq(index);
goToTile(slideIn, slideOut);
});
function init(){
fx.set($view.not($active),{autoAlpha:0});
}
init();
Also see: Tab Triggers