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.
<body>
<section class="principles">
<div class="principles__container content-container">
<div class="principles__scroll">
<h2 class="principles__title">We Follow <span class = "marked">Agile Principles</span></h2>
<div class="principles__counter">
<span class="principles__current">1</span> /
<span class="principles__total">10</span>
</div>
<div class="principles__list">
<div class="principles__item">
<span class="principles__number">01</span>
<p class="principles__description">Our highest priority is to satisfy the customer through early and continuous delivery of valuable software.</p>
</div>
<div class="principles__item">
<span class="principles__number">02</span>
<p class="principles__description">Welcome changing requirements, even late in development. Agile process harness change for the customer’s competitive advantage.</p>
</div>
<div class="principles__item">
<span class="principles__number">03</span>
<p class="principles__description">Deliver working software frequently, from a couple of weeks to a couple of months, with a preference to the shorter timescale.</p>
</div>
<div class="principles__item">
<span class="principles__number">04</span>
<p class="principles__description">Business and developers must work together daily throughout the project</p>
</div>
<div class="principles__item">
<span class="principles__number">05</span>
<p class="principles__description">Build projects around motivated individuals. Give them the environment and support they need, and trust them to get the job done.</p>
</div>
<div class="principles__item">
<span class="principles__number">06</span>
<p class="principles__description">The most efficient and effective method of conveying information to and within a development team is face-to-face conversation.</p>
</div>
<div class="principles__item">
<span class="principles__number">07</span>
<p class="principles__description">Working software is the primary measure of progress.</p>
</div>
<div class="principles__item">
<span class="principles__number">08</span>
<p class="principles__description">Agile processes promote sustainable development. The sponsors, developers and users should be able to maintain a constant pace indefinitely.</p>
</div>
<div class="principles__item">
<span class="principles__number">09</span>
<p class="principles__description">Continuous attention to technical excellence and good design enhances agility.</p>
</div>
<div class="principles__item">
<span class="principles__number">10</span>
<p class="principles__description">The best architectures, requirements, and designs emerge from self-organizing teams.</p>
</div>
</div>
</div>
</div>
</section>
<section class="spacer"></div>
<script src='https://cdnjs.cloudflare.com/ajax/libs/gsap/3.8.0/gsap.min.js'></script>
<script src='https://unpkg.com/gsap@3/dist/ScrollTrigger.min.js'></script>
<script src="js/custom.js"></script>
</body>
body {
margin: 0;
overflow-x: hidden;
}
.principles{
padding: 60px 20px 120px;
box-sizing: border-box;
}
.principles__container{
margin: 0 auto;
width: 100%;
position: relative;
}
.principles__title{
font-family: 'Montserrat', sans-serif;
font-weight: bold;
font-size: 42px;
line-height: 54px;
color: #1C2F6B;
margin-bottom: 32px;
}
.principles__counter{
position: absolute;
right: 0;
top: 0;
font-family: 'Montserrat', sans-serif;
font-weight: bold;
font-size: 24px;
line-height: 36px;
color: #30C5FF;
}
.principles__list {
display: flex;
padding-left: calc(50vw - 370px/2);
}
.principles__item{
background-color: #F5F9FF;
min-width: 370px;
padding: 32px;
margin-left: 30px;
//transition: .5s all ease;
cursor: pointer;
height: 290px;
box-sizing: border-box;
}
.principles__item:first-of-type{
margin-left: 0;
}
.principles__item:after {
display: block;
width: 100%;
height: 100%;
content: "";
background-color: #1C2F6B;
position: absolute;
left: 0;
top: 0;
-webkit-transform-origin: 50% 100%;
transform-origin: 50% 100%;
-webkit-transform: scaleY(0);
transform: scaleY(0);
-webkit-transition: -webkit-transform .3s;
transition: -webkit-transform .3s;
transition: transform .3s;
transition: transform .3s,-webkit-transform .3s;
z-index: -1;
}
.principles__item.active:after {
-webkit-transform: scaleY(1);
transform: scaleY(1);
}
.principles__item:hover{
background-color: #1C2F6B;
}
.principles__item:hover .principles__description,
.principles__item.active .principles__description{
color: #fff;
}
.principles__number{
color: #30C5FF;
margin-bottom: 5px;
font-size: 20px;
font-weight: bold;
font-family: 'Montserrat', sans-serif;
}
.principles__description{
color: #1C2F6B;
font-size: 20px;
font-weight: bold;
font-family: 'Montserrat', sans-serif;
transition: .5s all ease;
}
gsap.registerPlugin(ScrollTrigger);
const sections = gsap.utils.toArray(".principles__item");
let maxWidth = 0;
const getMaxWidth = () => {
maxWidth = 0;
sections.forEach((section) => {
maxWidth += section.offsetWidth;
maxWidth += gsap.getProperty(section, 'marginLeft');
});
maxWidth += 20;
maxWidth += window.innerWidth;
maxWidth -= sections[0].offsetWidth;
return maxWidth;
};
getMaxWidth();
ScrollTrigger.addEventListener("refreshInit", getMaxWidth);
gsap.set('section.spacer', { minHeight: window.innerHeight - document.querySelector('.principles').offsetHeight })
gsap.to(sections, {
x: () => `-${maxWidth - window.innerWidth}`,
ease: "none",
scrollTrigger: {
trigger: ".principles",
pin: true,
scrub: 0.5,
markers: true,
end: () => `+=${maxWidth}`,
invalidateOnRefresh: true
}
});
sections.forEach((sct, i) => {
ScrollTrigger.create({
trigger: sct,
start: () => 'top top-=' + (sct.offsetLeft - window.innerWidth/2) * (maxWidth / (maxWidth - window.innerWidth)),
end: () => '+=' + sct.offsetWidth * (maxWidth / (maxWidth - window.innerWidth)),
toggleClass: {targets: sct, className: "active"}
});
});
Also see: Tab Triggers