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 class="container">
<svg class="mountains" width="100%" viewBox="0 0 2000 400">
<defs>
<style type="text/css">
.mount3 {fill:#17516b}
.mount2 {fill:#124156}
.mount4 {fill:#0e3141}
.mount1 {fill:#1b6180}
.snow {fill:white}
</style>
<filter id="fireblur" x="0" y="0">
<feGaussianBlur in="SourceGraphic" stdDeviation="3" />
</filter>
<linearGradient id="firegradient">
<stop offset="5%" stop-color="#fd4"/>
<stop offset="95%" stop-color="red"/>
</linearGradient>
<linearGradient id="water">
<stop offset="5%" stop-color="#CBA8C2"/>
<stop offset="95%" stop-color="#46B0EA"/>
</linearGradient>
</defs>
<g id="mounts">
<path class="mount1" d="M0 275 150 250 550 100 800 250 1200 150 1500 25 2000 300 2000 400 0 400"/>
<path class="snow" d="M 495 120 550 100 600 130 575 125 550 130 535 115"/>
<path class="snow" d="M 1380 75 1500 25 1635 100 1550 75 1500 85 1450 75"/>
<path class="mount3" d="M0 350 350 225 500 300 800 200 1000 275 1250 200 1500 250 1850 175 2000 250 2000 400 0 400"/>
<path class="mount2" d="M0 400 650 250 900 300 1550 250 2000 300 2000 400"/>
<path class="mount4" d="M0 350 450 300 800 350 1200 300 1500 350 1750 275 2000 200 2000 400 0 400"/>
<symbol id="trees-group">
<use xlink:href="#tree" fill="#163546" x="1500" y="250"/>
<use xlink:href="#tree" fill="#1E1F26" x="1530" y="240"/>
<use xlink:href="#tree" fill="#1E1F26" x="1510" y="245"/>
<use xlink:href="#tree" fill="#163546" x="1520" y="245"/>
<use xlink:href="#tree" fill="#226282" x="1510" y="255"/>
<use xlink:href="#tree" fill="#226282" x="1535" y="250"/>
</symbol>
<g>
<use xlink:href="#trees-group" y="5"/>
<use xlink:href="#campfire" x="3075" y="545" transform="scale(0.5)" filter="url(#fireblur)"/>
<use xlink:href="#trees-group" x="45" y="15"/>
<g class="lake" fill="url(#water)">
<ellipse cx="1480" cy="300" rx="80" ry="10"/>
<ellipse cx="1430" cy="305" rx="50" ry="6"/>
</g>
<use xlink:href="#trees-group" transform="translate(2990,-35) scale(-1,1.3)"/>
</g>
<g id="sendit">
<use xlink:href="#bear" fill="#1B0D03" x="3880" y="350" transform="scale(0.5)"/>
</g>
</g>
</svg>
<div class="sunrise">
<div class="sun"></div>
<div class="star" id="ray"></div>
</div>
<svg class="baloon">
<g id="baloon">
<circle cx="50" cy="50" r="20" fill="#29ABE2"/>
<polygon points="34 62 66 62 56 75 45 75" fill="#29ABE2"/>
<path d="M45 75 Q 20 40 50 30 Q 37 40 48 75" fill="crimson"/>
<path d="M56 75 Q 80 40 50 30 Q 63 40 53 75" fill="crimson"/>
<rect x="44" y="78" width="14" height="10" ry="5" fill="#1D1E22"/>
</g>
</svg>
<svg class="birds" width="100px" height="100px" viewbox="-5 -5 100 100">
<style>
</style>
<symbol id="bird" viewbox="-5 -5 100 100">
<path class="wing" d="M 15 0 Q 10 0 20 10 Q 10 7 5 0" fill="#1E1F26"/>
<path class="wing" d="M 5 0 Q 5 10 10 10 Q 10 3 15 0" fill="#5A5E72"/>
<path class="corpus" d="M 0 0 15 -1 15 1" fill="#1E1F26"/>
</symbol>
<g id="birds">
<use xlink:href="#bird" x="0" y="0" transform="scale(0.9)"/>
<use xlink:href="#bird" x="10" y="20"/>
<use xlink:href="#bird" x="30" y="15" transform="scale(0.8)"/>
</g>
</svg>
<div class="invisible">
<svg id="tree">
<symbol id="cone">
<polygon points="6 0 0 5 12 5"/>
</symbol>
<g>
<use xlink:href="#cone" x="10"/>
<use xlink:href="#cone" x="7" y="3" transform="scale(1.2)"/>
<use xlink:href="#cone" x="4" y="5" transform="scale(1.5)"/>
<use xlink:href="#cone" x="3" y="7" transform="scale(1.7)"/>
<use xlink:href="#cone" x="1.5" y="8" transform="scale(2)"/>
</g>
</svg>
<svg id="bear">
<g>
<path d="
M10 25
18 22
20 20
30 20
40 22
55 30
80 30
90 40
92 50
90 60
92 75
85 80
70 80
70 75
75 70
70 60
62 62
50 62
48 75
45 80
35 80
30 75
35 72
32 60
30 50
25 38
15 35
10 30">
<animate id="bearhead" dur="3s" begin="3s;bearhead.end+5s" attributeName="d" fill="freeze" values="
M10 25
18 22
20 20
30 20
40 22
55 30
80 30
90 40
92 50
90 60
92 75
85 80
70 80
70 75
75 70
70 60
62 62
50 62
48 75
45 80
35 80
30 75
35 72
32 60
30 50
25 38
15 35
10 30;
M12 20
20 18
22 17
30 18
40 22
55 30
80 30
90 40
92 50
90 60
92 75
85 80
70 80
70 75
75 70
70 60
62 62
50 62
48 75
45 80
35 80
30 75
35 72
32 60
30 50
25 38
15 30
12 25;
M10 25
18 22
20 20
30 20
40 22
55 30
80 30
90 40
92 50
90 60
92 75
85 80
70 80
70 75
75 70
70 60
62 62
50 62
48 75
45 80
35 80
30 75
35 72
32 60
30 50
25 38
15 35
10 30;"/>
</path>
</g>
</svg>
<svg id="campfire">
<g>
<path d="M15 30 C 0 25 20 20 15 10 Q 30 20 15 30" fill="url(#firegradient)">
<animate id="fire" dur="2s" repeatCount="indefinite" attributeName="d" fill="freeze" values="M15 30 C 0 25 20 20 15 10 Q 30 20 15 30; M15 30 C 0 25 20 20 10 10 Q 30 20 15 30; M15 30 C 0 25 20 20 15 10 Q 30 20 15 30"/></path>
</g>
</svg>
</div>
<p id="speech">SEND IT!</p>
<div class="credits">
<a href="http://webmassa.ru" target="_blank"><p style="text-align:right">Clean SVG code by <img style="width:15px; margin-bottom:-2px;" src="http://webmassa.ru/wp-content/uploads/2018/12/Favicon.png"></img> <span style="color:#C85050;">Webmassa</span></p></a>
</div>
</div>
body {
margin: 0;
}
p {
font-family: 'Open Sans', sans-serif;
color: #fff;
font-size: 15px;
}
a {
text-decoration: none;
}
.container {
position: absolute;
height: 100%;
width: 100vw;
background: radial-gradient(at bottom, #BD76A8 30%, #46B0EA 100%);
}
.invisible {
display: none;
}
.mountains {
position: absolute;
z-index: 2;
right: 0;
bottom: 0;
width: 100%;
opacity: .95;
}
.sunrise {
position: absolute;
z-index: 1;
bottom: 15vh;
left: 50%;
margin-left: -100px;
}
.sun {
width: 200px;
height: 200px;
background: #fffff3;
border-radius: 50%;
filter: blur(25px);
opacity: .75;
}
@keyframes pulse {
0% {
transform: scale(1, 1);
}
50% {
transform: scale(1.1, 1.1);
}
100% {
transform: scale(1, 1);
}
}
.sunrise {
animation: pulse 5s linear infinite;
}
.star {
position: absolute;
bottom: -50px;
left: -50px;
width: 300px;
height: 300px;
background: #fff;
opacity: .025;
clip-path: polygon(100% 0, 58% 50%, 100% 100%, 50% 58%, 0 100%, 48% 50%, 0 0, 50% 48%);
}
#ray {
transform: rotate(60deg);
}
.baloon {
position: absolute;
z-index: 3;
left: 20vw;
bottom: 35vh;
animation: float 10s linear infinite;;
}
@keyframes float {
0% {
transform: translateY(0px);
}
50% {
transform: translateY(-20px);
}
100% {
transform: translateY(0px);
}
}
.birds {
z-index: 4;
position: absolute;
bottom: 45vh;
animation: flying 30s linear infinite;
}
@keyframes flying {
0% {
transform: translate(100vw, 0);
}
50% {
transform: translate(50vw, 50px);
}
100% {
transform: translate(-2vw, 0);
}
}
.wing {
animation: swing 2s linear infinite;
}
@keyframes swing {
0% {
transform: scale(1);
}
50% {
transform: scale(1,-.5);
}
100% {
transform: scale(1);
}
}
#sendit:hover {
cursor: pointer;
}
#speech {
opacity: 0;
padding: 10px;
position: absolute;
z-index: 5;
right: 2.5vw;
bottom: 20vh;
transition: .5s ease-in-out;
}
.credits {
position: fixed;
z-index: 6;
bottom: 0;
right: 15px;
}
.credits p {
font-size: 12px;
color: #226182;
}
@media screen and (max-width: 1280px) {
.sunrise {
bottom: 5vh;
}
.sun {
transform: scale(0.6,0.6);
}
.star {
width: 150px;
height: 150px;
bottom: 30px;
left: 30px;
}
.mountains {
width: 150%;
}
}
@media screen and (max-width: 760px) {
.sunrise {
bottom: 2vh;
}
#baloon {
transform: scale(0.8,0.8);
}
#birds {
transform: scale(0.8,0.8);
}
.mountains {
width: 200%;
}
}
@media screen and (max-width: 480px) {
.sunrise {
bottom: 1vh;
}
#baloon {
transform: scale(0.5,0.5);
}
#birds {
transform: scale(0.5,0.5);
}
}
$("#bear").hover(function(){
$("#speech").css("opacity", "1");
}, function(){
$("#speech").css("opacity", "0");
});
$( function() {
$( ".baloon").draggable();
} );
Also see: Tab Triggers