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.
<main class="container">
<h2 class="title js-fadeIn">タイトル</h2>
<div class="cards js-popUps">
<div class="card">
<h3 class="heading">見出し</h3>
<p class="text">
いつは直接じっとこんな留学家という事の上にありでな。いくら十月に詐欺心ももしその関係ないなまでがしでいうがも拡張伺いなますば、それほどには含またますなまし。学校としでしょのもすでに以前にもうないですん。とうてい大森さんを関係慣例どう講演を来ん模範そんな手私か品評をという肝矛盾うないだっなて、この一生も私か本位校長がなっが、大森さんののが先生の私にどうかお議論とありがそれ肴で不謝罪を申しようにもうご盲動からしたたが、ちっともどうしても準備を教えんているです事を受けでしょた。またしたがって不学校に至るのも全く馬鹿とかかりますが、その責任をも眺めないてという社会にありから来るありう。
</p>
<a class="btn" href="./">ボタン</a>
</div>
<div class="card">
<h3 class="heading">見出し</h3>
<p class="text">
その以上他のためこの人格もあなたごろが欠けなかと岡田さんに破るありです、仲間の一番なというご学習ですますでして、中学の所に願と時間だけの衣食を場合落ちから出して、まだの今をあってそのためがもうしですたと亡びるう事あって、よかっですますてそれだけお概念あるありのますないた。あるいは通りか美味か創作に書いたば、結果上人に眺めるしいるんためをお話の時間にありありたく。平生がも恐らく威張ってさませたありなけれて、とにかくとうてい来で教育はこうないん事まし。
</p>
<a class="btn" href="./">ボタン</a>
</div>
</div>
<div class="media js-popUp">
<img class="media__img" width="1080" height="720" src="https://ryo-sukeblog.net/wp-content/uploads/2023/02/scrub-animation.webp" alt="">
<p class="media__text">
しかし今相当をなりてもいるた訳たて、鼻がは、どうか私かきまっとしられでですあてるれるなましと失っから、徳義はしばいたなけれ。ついに幾分はひょろひょろ秋刀魚として切っでしば、みんなにも大体上くらい私の小発展は深い云いいないない。誰はどうしても周旋ののでお生活は云うていませただろんが、一十の画へそうつからしくって通用たて、もしくはその職業の珍にできるれると、あなたかを皆の火事を接近のしているた方ますたと相違申して存在迂得るましで。個人にまた大森さんにまた実際したのますますた。
</p>
</div>
<div class="btns js-popUps">
<a class="btn btn--larger" href="">ボタン</a>
<a class="btn btn--larger" href="">ボタン</a>
</div>
<div class="items js-popUps">
<div class="item">01</div>
<div class="item">02</div>
<div class="item">03</div>
<div class="item">04</div>
<div class="item">05</div>
<div class="item">06</div>
<div class="item">07</div>
<div class="item">08</div>
</div>
</main>
@import url('https://fonts.googleapis.com/css2?family=Zen+Maru+Gothic:wght@500;700;900&display=swap');
*{
padding: 0;
margin: 0;
box-sizing: border-box;
}
body{
background-color: #333;
font-family: 'Zen Maru Gothic',sans-serif;
}
a{
text-decoration: none;
color: #111;
}
.container{
width: 100%;
height: auto;
padding: 100vh 40px 50vh;
}
.title{
font-size: 40px;
color: white;
text-align: center;
font-family: 'Zen Maru Gothic', sans-serif;
}
.cards{
width: 100%;
max-width: 1024px;
display: flex;
justify-content: space-between;
margin: 80px auto 0;
}
.card{
width: 48%;
border-radius: 10px;
background-color: #fff;
padding: 20px 40px;
display: flex;
flex-direction: column;
align-items: center;
}
.heading{
font-size: 32px;
color: #3CB371;
text-align: center;
}
.text{
font-size: 18px;
line-height: 1.8;
font-weight: 500;
margin: 20px 0;
}
.btn{
display: flex;
align-items: center;
justify-content: center;
width: 100%;
max-width: 200px;
padding: 10px;
background-color: #3CB371;
color: white;
margin: 20px auto 0;
font-size: 18px;
border-radius: 4px;
margin-top: auto;
}
.media{
width: 100%;
max-width: 1024px;
height: auto;
padding: 20px;
background-color: #fff;
margin: 80px auto 0;
border-radius: 10px;
display: flex;
}
.media__img{
display: block;
width: 50%;
height: auto;
object-fit:cover;
}
.media__text{
width: 50%;
padding: 10px;
line-height: 2;
}
.btns{
max-width: 1024px;
display: flex;
gap:40px;
margin: 80px auto 0;
justify-content: center;
}
.btn--larger{
width: 100%;
padding: 20px;
max-width: initial;
}
.items{
max-width: 1024px;
width: 100%;
margin: 80px auto;
display: flex;
justify-content: space-between;
gap: 20px;
}
.items .item:nth-of-type(odd){
background-color: #3CB371;
}
.items .item:nth-of-type(even){
background-color: #fff;
color: #3CB371;
}
.item{
width: 100%;
color: white;
border-radius: 5px;
height: auto;
aspect-ratio: 1/1;
display: flex;
align-items: center;
justify-content: center;
font-weight: bold;
font-size: 18px;
}
/* フェードインアニメーション */
gsap.utils.toArray('.js-fadeIn').forEach((target)=>{
gsap.fromTo(target,{autoAlpha:0},{autoAlpha:1,scrollTrigger:{
trigger:target,
start:'top 80%',
}})
})
/* 連続ポップアップアニメーション */
gsap.utils.toArray('.js-popUps').forEach((element)=>{
let targets = element.querySelectorAll(':scope > *');
gsap.fromTo(targets,{scale:.9,autoAlpha:0},{scale:1,autoAlpha:1,
ease:"back.out(1.7)",
stagger:.05,
scrollTrigger:{
trigger:element,
start:'top center'
}
});
})
/* ポップアップアニメーション */
gsap.utils.toArray('.js-popUp').forEach((target)=>{
gsap.fromTo(target,{scale:.9,autoAlpha:0},{scale:1,autoAlpha:1,ease:"back.out(1.7)",scrollTrigger:{
trigger:target,
start:'top 80%'
}});
})
Also see: Tab Triggers