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.
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Pentanet | Awareness | MRec</title>
<meta name="ad.size" content="width=300,height=250">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="styles.css" media="all">
<!-- Studio Enabler -->
<script src="https://s0.2mdn.net/ads/studio/Enabler.js"></script>
<!-- Additional JS -->
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="https://s0.2mdn.net/ads/studio/cached_libs/tweenmax_2.1.2_min.js"></script>
<script type="text/javascript" src="js/script.js"></script>
<style>
#ad.loading { background: none #262626; }
</style>
</head>
<body>
<!-- List of Classes: svg-sprite img-sprite vertical-align out-of-canvas retina-ready visible -->
<div id="ad" class="loading">
<button id="clickthrough-button" class="button clickthrough"></button>
<!-- <img class="tracking-pixel vertical-align" SRC="" BORDER="0" HEIGHT="1" WIDTH="1" ALT="Advertisement"> -->
<div id="banner">
<div id="scene-01" class="scene-wrapper">
<div id="text-01-01" class="img-sprite retina-ready vertical-align"></div>
<div id="text-02" class="img-sprite visible vertical-align">
<div id="text-02-01" class="img-sprite vertical-align"></div>
<div id="text-02-02" class="img-sprite vertical-align"></div>
<div id="text-02-03" class="img-sprite vertical-align"></div>
</div>
<div id="text-03" class="img-sprite visible vertical-align">
<div id="text-03-01" class="img-sprite vertical-align"></div>
<div id="text-03-02" class="img-sprite vertical-align"></div>
</div>
<div id="text-04" class="img-sprite visible vertical-align">
<div id="text-04-02" class="img-sprite vertical-align"></div>
<div id="text-04-01" class="img-sprite retina-ready vertical-align"></div>
<div id="text-04-03" class="img-sprite vertical-align"></div>
<div id="text-04-04" class="img-sprite vertical-align"></div>
</div>
</div>
</div>
</div>
</body>
</html>
/* Base CSS HTML5 Ad Campaign v01 | Kevin Mario 2016 ( @kevinMario ) */
/* Give credit where credit is due - thanks! ;) */
* {
border: 0;
padding: 0;
margin: 0;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
body, html {
position: relative;
width: 100%;
height: 100%;
overflow: hidden;
background-color: #fff;
}
#ad, #clickthrough-button, .scene-wrapper {
position: absolute;
display: block;
width: 300px;
height: 250px;
top: 0;
left: 0;
right: 0;
bottom: 0;
}
#scene-02 { z-index: 500; }
#scene-03 { z-index: 1000; }
#scene-04 { z-index: 1500; }
#ad {
border: 1px solid #000;
background-color: #262626;
-moz-user-select: -moz-none;
-khtml-user-select: none;
-webkit-user-select: none;
-ms-user-select: none;
user-select: none;
overflow: hidden;
}
.scene-wrapper {
top: -2px;
left: -2px;
}
#banner { opacity: 1; }
#ad.loading {
background: url("images/ajax-loader.gif") center center no-repeat;
}
#ad.loading #banner { opacity: 0; }
#clickthrough-button {
background-color: transparent;
cursor: pointer;
z-index: 999999;
}
#background, #second-background {
width: 300px;
height: 250px;
opacity: 0;
}
#background { background: top left no-repeat; }
.svg-sprite, .img-sprite, .text-element {
position: absolute;
z-index: 100;
opacity: 0;
}
.svg-sprite { background-size: cover; }
.vertical-align {
margin: auto;
top: 0;
left: 0;
right: 0;
bottom: 0;
}
.vertical-align.out-of-canvas {
top: -1000%;
left: -1000%;
right: -1000%;
bottom: -1000%;
}
#video-container {
position: absolute;
width: 260px;
height: 165px;
top: auto;
bottom: 35px;
opacity: 0;
z-index: -1;
}
#video-container video {
width: 100%;
height: 100%;
}
#ad.animation-finished #video-container { z-index: 1000000; }
.retina-ready { background-size: 300px 250px !important; }
.visible { opacity: 1; }
.tracking-pixel {
position: absolute;
display: block;
visibility: visible;
opacity: 1;
z-index: 1000001;
}
/* ================================ */
/* START CREATIVE SPECIFIC ELEMENTS */
#text-01-01 { background-image: url("http://www.lunarist.com/snippets/2019/0910/mrec/text-01-01.png?v=1"); }
#text-02-01 { background-image: url("http://www.lunarist.com/snippets/2019/0910/mrec/text-02-01.png"); }
#text-02-02 { background-image: url("http://www.lunarist.com/snippets/2019/0910/mrec/text-02-02.png"); }
#text-02-03 { background-image: url("http://www.lunarist.com/snippets/2019/0910/mrec/text-02-03.png"); }
#text-03-01 { background-image: url("http://www.lunarist.com/snippets/2019/0910/mrec/text-03-01.png"); }
#text-03-02 { background-image: url("http://www.lunarist.com/snippets/2019/0910/mrec/text-03-02.png"); }
#text-04-01 { background-image: url("http://www.lunarist.com/snippets/2019/0910/mrec/text-04-01.png"); }
#text-04-02 { background-image: url("http://www.lunarist.com/snippets/2019/0910/mrec/text-04-02.png"); }
#text-04-03 { background-image: url("http://www.lunarist.com/snippets/2019/0910/mrec/text-04-03.png"); }
#text-04-04 { background-image: url("http://www.lunarist.com/snippets/2019/0910/mrec/text-04-04.png"); }
// DoubleClick Specs HTML5 Ad Campaign v02 | Kevin Mario 2016 ( @kevinMario )
// v01: Initial Template
// v02: Updated with DCRM JS Template
// Give credit where credit is due - thanks! ;)
var container;
var content;
var bgExit;
var tl;
//Function confirm if the creative is visible
enablerInitHandler = function(e) {
/*if(Enabler.isVisible()) {
startAd();
} else {
Enabler.addEventListener(studio.events.StudioEvent.VISIBLE, startAd);
} */
// Polite Loading as per Spec
if (Enabler.isPageLoaded()) {
startAd();
} else {
Enabler.addEventListener(studio.events.StudioEvent.PAGE_LOADED, startAd);
}
};
//Start the creative
startAd = function(e) {
//Assign All the elements to the element on the page
container = document.getElementById('ad');
//content = document.getElementById('content_dc');
bgExit = document.getElementById('clickthrough-button');
//Add listeners
addListeners();
container.style.display = "block";
container.className = "";
console.log("Ad Initialized");
// var video1 = document.getElementById('video1');
//$("#video1").prop("muted", true);
// Enabler.loadModule(studio.module.ModuleId.VIDEO, function() {
// studio.video.Reporter.attach('video_1', video1);
// });
startAnimation();
};
//Add Event Listeners
addListeners = function(e) {
bgExit.addEventListener('touchEnd', bgExitHandler, false);
bgExit.addEventListener('click', bgExitHandler, false);
};
//Add exits
bgExitHandler = function(e) {
Enabler.exit('HTML5_Background_Clickthrough');
};
//Wait for the content to load to call the start od the ad
window.onload = function(){
if (Enabler.isInitialized()) {
enablerInitHandler();
} else {
Enabler.addEventListener(studio.events.StudioEvent.INIT, enablerInitHandler);
}
};
// ANIMATION TIMELINE
function startAnimation() {
console.log("Animation Start");
tl = new TimelineLite();
function pauseLine() {
tl.pause();
}
function playLine() {
tl.play();
}
TweenLite.defaultOverwrite = false;
tl
.fromTo("#text-01-01", .35,
{alpha: 0, scale: .125, ease: Sine.easeOut},
{alpha: 1, scale: .95, ease: Sine.easeOut},
"0")
/*.to("#text-01-01", 2, {scale: 1.125, ease: Sine.easeOut}, "-=0.015")
.to("#text-01-01", .125, {scale: 2, ease: Sine.easeOut}, "-=0.015")
.to("#text-01-01", .075, {alpha: 0, ease: Sine.easeOut}, "-=.125")*/
.to("#text-01-01", 2, {scale: 1.125, ease: Sine.easeOut}, ".335")
.to("#text-01-01", .125, {scale: 2, ease: Sine.easeOut}, "2.125")
.to("#text-01-01", .075, {alpha: 0, ease: Sine.easeOut}, "2.125")
.fromTo("#text-02-01", .25,
{alpha: 0, x: -150, ease: Sine.easeOut},
{alpha: 1, x: 0, ease: Sine.easeOut},
"-=.075")
.fromTo("#text-02-02", .25,
{alpha: 0, x: -150, ease: Sine.easeOut},
{alpha: 1, x: 0, ease: Sine.easeOut},
"+=.075")
.fromTo("#text-02-03", .25,
{alpha: 0, x: -150, ease: Sine.easeOut},
{alpha: 1, x: 0, ease: Sine.easeOut},
"+=.075")
.to("#text-02", .25, { alpha:0, ease: Sine.easeOut}, "+=1.5")
.fromTo("#text-03-01", .25,
{alpha: 0, x: -150, ease: Sine.easeOut},
{alpha: 1, x: 0, ease: Sine.easeOut},
"-=.25")
.fromTo("#text-03-02", .25,
{alpha: 0, x: -150, ease: Sine.easeOut},
{alpha: 1, x: 0, ease: Sine.easeOut},
"+=.075")
.to("#text-03", .25, { alpha:0, ease: Sine.easeOut}, "+=1.5")
.fromTo("#text-04-02", 1.25,
{alpha: 0, y: 10, ease: Sine.easeOut},
{alpha: 1, y: 0, ease: Sine.easeOut},
"-=.25")
.fromTo("#text-04-01", .75,
{alpha: 0, y: -5, ease: Sine.easeOut},
{alpha: 1, y: 0, ease: Sine.easeOut},
"-=1.15")
.fromTo("#text-04-03", .75,
{alpha: 0, y: 5, ease: Sine.easeOut},
{alpha: 1, y: 0, ease: Sine.easeOut},
"-=.75")
.fromTo("#text-04-04", .75,
{alpha: 0, scale: 1.75, y: -80, ease: Bounce.easeOut},
{alpha: 1, scale: 1, y: 0, ease: Bounce.easeOut},
"-=.25")
.to("#text-01-01", .05, {alpha: 0, scale: .125, ease: Sine.easeOut }, "+=4")
.to("#text-04", .125, { alpha: 0, scale: 2, ease: Sine.easeOut,
onComplete: function() {
$("#text-01-01").removeAttr("style")
tl.restart();
}
}, "-=.05")
/*
.fromTo("element", 0,
{alpha: 0, ease: Sine.easeOut},
{alpha: 1, ease: Sine.easeOut},
"0")
.to("element", .25, {alpha:0, x: 250, ease: Sine.easeOut}, "+=3")
.staggerFromTo("element", .75,
{alpha: 0, y: -200, transformOrigin:'850px 55px', ease:Bounce.easeOut},
{alpha: 1, y: 0, transformOrigin:'850px 55px', ease:Bounce.easeOut},
.15, "-=.5")
.fromTo("#video-container", .75,
{alpha: 0, scale:1.05, ease: Sine.easeOut},
{alpha: 1, scale: 1, ease: Sine.easeOut,
onComplete: function() {
$("#ad").addClass("animation-finished");
$("#video1").get(0).play();
}},
"+=.5")
*/
//.tl.call(pauseLine)
;
// Test Animation
//tl.seek(5);
}
Also see: Tab Triggers