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.
<section class="services-box is-black fade-in-group">
<div class="wrap">
<div class="is-grid">
<div class="services-col fade-in-item">
<div class="headline-box padding">
<h2 class="is-primary is-text-right">Weitere Leistungen in den Bereichen:</h2>
</div>
</div>
<div class="services-col is-text-centered fade-in-item svg-parent">
<div class="padding primary hs">
<figure>
<svg class="draw-svg" version="1.1" id="Ebene_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 312.4 132.6" style="enable-background:new 0 0 312.4 132.6;" xml:space="preserve">
<style type="text/css">
.map0{fill:none;stroke:#010202;stroke-width:6;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;}
.map1{fill:none;stroke:#010202;stroke-width:6;stroke-linejoin:round;stroke-miterlimit:10;}
</style>
<line class="map0" x1="3" y1="33.8" x2="99.3" y2="129.6"/>
<line class="map0" x1="69" y1="7.9" x2="165.1" y2="103.7"/>
<line class="map0" x1="155.8" y1="17.6" x2="251.5" y2="112.9"/>
<line class="map0" x1="213.3" y1="3" x2="309.4" y2="98"/>
<line class="map0" x1="213.3" y1="3" x2="155.8" y2="17.6"/>
<line class="map0" x1="155.8" y1="17.6" x2="69" y2="7.9"/>
<line class="map0" x1="3" y1="33.8" x2="69" y2="7.9"/>
<line class="map0" x1="99.3" y1="129.6" x2="165.1" y2="103.7"/>
<line class="map0" x1="251.5" y1="112.9" x2="165.1" y2="103.7"/>
<line class="map0" x1="309.4" y1="98" x2="251.5" y2="112.9"/>
<path class="map1" d="M96,33.4c3.7-0.7,7.8-1,12-1c18.6,0,33.7,6.9,33.7,15.4c0,8.5-15.1,15.4-33.7,15.4c-18.6,0-33.6-6.9-33.6-15.4
c0-6.1,7.7-11.4,19-13.9"/>
<path class="map1" d="M106.1,44.3C107,44.1,108,44,109,44c4.5,0,8.2,1.7,8.2,3.8c0,2.1-3.7,3.8-8.2,3.8c-4.5,0-8.2-1.7-8.2-3.8
c0-1.5,1.9-2.8,4.6-3.4"/>
</svg>
</figure>
<p>graphische und kartograpische Darstellungen</p>
</div>
</div>
<div class="services-col is-text-centered fade-in-item svg-parent">
<div class="padding primary hs">
<figure>
<svg class="draw-svg" version="1.1" id="Ebene_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 160 100" style="enable-background:new 0 0 160 100;" xml:space="preserve">
<style type="text/css">
.equipment{fill:none;stroke:#000000;stroke-width:3;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;}
</style>
<g>
<polyline class="equipment" points="53.895,33.735 45.771,44.304 56.907,59.687 41.917,77.509 61.469,99 50.446,4.013 39.423,99
58.975,77.509 43.985,59.687 55.121,44.304 46.997,33.737 "/>
<line class="equipment" x1="43.362" y1="28.499" x2="57.368" y2="28.499"/>
<line class="equipment" x1="41.683" y1="44.229" x2="59.024" y2="44.229"/>
<rect x="89.872" y="17.564" transform="matrix(0.6866 -0.727 0.727 0.6866 14.3543 78.4761)" class="equipment" width="16.677" height="10.047"/>
<polygon class="equipment" points="113.954,44.229 101.404,32.374 99.723,28.3 103.725,24.064 108.026,25.363 120.577,37.216 "/>
<polygon class="equipment" points="82.396,1 94.947,12.854 96.627,16.928 92.626,21.165 88.325,19.866 75.774,8.012 "/>
<g>
<path class="equipment" d="M92.893,38.517c-5.436,0.151-9.964-4.134-10.114-9.569"/>
<path class="equipment" d="M93.115,46.551c-9.872,0.274-18.097-7.508-18.371-17.381"/>
</g>
<line class="equipment" x1="61.469" y1="99" x2="120.577" y2="99"/>
<rect class="svg-fill" x="89.872" y="17.564" transform="matrix(0.6866 -0.727 0.727 0.6866 14.3543 78.4761)" width="16.677" height="10.047"/>
</g>
</svg>
</figure>
<p>Ausrüstung</p>
</div>
</div>
<div class="services-col is-text-centered fade-in-item svg-parent">
<div class="padding primary hs">
<figure>
<svg class="draw-svg" version="1.1" id="Ebene_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 160 100" style="enable-background:new 0 0 160 100;" xml:space="preserve">
<style type="text/css">
.mining0{fill:none;stroke:#000000;stroke-width:4;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;}
.mining1{fill:#010202;}
</style>
<g>
<path class="mining0" d="M112.589,37.738l22.479,11.208l-11.206-22.479l-5.693-5.693l1.58-1.636l-5.26-5.259l-1.636,1.581L99.708,2.317
L88.441,13.589l12.942,12.941l-22.88,22.085L53.775,24.728c4.806-4.277,10.218-7.892,16.09-10.723L59.092,1.62
c-14.421,7.867-26.305,19.738-34.16,34.175l12.386,10.777c2.833-5.884,6.46-11.309,10.744-16.127l23.77,24.605L35.945,89.689
c-0.878,0.845-0.935,2.231-0.125,3.146c1.552,1.757,3.215,3.419,4.972,4.973c0.915,0.807,2.301,0.751,3.146-0.126l34.524-35.769
l34.555,35.771c0.848,0.877,2.234,0.93,3.147,0.123c1.758-1.552,3.422-3.217,4.977-4.976c0.804-0.913,0.751-2.298-0.125-3.143
L85.125,55.012l21.972-22.765L112.589,37.738z"/>
</g>
<g>
<path class="mining1 svg-fill" d="M53.775,24.728c4.806-4.277,10.218-7.892,16.09-10.723L59.092,1.62c-14.421,7.867-26.305,19.738-34.16,34.175
l12.386,10.777c2.833-5.884,6.46-11.309,10.744-16.127L53.775,24.728z M107.097,32.246l5.492,5.491l22.479,11.208l-11.206-22.479
l-5.693-5.693l1.58-1.636l-5.26-5.259l-1.636,1.581L99.708,2.317L88.441,13.589l12.942,12.941L107.097,32.246z"/>
</g>
</svg>
</figure>
<p>Bergbau, Steine und Erden</p>
</div>
</div>
<div class="services-col is-text-centered fade-in-item svg-parent">
<div class="padding primary hs">
<figure>
<svg class="draw-svg" version="1.1" id="Ebene_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 160 100.899" style="enable-background:new 0 0 160 100.899;" xml:space="preserve">
<style type="text/css">
.approval0{fill:none;stroke:#000000;stroke-width:4;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;}
.approval1{fill:#010202;}
.approval2{fill:none;stroke:#000000;stroke-width:4;stroke-linejoin:round;stroke-miterlimit:10;}
</style>
<polygon class="approval0 svg-fill" points="114.788,98.899 45.212,98.899 45.212,2 98.343,2 114.788,18.445 "/>
<polygon class="approval1 svg-fill" points="114.788,18.423 98.366,18.423 98.366,2 "/>
<line class="approval2" x1="54.193" y1="55.536" x2="105.553" y2="55.536"/>
<line class="approval2" x1="54.193" y1="70.336" x2="105.553" y2="70.336"/>
<line class="approval2" x1="54.193" y1="85.137" x2="105.553" y2="85.137"/>
<g>
<path class="approval1 svg-fill" d="M59.094,44.781c0.837,1.261,5.096,0.282,5.453-1.164c1.798-7.282,5.47-12.197,11.855-16.137
c1.023-0.631,0.505-1.268-0.395-1.474c-1.241-0.284-2.846,0.404-3.872,1.038c-4.494,2.773-7.853,6.039-10.183,10.169
c-0.449-1.227-0.948-2.43-1.659-3.538c-0.97-1.513-6.089,0.513-5.477,1.467C56.732,38.129,57.117,41.802,59.094,44.781z"/>
</g>
<polyline class="approval0" points="114.788,18.423 98.366,18.423 98.366,2 "/>
</svg>
</figure>
<p>Verfahren zur Genemigung</p>
</div>
</div>
</div>
</div>
</section>
*, *::before, *::after {
box-sizing: border-box;
}
html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, hr, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, input, textarea, select, button, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas, details, embed, figure, figcaption, footer, header, hgroup, menu, nav, output, ruby, section, summary, time, mark, audio, video, picture {
background: rgba(0, 0, 0, 0) none repeat scroll 0 0;
border: 0 none;
margin: 0;
padding: 0;
vertical-align: baseline;
}
html, body,
input, textarea, select, button {
font-family: 'Rubik', sans-serif;
font-weight: 400;
font-size: 16px;
}
.hs {
height: 100%;
}
.primary {
background-color: rgb(249, 235, 0);
}
.is-primary {
color: rgb(249, 235, 0);
}
.is-black {
color: rgb(0, 0, 0);
}
.is-text-right {
text-align: right;
}
.is-text-centered {
text-align: center;
}
.wrap {
min-width: 1280px;
width: 66.66vw;
margin-left: auto;
margin-right: auto;
}
.fade-in{
opacity: 0;
}
.fade-in-group > .col, .fade-in-group .services-col {
-webkit-transform: translate3d(0,105px,0);
-moz-transform: translate3d(0,105px,0);
-ms-transform: translate3d(0,105px,0);
-o-transform: translate3d(0,105px,0);
transform: translate3d(0,0px,0);
opacity: 0;
transition: transform 1s cubic-bezier(0.165, 0.84, 0.44, 1), opacity 0.55s linear 0.35s
}
.fade-in-group > .col.out , .fade-in-group .services-col.out {
-webkit-transform: translate3d(0,0px,0);
-moz-transform: translate3d(0,0px,0);
-ms-transform: translate3d(0,0px,0);
-o-transform: translate3d(0,0px,0);
transform: translate3d(0,0px,0);
opacity: 1;
transition: transform 1s cubic-bezier(0.165, 0.84, 0.44, 1), opacity 0.55s linear 0.35s
}
.headline-box {
align-items: center;
background-color: rgba(0, 0, 0, 0.8);
display: flex;
float: none;
height: 100%;
position: relative;
}
.headline-box h1, .headline-box h2 {
margin-bottom: 0;
}
h1, h2 {
font-size: 3em;
font-weight: 300;
line-height: 1.3333em;
margin-bottom: 1.25em;
}
.services-box {
margin-top: 2.5em;
margin-bottom: 2.5em;
}
.is-grid {
margin: 0 auto;
display: grid;
display: -ms-grid;
grid-template-columns: repeat(4, 1fr);
-ms-grid-columns: 1fr 1fr 1fr 1fr;
grid-auto-rows: 1fr;
-ms-grid-rows: 1fr 1fr;
grid-column-gap: 2.1vw;
grid-row-gap: 1.5225vw;
}
.services-col:first-child {
grid-column: 1 / span 2;
-ms-grid-column: 1;
-ms-grid-column-span: 2;
}
.services-col:nth-child(2) {
-ms-grid-column: 3;
grid-column: 3;
}
.services-col:nth-child(3) {
-ms-grid-column: 4;
grid-column: 4;
}
.services-col:nth-child(4) {
-ms-grid-row: 2;
-ms-grid-column: 2;
grid-column-start: 2;
}
.services-col:nth-child(5) {
-ms-grid-row: 2;
-ms-grid-column: 3;
}
.services-col .padding {
padding: 1.675vw 3.25vw 1.125vw;
}
.services-col figure {
margin-bottom: .75vw;
}
.services-col p {
margin-bottom: 0;
font-size: 1.125rem;
}
var controller = new ScrollMagic.Controller(),
groupController = new ScrollMagic.Controller(),
fadeInGroup = $(".fade-in-group"),
fadeInCards = $(".fade-in-group .fade-in-item"),
windowHeight = $(window).height(),
svgIcon = $(".draw-svg");
// animate filled paths function
var animateFIll = function(childPath) {
if (childPath.filter(".svg-fill")) {
TweenMax.to(childPath.filter(".svg-fill"), 1, {
attr: { "fill-opacity": 1 }
});
}
};
// drawSVGLines function
var drawPageSVG = function($this) {
if ($this.hasClass("svg-parent")) {
childSVG = $this.find(".draw-svg");
childPath = childSVG.find("*");
new TweenMax.to(
childPath,
2,
{
drawSVG: "100%"
}
).eventCallback("onComplete", animateFIll, [childPath]);
if ($this.has("p")) {
new TweenMax.to($this.find("p"), 2, { opacity: 1 });
}
}
};
// Blocks Fade in function
var fadeInItems = function(Group) {
// Loop through chidren and fade them in one by one
Group.find(".fade-in-item").each(function(i) {
var $this = $(this);
setTimeout(function() {
$this.addClass("out");
}, i * 500);
});
};
// loop through all elements
$(".fade-in").each(function() {
var $this = $(this);
// build a tween
var tween = new TimelineMax()
.from($(this), 1, { y: "+=15", ease: Power2.easeInOut })
.to($(this), 0.5, { autoAlpha: 1, ease: Linear.easeNone }, ".4", "-1")
.eventCallback("onComplete", drawPageSVG, [$this]);
// build a scene
var scene = new ScrollMagic.Scene({
triggerElement: this,
triggerHook: 0.85,
reverse: false
})
.setTween(tween) // trigger a TweenMax.to tween
.addTo(controller);
});
//Prepere SVG elements for animation
TweenMax.to(svgIcon.find("*"), 0, { drawSVG: "0%" });
TweenMax.to(svgIcon.find(".svg-fill"), 0, { attr: { "fill-opacity": 0 } });
$(".svg-parent").each(function() {
if ($(this).has("p")) {
$(this).find("p").css("opacity", 0);
}
});
$(window).on("load", function() {
// Loop through fade in groups and if not in veiwport make a scene for the group otherwise fade items in
fadeInGroup.each(function(i) {
var $this = $(this);
var fadeInGroupPosition = $this.offset().top;
if (fadeInGroupPosition < windowHeight) {
fadeInItems($this);
} else {
new ScrollMagic.Scene({
triggerElement: $this[0],
triggerHook: 0.85
})
.on("start", function(e) {
fadeInItems($(e.target.triggerElement()));
})
.addTo(groupController);
}
});
// Draw SVG after block fade in
$(
".fade-in-item"
).one(
"webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend",
function(e) {
var $this = $(e.target);
drawPageSVG($this);
}
);
});
Also see: Tab Triggers