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="header">
<div class="header--container">
<img class="header--brand" src="https://3dassetsmaan.s3.ap-south-1.amazonaws.com/logo.png">
<ul class="header--menu">
<li>Features</li>
<li>Experience it</li>
<li>Buy now</li>
</ul>
</div>
</div>
<section id="view1" class="section">
<div class="hero--container">
<div class="hero--content">
<h2>Always shoot like a</h2>
<h1>Pro</h1>
<p>Discover our most advanced camera and lens series yet: blazing fast AF, incredible low light performance, superb image stabilization, sharp image quality, and so much more.</p>
<button tabindex="-1" class="button button-know-more">Know more</button>
</div>
</div>
</section>
<section id="view2" class="section">
<div class="performance--container">
<div class="performance--content">
<h2>Outstanding</h2>
<h1>Performance</h1>
<p>The EOS R10 is perfect for content creators looking to take their creativity to the next level. Featuring a high-speed shooting 15 FPS mechanical shutter1,2, a 24.2 Megapixel CMOS (APS-C) sensor, and lightning fast autofocus, the EOS R10 camera brings some of the best features from the growing EOS R Series to a sleek, lightweight design.</p>
<img src="https://3dassetsmaan.s3.ap-south-1.amazonaws.com/performance_video.jpg">
</div>
</div>
</section>
<section id="view3" class="section">
<div class="power--container">
<div class="power--content">
<h2>Features that bring you</h2>
<h1>Power</h1>
<p>The easy-to-carry EOS R10 packs advanced features into a lightweight, compact design. Pair with a Canon RF-S/RF lens for a high-performance setup that fits easily and comfortably in your hand.</p>
</div>
<div class="power--features--img">
<img src="https://3dassetsmaan.s3.ap-south-1.amazonaws.com/power_features.png">
</div>
</div>
</section>
<div class="section">
<div class="autofocus--container">
<div class="autofocus--content">
<h1>Smart, speedy <strong>autofocus</strong></h1>
<p>Canon's Dual Pixel CMOS AF technology with people, animal, and vehicle subject detection lets you keep your eye on the action while it keeps your subject in crystal clear focus.</p>
<!-- <img class="autofocus--img" src="assets/images/autofocus.png"> -->
</div>
</div>
</div>
<section id="view4" class="section explore">
<div class="explore--container">
<div class="explore--content">
<h1>Interactive<strong><br>3D gallery</strong></h1>
<button tabindex="-1" class="button button-explore">Explore</button>
</div>
</div>
</section>
<div class="exit--container">
<button class="button--secondary button--body">View body only</button>
<button class="button--secondary button--exit">Exit</button>
</div>
<div id="webgi-canvas-container">
<canvas id="webgi-canvas"></canvas>
</div>
/* http://meyerweb.com/eric/tools/css/reset/
v2.0 | 20110126
License: none (public domain)
*/
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,
b,
sub,
sup,
tt,
var,
b,
u,
i,
center,
dl,
dt,
dd,
ol,
ul,
li,
fieldset,
form,
label,
legend,
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 {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font: inherit;
vertical-align: baseline;
overscroll-behavior: none;
}
body {
overflow-x: hidden;
}
ol,
ul {
list-style: none;
}
blockquote,
q {
quotes: none;
}
blockquote:before,
blockquote:after,
q:before,
q:after {
content: "";
content: none;
}
table {
border-collapse: collapse;
border-spacing: 0;
}
#webgi-canvas {
width: 100%;
height: 100vh;
margin: 0;
padding: 0;
position: fixed;
top: 0;
left: 0;
touch-action: none;
/* pointer-events: none; */
}
#webgi-canvas-container {
width: 100vw;
height: 100vh;
margin: 0;
padding: 0;
position: fixed;
}
/* LOADER */
.loader {
display: flex;
position: absolute;
width: 100%;
height: 100%;
z-index: 10;
background-color: #e1dedf;
align-items: center;
justify-content: center;
flex-direction: column;
gap: 2em;
font-size: 12px;
}
.progress {
position: absolute;
top: 60%;
width: 50%;
height: 1px;
background: #c42323;
transform: scaleX(0);
transition: transform 1s;
transform-origin: left;
z-index: 10;
margin: 0 5%;
}
/* HEADER SECTION */
.header {
position: absolute;
z-index: 2;
display: flex;
width: 100%;
justify-content: center;
}
.header--container {
display: flex;
width: 80vw;
justify-content: space-between;
align-items: center;
margin-top: 40px;
}
.header--brand {
width: 140px;
-moz-user-select: none;
-webkit-user-select: none;
-ms-user-select: none;
user-select: none;
}
.header--menu {
display: inline-flex;
gap: 1em;
align-items: center;
}
.header--menu li {
padding: 10px 30px;
color: black;
transition: all 0.6s ease-in-out;
border-radius: 50px;
pointer-events: all;
-moz-user-select: none;
-webkit-user-select: none;
-ms-user-select: none;
user-select: none;
}
.header--menu li:hover {
padding: 10px 30px;
background: black;
color: white;
cursor: pointer;
}
/* HERO SECTION */
.section {
position: relative;
z-index: 1;
display: flex;
width: 100%;
height: 100vh;
align-content: center;
justify-content: center;
margin: 0;
padding: 0;
scroll-snap-align: start;
-moz-user-select: none;
-webkit-user-select: none;
-ms-user-select: none;
user-select: none;
}
.hero--container {
display: flex;
align-items: center;
justify-content: flex-start;
width: 80%;
}
.hero--content {
width: 320px;
position: absolute;
margin-left: 10%;
}
h1 {
position: relative;
left: -12px;
width: 280px;
height: 76px;
font-style: normal;
font-weight: 700;
font-size: 184px;
line-height: 76px;
letter-spacing: -0.01em;
color: #181818;
margin-bottom: 60px;
}
.hero--content > h2 {
text-align: right;
margin-right: 56px;
margin-bottom: 9px;
font-weight: 500;
font-size: 17px;
}
.hero--content > p {
font-style: normal;
font-weight: 400;
font-size: 16px;
line-height: 22px;
letter-spacing: -0.04em;
margin-bottom: 30px;
}
.button {
width: 194px;
height: 60px;
left: 134px;
top: 447px;
border: none;
background-image: linear-gradient(9deg, #af0d0d, #ff9090);
border-radius: 58px;
display: inline-flex;
align-items: center;
justify-content: space-evenly;
font-weight: 700;
font-size: 18px;
display: flex;
align-items: center;
letter-spacing: -0.02em;
color: #ffffff;
padding: 10px;
transition: all 0.8s ease-in-out;
background-position: 0 -30px;
background-size: 100% 90px;
background-repeat: repeat-x repeat-y;
}
.button:hover {
background-image: linear-gradient(9deg, #af0d0d, #ff9090);
box-shadow: 0px 6px 20px #d50f0fc3;
transform: translateY(-3px);
cursor: pointer;
background-position: 0 0;
}
.bounce {
-moz-animation: bounce 2s infinite;
-webkit-animation: bounce 2s infinite;
animation: bounce 2s infinite;
}
@keyframes bounce {
0%,
20%,
50%,
80%,
100% {
transform: translateY(0);
}
40% {
transform: translateY(-15px);
}
60% {
transform: translateY(-5px);
}
}
.hero--scroller--container {
bottom: 0;
align-items: center;
width: 170px;
align-content: center;
flex-direction: column;
position: absolute;
text-align: center;
line-height: 3.2em;
color: grey;
overflow: hidden;
}
/* PERFORMANCE SECTION */
.performance--container {
display: flex;
align-items: center;
justify-content: flex-end;
width: 80%;
}
.performance--content {
width: 320px;
position: absolute;
margin-right: 10%;
/* opacity: 0; */
}
.performance--content p {
line-height: 22px;
}
.performance--container.fixed {
position: fixed;
top: 50%;
}
.performance--content > h1 {
position: relative;
left: -4px;
font-style: normal;
font-weight: 700;
font-size: 85px;
line-height: 55px;
letter-spacing: -0.01em;
color: #be1921;
margin-bottom: 60px;
word-break: break-all;
}
.performance--content > h2 {
margin-bottom: 16px;
font-weight: 500;
font-size: 17px;
}
.performance--content > img {
margin-top: 32px;
margin-bottom: 32px;
border-radius: 10px;
}
/* POWER SECTION */
.power--container {
display: flex;
width: 80%;
align-content: flex-start;
align-items: flex-start;
flex-direction: column;
justify-content: center;
}
.power--content {
width: 400px;
}
.power--content > h1 {
font-style: normal;
font-weight: 700;
font-size: 125px;
line-height: 55px;
letter-spacing: -0.01em;
color: #be1921;
margin-top: 32px;
margin-bottom: 24px;
}
.power--content > p {
line-height: 22px;
}
.power--img {
position: relative;
top: -340px;
}
.power--features--img {
position: absolute;
top: 50%;
transform: translateY(-50%);
right: 10%;
}
/* AUTOFOCUS SECTION */
.autofocus--container {
display: flex;
align-content: flex-end;
align-items: center;
flex-direction: column;
justify-content: flex-start;
}
.autofocus--content {
display: flex;
justify-content: center;
flex-direction: column;
align-items: center;
margin-top: 80px;
}
.autofocus--content p {
width: 70%;
text-align: center;
line-height: 22px;
}
.autofocus--content > h1 {
font-style: normal;
font-weight: 100;
font-size: 85px;
text-align: center;
line-height: 55px;
letter-spacing: -0.01em;
/* margin-top: 32px; */
margin-bottom: 24px;
width: 100%;
}
.autofocus--content > h1 strong {
font-weight: 700;
color: #be1921;
}
.autofocus--img {
position: absolute;
top: 50%;
transform: translateY(-50%);
right: 10%;
}
/* EXPLORE SECTION */
.explore--container {
display: flex;
align-items: flex-end;
justify-content: center;
align-content: flex-end;
flex-direction: column;
width: 100%;
}
.explore--content {
display: flex;
justify-content: center;
flex-direction: column;
align-items: flex-end;
margin-right: 10%;
}
.explore--content p {
width: 70%;
text-align: center;
line-height: 22px;
}
.explore--content > h1 {
font-style: normal;
font-weight: 100;
font-size: 85px;
text-align: center;
line-height: 75px;
letter-spacing: -0.01em;
/* margin-top: 32px; */
margin-bottom: 94px;
width: 100%;
width: 400px;
text-align: right;
}
.explore--content > h1 strong {
font-weight: 700;
color: #be1921;
}
.exit--container {
display: none;
width: 100%;
height: 100%;
align-content: center;
bottom: 60px;
align-items: flex-end;
position: fixed;
justify-content: center;
z-index: 3;
pointer-events: none;
}
.button--secondary {
border-radius: 58px;
font-weight: 700;
font-size: 10px;
display: flex;
align-items: center;
letter-spacing: -0.02em;
color: #3d3d3d;
transition: all 0.4s ease-in-out;
background-repeat: repeat-x repeat-y;
z-index: 2;
padding: 10px 30px;
border: 1px solid black;
text-transform: uppercase;
pointer-events: auto;
margin-right: 10px;
}
.button--secondary:hover {
cursor: pointer;
color: #ffffff;
background-color: #181818;
pointer-events: auto;
}
/* MOBILE ADJUSTMENTS */
@media (max-width: 600px) {
.hero--scroller--text {
display: none;
}
.header--menu {
display: none;
}
.header--container {
justify-content: center;
}
.hero--container {
display: flex;
align-content: center;
align-items: center;
flex-direction: column;
justify-content: center;
align-items: stretch;
width: 100% !important;
}
.hero--content {
width: 100%;
margin-left: 0;
position: absolute;
align-items: center;
display: flex;
flex-direction: column;
align-content: center;
/* opacity: 0; */
}
h1 {
left: unset;
width: unset;
height: unset;
font-size: 7em;
line-height: 1em;
letter-spacing: -0.01em;
margin-bottom: 30vh;
margin-top: -10px;
position: relative;
}
.hero--content > h2 {
text-align: center;
margin-bottom: 9px;
font-weight: 500;
font-size: 1em;
margin-right: 0;
margin-top: 40px;
}
.hero--content > p {
font-style: normal;
font-weight: 400;
font-size: 16px;
line-height: 22px;
letter-spacing: -0.04em;
margin-bottom: 30px;
width: 85%;
text-align: center;
}
.performance--container {
position: absolute;
display: flex;
flex-direction: column;
width: 100%;
justify-content: space-between;
align-items: center;
}
.performance--content {
width: 320px;
position: absolute;
margin-right: 0;
opacity: 0;
margin-top: 20%;
text-align: center;
}
.performance--content p {
display: none;
}
.performance--content img {
display: none;
}
.performance--content svg {
margin-top: 50vh;
}
.power--content {
margin-top: 100vh;
}
.power--content p {
width: 85%;
}
.power--content h1 {
font-size: 6em;
}
.power--container {
display: flex;
width: 80%;
align-items: flex-end;
flex-direction: column;
justify-content: space-around;
}
.power--features--img {
position: absolute;
top: 50%;
transform: translateY(-50%);
right: 2%;
}
.power--features--img img {
width: auto;
height: 220px;
}
.autofocus--content h1 {
font-size: em;
line-height: 1em;
margin-bottom: 60vh;
}
.autofocus--content {
margin-top: 30px;
}
.explore--container {
align-items: center;
align-content: flex-end;
justify-content: flex-end;
}
.explore--content {
align-items: center;
margin-right: 0;
margin-bottom: 40px;
}
.explore--content h1 {
text-align: center;
font-size: 3em;
line-height: 1em;
margin-bottom: 40px;
}
}
async function setupViewer() {
// Initialize the viewer
const viewer = new ViewerApp({
canvas: document.getElementById("webgi-canvas")
});
// Add some plugins
const manager = await viewer.addPlugin(AssetManagerPlugin);
scroller = await viewer.addPlugin(ScrollableCameraViewPlugin);
// Add all the plugins at once
await addBasePlugins(viewer);
// This must be called after adding any plugin that changes the render pipeline.
viewer.renderer.refreshPipeline();
// Load a 3d model.
await manager.addFromPath(
"https://3dassetsmaan.s3.ap-south-1.amazonaws.com/cameraScroll.glb"
);
const exploreView = document.querySelector(".explore");
const canvasView = document.getElementById("webgi-canvas");
const canvasContainer = document.getElementById("webgi-canvas-container");
const header = document.querySelector(".header");
const exitContainer = document.querySelector(".exit--container");
const bodyButton = document.querySelector(".button--body");
// EXPLORE ALL FEATURES EVENT
document.querySelector(".button-explore")?.addEventListener("click", () => {
exploreView.style.pointerEvents = "none";
exitContainer.style.opacity = "100";
exitContainer.style.display = "flex";
canvasView.style.pointerEvents = "all";
canvasContainer.style.zIndex = "1";
header.style.position = "fixed";
document.body.style.overflowY = "hidden";
document.body.style.cursor = "grab";
scroller.enabled = false;
let cameraViews = viewer.getPlugin(CameraViewPlugin);
cameraViews?.animateToView(cameraViews.camViews[4]);
});
document.querySelector(".button--exit")?.addEventListener("click", () => {
exploreView.style.pointerEvents = "all";
canvasView.style.pointerEvents = "none";
canvasContainer.style.zIndex = "unset";
document.body.style.overflowY = "auto";
exitContainer.style.display = "none";
header.style.position = "absolute";
scroller.enabled = true;
});
const lensObjectNames = [
"Circle002",
"+Sphere001001",
"new",
"+Plane008001",
"+SideButtons001",
"Rings2001",
"+Rings1001",
"+Circle003001",
"+Sphere003001",
"+Circle001001",
"Text001",
"Plane006001",
"+Plane005001",
"+Sphere001",
"+Cylinder001",
"+BODY044001"
];
const lensObjects = [];
for (const obj of lensObjectNames) {
const o = viewer.scene.findObjectsByName(obj)[0];
o.userData.__startPos = o.position.z;
o.userData.__deltaPos = -Math.pow(Math.abs(o.position.z) * 1.5, 1.25);
lensObjects.push(o);
}
let lensOnly = false;
bodyButton.addEventListener("click", () => {
if (lensOnly) {
setLensAppearance(true);
lensOnly = false;
bodyButton.innerHTML = "view body only";
} else {
setLensAppearance(false);
lensOnly = true;
bodyButton.innerHTML = "view with lens";
}
});
function setLensAppearance(_value) {
for (const o of lensObjects) {
o.visible = _value;
}
viewer.scene.setDirty({ sceneUpdate: true });
}
document.querySelector(".button-know-more")?.addEventListener("click", () => {
const element = document.querySelector("#view2");
window.scrollTo({
top: element?.getBoundingClientRect().top,
left: 0,
behavior: "smooth"
});
});
}
setupViewer();
Also see: Tab Triggers