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 = 'title'>Click on the Icon</div>
<div class='wrapper hide'>
<div class = 'num hide'>1</div>
<svg width="900px" height="300px" viewBox="0 0 1280 800" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:1.41421;">
<path d="M590.832,448.337C589.517,447.337 587.981,446.403 587.268,445.76C585.646,444.297 584.799,442.068 583.9,439.879C583.076,437.287 583.226,434.708 583.826,432.105C598.194,409.92 613.659,388.608 615.226,353.606C614.434,313.878 623.308,291.788 636.25,278.444C646.872,265.203 661.154,255.282 678.585,248.44L678.682,248.392L678.782,248.315C678.544,246.767 678.498,245.016 678.624,243.268C678.695,242.277 678.846,241.558 678.891,240.782C678.979,239.258 679.235,237.743 679.617,236.244C683.002,222.955 697.006,213.234 710.971,213.252C725.736,213.271 740.731,223.402 743.195,238.331C743.829,242.172 743.947,245.478 743.635,248.315L743.674,248.315C743.666,249.147 743.627,249.95 743.552,250.709C764.033,255.522 778.234,269.91 790.363,287.817C800.055,309.26 808.132,332.749 805.903,365.982C807.185,397.309 827.417,409.547 831.671,424.611C823.129,420.685 814.503,416.156 805.461,414.136C798.061,410.999 790.252,409.309 782.342,408.311C774.976,406.891 767.529,405.671 759.828,405.082C750.158,403.271 740.388,402.951 730.57,403.341C735.655,405.566 740.848,407.555 746.861,408.442C750.394,408.979 753.871,409.508 756.3,409.982C760.698,410.838 765.552,412.122 769.691,413.057C773.005,413.806 776.268,414.71 779.84,415.717C783.341,416.652 786.619,417.054 789.637,418.667C792.317,419.256 794.42,421.268 796.434,422.357C798.768,423.618 800.839,425.135 802.242,427.168L804.335,430.933C805.091,433.967 805.325,437.021 804.201,440.126C803.005,442.829 801.051,444.819 798.698,446.434C798.065,446.976 797.42,447.494 796.76,447.981C793.873,451.945 782.789,456.794 765.653,460.908C763.77,461.469 761.844,461.906 759.865,462.219C742.58,465.912 720.171,468.804 694.412,469.557C642.401,471.078 599.137,456.184 590.832,448.337Z" style="fill:#fff;"/>
<g transform="matrix(1,0,0,1,-7.83975,-8.3859)">
<circle class='bell' cx="696.599" cy="475.846" r="27.99"/>
</g>
</svg>
</div>
<div class="notification hide">
<div class="section one">
<div class="text one">
</div>
<div class="rect one"></div>
</div>
<div class="section two">
<div class="text"></div>
<div class="rect two"></div>
</div>
<div class="section three">
<div class="text"></div>
<div class="rect three"></div>
</div>
<div class="section four">
<div class="text"></div>
<div class="rect four"></div>
</div>
</div>
.title{
color: white;
font-size: 30px;
font-family: Raleway;
text-align: center;
}
body{
background: #1D2133;
}
svg path{
cursor: pointer;
}
svg.grey path {
fill: rgb(62 , 83 ,126) !important;
}
svg circle{
cursor: pointer;
}
svg.grey circle {
fill: rgb(62 , 83 ,126) !important;
cursor: pointer;
}
.wrapper{
/* background: red; */
position: relative;
width: 900px;
height: 700px;
/* transform-origin: 470px 120px; */
transition: all 150ms cubic-bezier(0.445, 0.05, 0.55, 0.95);
top: 0;
left: calc(50% - (900px / 2));
}
.wrapper.hide{
top: 150px;
}
.wrapper.animate {
animation: bell 1.7s ease-in-out infinite;
}
.num{
position: relative;
left: 485px;
border: #1D2133 solid 3px;
top: 120px;
z-index: 1;
background: red;
width: 35px;
height: 35px;
text-align: center;
padding: 5px;
color: white;
font-size: 30px;
font-family: 'Raleway';
border-radius: 50%;
}
.num.hide{
opacity: 0;
}
.bell {
fill: #fff;
}
.bell.hide{
animation: clapper 1.7s ease-in-out infinite;
}
@keyframes bell {
0% { transform: rotate(0); }
20% { transform: rotate(12.5deg); }
40% { transform: rotate(-12.5deg); }
60% { transform: rotate(12.5deg); }
80% { transform: rotate(2deg); }
85% { transform: rotate(0); }
100% { transform: rotate(0); }
}
@keyframes clapper {
0% { transform: translateX(10px);}
25% { transform: translateX(60px); }
50% { transform: translateX(-40px); }
75% { transform: translateX(-10px); }
100% { transform: translateX(10px); }
}
.notification{
display: flex;
position: relative;
background: rgb(62 , 83 ,126);
width: 350px;
height: 250px;
top: -440px;
border-radius: 10px;
flex-direction: column;
left: calc(50% - (350px / 2));
transform: scale(1);
transition: all 150ms cubic-bezier(0.785, 0.135, 0.15, 0.86);
}
.notification.hide {
transform: scale(0);
}
.notification:before{
content: '';
position: absolute;
width: 40px;
height: 40px;
background: rgb(62 , 83 ,126);
transform: rotate(45deg);
top: -8px;
left: calc(50% - 2px);
}
.section{
width: 100%;
display: flex;
align-items: center;
flex: 1;
border-bottom: 2px rgb(50 , 70 ,113) solid;
}
.section.four{
border-bottom: 0px ;
}
.text{
background: rgb(50 , 70 ,113);
width: 25px;
height: 25px;
border-radius: 50%;
margin-left: 15px;
}
.text.one{
background: #fff;
}
.rect{
position: relative;
left: 20px;
width: 220px;
height: 12px;
border-radius: 30px;
background: rgb(50 , 70 ,113);
}
.rect.one{
background: #fff;
width:190px
}
.rect.three{
width:140px
}
.rect.four{
width:190px
}
const $ = selector => document.querySelector(selector)
let shouldClickOnBell = false
const toggleClass = (el, className) => {
if (el.classList.contains(className)) {
el.classList.remove(className)
} else {
el.classList.add(className)
}
}
const notification = $('.notification')
const bellSvg = $('svg')
const bellSvgPath = $('svg path')
const wrapperHide = $('.wrapper')
const numHide = $('.num')
const bellHide = $('.bell')
bellSvgPath.addEventListener('click', () => {
if (shouldClickOnBell) {
toggleClass(wrapperHide, 'hide')
toggleClass(wrapperHide, 'animate')
toggleClass(notification, 'hide')
toggleClass(bellSvg, 'grey')
toggleClass(numHide, 'hide')
toggleClass(bellHide, 'hide')
}
})
setTimeout(() => {
numHide.classList.remove('hide')
bellHide.classList.add('hide')
wrapperHide.classList.add('animate')
shouldClickOnBell = true
}, 1000)
Also see: Tab Triggers