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='containers'>Scroll Below</section>
<section class='containers second'>Not The end
<div class='contenitore-css-macbook'>
<!-- Add or remove "with-glare" class. Removing the glare makes the screen interactive -->
<div class="css-macbook">
<div class="macbook-display-position">
<div class="macbook-display">
<div class="macbook-screen-position">
<div class="macbook-screen">
<video allowfullscreen poster="//i.pinimg.com/originals/20/c6/c6/20c6c675b8570c4c0c64d115bf7b8180.gif" class="video-ux-design" playsinline="true" webkit-playsinline="true" muted="muted">
<source src="https://staging11.whynot.media/assets/uploads/2022/01/UI_UX_DESIGN_PROCESS-vimeo-93634945-http-1080p-sub-2.0-61.0.mp4" id="sample" type="video/mp4">
</video>
<!-- <img src="https://unsplash.imgix.net/photo-1418479631014-8cbf89db3431?fit=crop&fm=jpg&h=500&q=75&w=800" alt="example image" /> -->
<!-- Image By André Freitas from unsplash.com -->
<!-- Youtube - don't forget to remove glare -->
<!-- <iframe width="960" height="480" src="https://www.youtube.com/emacbooked/GUEZCxBcM78?rel=0&showinfo=0&iv_load_policy=3&controls=2" frameborder="0"></iframe> -->
<!-- Notice: Youtube has some toruble with emacbooked players and gives consol errors -->
<!-- Iframe, simple website - don't forget to remove glare -->
<!-- <iframe src="http://example.com" frameborder="0"></iframe> -->
</div>
</div>
</div>
</div>
<div class="macbook-body"></div>
<div class="macbook-bottom-cover"></div>
</div>
</div>
</section>
<section class='containers third'>The real end</section>
:root,body {
width: 100%;
height: auto;
margin: 0;
overflow-x: hidden;
}
.containers {
display: flex;
flex-direction: column;
width: 100%;
height: 100vh;
align-items: center;
justify-content: center;
align-content: center;
}
.containers:nth-of-type(1) {
background-color: lightgrey;
}
.containers.second {
background-color: orange;
}
.containers.third {
background-color: darkseagreen;
}
/*MACBOOK PRO*/
.contenitore-css-macbook{width:100%,overflow:hidden;height:50vh;margin-top:25vh;position:relative}
.css-macbook {
max-width: 100%; /* Set the desired maximum width of the macbook */
min-width: 99vmin; /* Set the desired minimum width of the macbook */
margin: 50px auto 0; /* Align mockup to center */
}
.css-macbook div {
box-sizing: border-box !important; /* Just in case */
}
/* Center the display */
.css-macbook .macbook-display-position {
width: 80%;
margin: 0 auto;
}
/* The display */
.css-macbook .macbook-display {
position: relative;
width: 100%;
height: 0;
padding-bottom: 65.9442%;
background: #373435;
-webkit-border-top-left-radius: 3.5% 5.3075%;
-moz-border-radius-topleft: 3.5% 5.3075%;
border-top-left-radius: 3.5% 5.3075%;
-webkit-border-top-right-radius: 3.5% 5.3075%;
-moz-border-radius-toptight: 3.5% 5.3075%;
border-top-right-radius: 3.5% 5.3075%;
outline:.5px solid #fff
}
/* Webcam */
/* Browser may not render a perfect circle */
.css-macbook .macbook-display:before {
content: '';
display: block;
position: absolute;
top: 3%;
left: 50%;
width: 1%;
height: 1.5164%;
margin-left: -0.5%;
border-radius: 50%;
background: #999;
opacity:0;
transition: opacity .3s ease
}
.acceso
.macbook-display:before{opacity:1;display:block}
/* Glare */
/* Browser may not render the top and right offset evenly */
.css-macbook .macbook-display:after {
content: '';
display: none;
position: absolute;
right: 0.4%;
top: 0.64%;
width: 62.5%;
height: 100%;
background: none; /* Hide the gradient on older browsers */
background: -moz-linear-gradient(55deg, rgba(0,0,0,0) 61%, rgba(255,255,255,0.05) 61%); /* FF3.6+ */
background: -webkit-linear-gradient(36deg, rgba(0,0,0,0) 61%, rgba(255,255,255,0.05) 61%); /* Chrome10+ and Safari5.1+ compute the degree differently */
background: -o-linear-gradient(55deg, rgba(0,0,0,0) 61%, rgba(255,255,255,0.05) 61%); /* Opera 11.10+ */
background: -ms-linear-gradient(55deg, rgba(0,0,0,0) 61%, rgba(255,255,255,0.05) 61%); /* IE10+ */
background: linear-gradient(55deg, rgba(0,0,0,0) 61%, rgba(255,255,255,0.05) 61%);
-webkit-border-top-right-radius: 5.3075%;
-moz-border-radius-toptight: 5.3075%;
border-top-right-radius: 5.3075%;
}
/* Only show glare, if the class is applied */
.css-macbook.with-glare .macbook-display:after { display: block; }
/* Position the screen and give make it the right size, ratio 16:10 */
.css-macbook .macbook-screen-position {
position: absolute;
top: 6.5%;
width: 93.2%;
left: 3.4%;
height: 0;
margin: 0;
padding-bottom: 58.25%; /* Ratio */
}
/* Give parent (this element) a "height", so that child elements can use height: 100%;*/
.css-macbook .macbook-screen {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
overflow: hidden;
background: #4b4b4d; /* bg color if content is not big enough, or rendering is off */
}
/* Image on the screen */
.css-macbook .macbook-screen img {
max-width: 100%;
height: auto;
}
/* Iframe on the screen */
.css-macbook .macbook-screen iframe {
width: 100%;
height: 100%;
border: 0;
}
/* Macbook body */
.css-macbook .macbook-body {
position: relative;
width: 100%;
height: 0;
padding-bottom: 2.3%;
background: #e6e7e8;
}
/* The groove */
.css-macbook .macbook-body:before {
content: '';
display: block;
position: absolute;
top: 0;
left: 50%;
width: 14.0740%;
height: 0;
padding-bottom: 1.4814%;
margin-left: -7.037%;
background: #a9abae;
-webkit-border-bottom-left-radius: 7.0370% 50%;
-moz-border-radius-bottomleft: 7.0370% 50%;
border-bottom-left-radius: 7.0370% 50%;
-webkit-border-bottom-right-radius: 7.0370% 50%;
-moz-border-radius-bottomtight: 7.0370% 50%;
border-bottom-right-radius: 7.0370% 50%;
}
/* Macbook bottom */
.css-macbook .macbook-bottom-cover {
width: 100%;
height: 0;
padding-bottom: 0.7407%;
background: #a9abae;
-webkit-border-bottom-left-radius: 12% 600%;
-moz-border-radius-bottomleft: 12% 600%;
border-bottom-left-radius: 12% 600%;
-webkit-border-bottom-right-radius: 12% 600%;
-moz-border-radius-bottomtight: 12% 600%;
border-bottom-right-radius: 12% 600%;
}
.video-ux-design {
width: 100%;
height: -webkit-fill-available;
object-fit: cover;
}
let videoElem = document.querySelector(".video-ux-design");
let src = videoElem.currentSrc || videoElem.src;
function once(a, b, c, d) {
var e = function () {
a.removeEventListener(b, e), c.apply(this, arguments);
};
return a.addEventListener(b, e, d), e;
}
once(document.documentElement, "touchstart", function () {
videoElem.play(), videoElem.pause();
}),
ScrollTrigger.create({
trigger: videoElem,
start: "top 70%",
end: "bottom",
markers: !0,
onEnter: () => videoElem.play(),
onEnterBack: () => videoElem.play(),
onLeave: () => videoElem.pause(),
onLeaveBack: () => videoElem.pause()
});
//videoElem.play();
let video_timeline = gsap.timeline({
scrollTrigger: {
trigger: ".second",
start: "top top",
markers: !0,
scrub: !0,
pin: !0,
toggleClass: "acceso"
}
});
video_timeline
.fromTo(
".macbook-display",
{
backgroundColor: "transparent",
outline: "none"
},
{
backgroundColor: "#373435",
duration: 5,
outline: ".5px solid #fff",
delay:10
}
)
.fromTo(
".css-macbook",
{
scale: 3.5
},
{
scale: 0.7,
duration: 10,
delay: 5
}
)
.fromTo(
".macbook-bottom-cover,.macbook-body",
{
autoAlpha: 0
},
{
autoAlpha: 1,
duration: 10
}
)
.fromTo(
".video-ux-design",
{
height: "100%",
objectFit: "cover"
},
{
height: "-webkit-fill-available",
duration: 5
}
)
.fromTo(
".macbook-screen",
{
backgroundColor: "transparent"
},
{
backgroundColor: "#4b4b4d",
duration: 2,
delay: 10
}
);
let video_tl = gsap.timeline({
defaults: {
duration: 1
},
scrollTrigger: {
trigger: videoElem,
start: "center center",
end: "+=600",
scrub: !0
}
});
once(videoElem, "loadedmetadata", () => {
video_tl.fromTo(
videoElem,
{
currentTime: 0.01
},
{
currentTime: videoElem.duration || 1
}
);
}),
setTimeout(function () {
window.fetch &&
fetch(src)
.then((a) => a.blob())
.then((a) => {
let b = URL.createObjectURL(a),
c = videoElem.currentTime;
once(document.documentElement, "touchstart", function () {
videoElem.play(), videoElem.pause();
}),
videoElem.setAttribute("src", b),
(videoElem.currentTime = c + 0.01);
});
}, 1e3);
Also see: Tab Triggers