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 class="characters">
<div id="character_1" class="character">
<img src="https://fullbellylaughs.com/uploads/landingpageimages/Alfred.png" alt="">
<h1 class="name">Alfred</h1>
<p class="description">This dude just woke up after pounding pre-prohibition cocktails.</p>
</div>
<div id="character_2" class="character">
<img src="https://fullbellylaughs.com/uploads/landingpageimages/Anita.png" alt="">
<h1 class="name">Anita</h1>
<p class="description">This Golden Girl looks ready to do an experiment by the Kinsey Institute.</p>
</div>
<div id="character_3" class="character">
<img src="https://fullbellylaughs.com/uploads/landingpageimages/Anne.png" alt="">
<h1 class="name">Anne</h1>
<p class="description">Nobody clips coupons better than this sassy mama.</p>
</div>
<div id="character_4" class="character character_visible">
<img src="https://fullbellylaughs.com/uploads/landingpageimages/Bernard.png" alt="">
<h1 class="name">Bernard</h1>
<p class="description">No one can rival his joy in finding someone his age at the porn theater.</p>
</div>
<div id="character_5" class="character">
<img src="https://fullbellylaughs.com/uploads/landingpageimages/Bill.png" alt="">
<h1 class="name">Bill</h1>
<p class="description">He’s got a profile pic of himself as a court jester at a local Renaissance fair.</p>
</div>
<div id="character_6" class="character">
<img src="https://fullbellylaughs.com/uploads/landingpageimages/Charles.png" alt="">
<h1 class="name">Charles</h1>
<p class="description">Just discovered the shower wall mount attachment for the Fleshlight.</p>
</div>
<div id="character_7" class="character character_visible">
<img src="https://fullbellylaughs.com/uploads/landingpageimages/Claire.png" alt="">
<h1 class="name">Claire</h1>
<p class="description">Her collection of hand-knitted sweaters are only rivaled by her cats.</p>
</div>
<div id="character_8" class="character">
<img src="https://fullbellylaughs.com/uploads/landingpageimages/David.png" alt="">
<h1 class="name">David</h1>
<p class="description">He uses his music composition degree to make sick Cock Hero videos.</p>
</div>
<div id="character_9" class="character">
<img src="https://fullbellylaughs.com/uploads/landingpageimages/Eric.png" alt="">
<h1 class="name">Eric</h1>
<p class="description">His 15 minutes so fame came from cutting Styrofoam cups with his face.</p>
</div>
<div id="character_10" class="character">
<img src="https://fullbellylaughs.com/uploads/landingpageimages/Frans.png" alt="">
<h1 class="name">Frans</h1>
<p class="description">A nice guy but unable to look you in the eye when shaking your hand.</p>
</div>
<div id="character_11" class="character">
<img src="https://fullbellylaughs.com/uploads/landingpageimages/George.png" alt="">
<h1 class="name">George</h1>
<p class="description">This Caddyshack villian just finished a cool 18 holes at the country club.</p>
</div>
<div id="character_12" class="character">
<img src="https://fullbellylaughs.com/uploads/landingpageimages/Herman.png" alt="">
<h1 class="name">Herman</h1>
<p class="description">He love alphabetizing deck registration sheets as much as he loves foils.</p>
</div>
<div id="character_13" class="character">
<img src="https://fullbellylaughs.com/uploads/landingpageimages/Joe.png" alt="">
<h1 class="name">Joe</h1>
<p class="description">Every year he reprises his role as Flattop in a local production of Dick Tracy.</p>
</div>
<div id="character_14" class="character character_visible">
<img src="https://fullbellylaughs.com/uploads/landingpageimages/Maria.png" alt="">
<h1 class="name">Maria</h1>
<p class="description">She corrects your grammar while wishing she was actually French.</p>
</div>
<div id="character_15" class="character">
<img src="https://fullbellylaughs.com/uploads/landingpageimages/Max.png" alt="">
<h1 class="name">Max</h1>
<p class="description">He’s short order cook, but on the weekend gives people cement shoes.</p>
</div>
<div id="character_16" class="character">
<img src="https://fullbellylaughs.com/uploads/landingpageimages/Paul.png" alt="">
<h1 class="name">Paul</h1>
<p class="description">If the Holiday Yule Log could be a person, it would be this pop-pop.</p>
</div>
<div id="character_17" class="character">
<img src="https://fullbellylaughs.com/uploads/landingpageimages/Peter.png" alt="">
<h1 class="name">Peter</h1>
<p class="description">The movie Shampoo with Warren Beatty was based on this guy’s life.</p>
</div>
<div id="character_18" class="character">
<img src="https://fullbellylaughs.com/uploads/landingpageimages/Phillip.png" alt="">
<h1 class="name">Philip</h1>
<p class="description">As a civil war reenactor, he takes on the prestigious role of Abe Lincoln.</p>
</div>
<div id="character_19" class="character">
<img src="https://fullbellylaughs.com/uploads/landingpageimages/Richard.png" alt="">
<h1 class="name">Richard</h1>
<p class="description">His knowledge is impressive, but the fact that he works at the cafe is sad.</p>
</div>
<div id="character_20" class="character">
<img src="https://fullbellylaughs.com/uploads/landingpageimages/Robert.png" alt="">
<h1 class="name">Robert</h1>
<p class="description">He just got done dropping his daughters off at soccer practice.</p>
</div>
<div id="character_21" class="character">
<img src="https://fullbellylaughs.com/uploads/landingpageimages/Sam.png" alt="">
<h1 class="name">Sam</h1>
<p class="description">He looks like Bernie Sanders because he is the disappearing middle class.</p>
</div>
<div id="character_22" class="character">
<img src="https://fullbellylaughs.com/uploads/landingpageimages/Susan.png" alt="">
<h1 class="name">Susan</h1>
<p class="description">She works the make-up counter at Macy’s, and loves Real Housewives.</p>
</div>
<div id="character_23" class="character">
<img src="https://fullbellylaughs.com/uploads/landingpageimages/Tom.png" alt="">
<h1 class="name">Tom</h1>
<p class="description">He has a secret cave in a field where he chills with Saorise Ronan.</p>
</div>
<div id="character_24" class="character">
<img src="https://fullbellylaughs.com/uploads/landingpageimages/Alex.png" alt="">
<h1 class="name">Alex</h1>
<p class="description">A beacon of diversity on the board, Alex is arguably the only trans character.</p>
</div>
</div>
body {
background: #1d438c;
display:block;
text-align:center;
color:white;
width:100%;
}
.characters{
width: 100%;
max-width: 1100px;
display: flex;
align-items: center;
justify-content: space-between;
flex-wrap: wrap;
margin: auto;
}
.character {
width:100%;
max-width:200px;
background: #1d438c;
display: block;
}
.character_visible:first-child{
left:0;
}
.character_visible:nth-child(2){
left:210px;
}
.character h1{
color:#ba1019;
}
.character img{
width: 200px;
height:auto;
display: block;
}
console.clear();
gsap.set('.character', {
autoAlpha: 0,
scaleX:0,
scaleY:0,
width:"0px"
});
var initialcharacters= [];
var character_length=document.querySelectorAll('.character').length;
while(initialcharacters.length < 5){
var r = Math.floor(Math.random() * character_length) + 1;
if(initialcharacters.indexOf(r) === -1) initialcharacters.push(r);
var showCharacter="#character_"+r;
gsap.fromTo(showCharacter, {
autoAlpha: 0,
scaleX:0,
scaleY:0,
width:"0px"
},{
autoAlpha: 1,
scaleX:1,
scaleY:1,
width:"200px"
});
}
function loop() {
//I remove on character from the array
let remove=initialcharacters.splice(Math.floor(Math.random()*initialcharacters.length), 1);
var removeCharacter="#character_"+remove;
console.log("remove "+removeCharacter);
//then adding a new character
var r = Math.floor(Math.random() * character_length) + 1;
if(initialcharacters.indexOf(r) === -1) initialcharacters.push(r);
var showCharacter="#character_"+r;
console.log("add "+showCharacter);
var tl = gsap.timeline();
tl.fromTo(removeCharacter, {
autoAlpha: 1,
scaleX:1,
scaleY:1,
width:"200px"
},{
autoAlpha: 0,
scaleX:0,
scaleY:0,
width:"0px"
});
tl.fromTo(showCharacter, {
autoAlpha: 0,
scaleX:0,
scaleY:0,
width:"0px"
},{
autoAlpha: 1,
scaleX:1,
scaleY:1,
width:"200px"
},0);
}
setInterval(function() {
loop();
}, 2500);
Also see: Tab Triggers