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="conrner-nav"> <!-- START CORNER-NAV -->
<div id="print" class="media-type">
<a href="#">
<span id="title-print" class="title-print"><h2>print</h2></span>
</a>
<img src="https://dummyimage.com/700x500/ffffff/ebebeb.gif" alt="Print Portfolio Samples">
</div>
<!-- <div id="broadcast" class="media-type">
<a href="#">
<span id="title-broadcast"><h2>broadcast</h2></span>
</a>
<img src="https://dummyimage.com/700x500/ffffff/ebebeb.gif" alt="Broadcast Portfolio Samples">
</div>
<div id="outdoor" class="media-type">
<a href="#">
<span id="title-outdoor"><h2>outdoor</h2></span>
</a>
<img src="https://dummyimage.com/700x500/ffffff/ebebeb.gif" alt="Outdoor Portfolio Samples">
</div>
<div id="online" class="media-type">
<a href="#">
<span id="title-online"><h2>online</h2></span>
</a>
<img src="https://dummyimage.com/700x500/ffffff/ebebeb.gif" alt="Online Portfolio Samples">
</div> -->
</div> <!-- END CORNER-NAV -->
</div> <!-- END MAIN-STAGE -->
/* *********************** */
/* ***** Main Styles ***** */
/* *********************** */
body {
overflow: hidden;
margin: 0;
padding: 0;
}
#print {
visibility: hidden;
}
/* warm gray */
body {
background-color: #afafaf; }
/* div {
border: 1px solid red; }
span {
border: 1px solid green; } */
/* ********************************* */
/* ***** Section - ID - Styles ***** */
/* ********************************* */
#main-stage {
width: 100vw;
height: 100vh; }
.conrner-nav {
width: 100vw;
height: 100vh; }
.media-type {
position: fixed;
display: inline-block;
width: 50vw;
max-height: 50vh;
max-width: 50vh; }
.media-type img {
position: relative;
display: inline-block;
width: 50vw;
max-height: 50vh;
max-width: 50vh; }
@media all and (max-height: 400px) {
.media-type h2 {
font-size: 16px; }}
@media all and (max-width: 400px) {
.media-type h2 {
font-size: 16px; }}
@media all and (min-width: 1000px) and (min-height: 301px) {
.media-type,
.media-type img {
width: 35vw;
max-height: 35vh;
max-width: 35vh; }}
@media all and (max-height: 300px) {
.media-type,
.media-type img {
width: 60vw;
max-height: 60vh;
max-width: 60vh; }}
@media all and (min-width: 501px) and (max-width: 999px) and (min-height: 301px) {
.media-type,
.media-type img {
width: 40vw;
max-height: 40vh;
max-width: 40vh; }}
#print {
top: -8vh;
left: -8vh;
transform: rotate(8deg);
z-index: 2; }
#broadcast {
top: -8vh;
right: -8vh;
transform: rotate(-8deg);
z-index: 2; }
#outdoor {
bottom: -8vh;;
left: -8vh;
transform: rotate(-18deg);
z-index: 2; }
#online {
bottom: -8vh;
right: -8vh;
transform: rotate(10deg);
z-index: 2; }
/* ********************************* */
#title-print {
position: absolute;
bottom: 0;
right: 0;
padding-bottom: 4vh;
padding-right: 6vh;
z-index: 4; }
/* ********************************* */
#title-broadcast {
position: absolute;
left: 0;
bottom: 0;
padding-bottom: 4vh;
padding-left: 6vh;
z-index: 4; }
/* ********************************* */
#title-outdoor {
position: absolute;
top: 0;
right: 0;
padding-top: 4vh;*
padding-right: 6vh;
z-index: 4; }
/* ********************************* */
#title-online {
position: absolute;
top: 0;
left: 0;
padding-top: 4vh;
padding-left: 6vh;
z-index: 4; }
var vw = $(window).width();
var vh = $(window).height();
var print = $("#print");
var x = -vw / 2;
var y = -vh / 2;
var values = [
{ x: x, y: y },
{ x: x, y: 0 },
{ x: 0, y: 0 }
];
var bezier = {
values: values,
type: "quadratic"
};
TweenLite.set(print, {
autoAlpha: 1,
rotation: 8,
xPercent: -50,
yPercent: -50,
left: "50%",
top: "50%",
x: x,
y: y
});
var tl = new TimelineMax()
.to(print, 1, { bezier: bezier, scale: 3, rotation: 0 })
.reverse();
print.click(function() {
tl.reversed(!tl.reversed());
});
// Custom Javascript
/* ******* GreenSock GSAP Animation ******* */
// Variable to calculate browser window height and width
// var winWidth = window.innerWidth
// || document.documentElement.clientWidth
// || document.body.clientWidth;
// var winHeight = window.innerHeight
// || document.documentElement.clientHeight
// || document.body.clientHeight;
// var
// $print = $('#print'),
// $broadcast = $('#broadcast'),
// $outdoor = $('#outdoor'),
// $online = $('#online'),
// $titlePrint = $('#title-print'),
// $titleBroadcast = $('#title-broadcast'),
// $titleOutdoor = $('#title-outdoor'),
// $titleOnline = $('#title-online'),
// // Paths for Print
// path01Print = [{x:winWidth*.125, y:winHeight*.3}, {x:winWidth*.5, y:winHeight*.5}],
// path02Broadcast = [{x:winWidth*1.3, y:winHeight*.3}, {x:winWidth*1.5, y:winHeight*.5}],
// path03Outdoor = [{x:winWidth*1.3, y:winHeight*1.3}, {x:winWidth*1.5, y:winHeight*.5}],
// path04Online = [{x:winWidth*1.3, y:winHeight*1.3}, {x:winWidth*1.5, y:winHeight*1.5}],
// // Paths for Broadcast
// path05Print = [{x:winWidth* -.3, y:winHeight* -.3}, {x:winWidth* -.5, y:winHeight* -.5}],
// path06Broadcast = [{x:winWidth* -.125, y:winHeight*.3}, {x:winWidth* -.5, y:winHeight*.5}],
// path07Outdoor = [{x:winWidth* -.125, y:winHeight*1.3}, {x:winWidth* -.5, y:winHeight*1.5}],
// path08Online = [{x:winWidth* -.125, y:winHeight*1.3}, {x:winWidth* -.5, y:winHeight*1.5}],
// // Paths for Outdoor
// path09Print = [{x:winWidth*.125, y:winHeight* -.3}, {x:winWidth*.5, y:winHeight* -.5}],
// path10Broadcast = [{x:winWidth*1.3, y:winHeight* -.3}, {x:winWidth* -.5, y:winHeight*-1.5}],
// path11Outdoor = [{x:winWidth*.125, y:winHeight* -.125}, {x:winWidth* .5, y:winHeight* -.5}],
// path12Online = [{x:winWidth*1.3, y:winHeight* -.125}, {x:winWidth*1.5, y:winHeight* -.5}],
// // Paths for Online
// path13Print = [{x:winWidth* -.3, y:winHeight* -.3}, {x:winWidth* -.3, y:winHeight* -.3}],
// path14Broadcast = [{x:winWidth* -.3, y:winHeight* -.3}, {x:winWidth* -.3, y:winHeight* -.3}],
// path15Outdoor = [{x:winWidth* -.3, y:winHeight* .3}, {x:winWidth* -.3, y:winHeight* -.3}],
// path16Online = [{x:winWidth* -.3, y:winHeight* -.3}, {x:winWidth* -.5, y:winHeight* -.5}],
// // Timeline Names
// tlPrint = new TimelineMax({repeat: 0, yoyo: false, paused: true});
// tlBroadcast = new TimelineMax({repeat: 0, yoyo: false, paused: true});
// tlOutdoor = new TimelineMax({repeat: 0, yoyo: false, paused: true});
// tlOnline = new TimelineMax({repeat: 0, yoyo: false, paused: true});
// // Timeline Actions
// tlPrint.to($print, 1, {bezier:{curviness: 0.3, values:path01Print}, scale: 3, rotation: 0, top: "0vh", left: "0vh", ease:Power1.easeInOut}, 0)
// // Note I have CSS that moves the corner images off the browser edge based on "vh" percentage
// // If I delacare the "vh" in the timeline it moves it but it's still not centered
// //.to($print, 1, { transformOrigin: "center center", x: getMidX("#print"), y: getMidY("#print") }, 0)
// .to($titlePrint, .25, { opacity:0, display:"none" }, 0)
// .to($broadcast, 1, {bezier:{curviness: 0.3, values:path02Broadcast}, scale: 1, rotation: 0, ease:Power1.easeInOut}, 0)
// .to($outdoor, 1, {bezier:{curviness: 0.3, values:path03Outdoor}, scale: 1, rotation: 0, ease:Power1.easeInOut}, 0)
// .to($online, 1, {bezier:{curviness: 0.3, values:path04Online}, scale: 1, rotation: 0, ease:Power1.easeInOut}, 0)
// tlBroadcast.to($print, 1, {bezier:{curviness: 0.3, values:path05Print}, scale: 1, rotation: 0, ease:Power1.easeInOut}, 0)
// .to($broadcast, 1, {bezier:{curviness: 0.3, values:path06Broadcast}, scale: 3, rotation: 0, top: "0vh", right: "0vh", ease:Power1.easeInOut}, 0)
// //.to($broadcast, 1, { transformOrigin: "center center", x: getMidX("#broadcast"), y: getMidY("#broadcast") }, 0)
// .to($titleBroadcast, .25, { opacity:0, display:"none" }, 0)
// .to($outdoor, 1, {bezier:{curviness: 0.3, values:path07Outdoor}, scale: 1, rotation: 0, ease:Power1.easeInOut}, 0)
// .to($online, 1, {bezier:{curviness: 0.3, values:path08Online}, scale: 1, rotation: 0, ease:Power1.easeInOut}, 0)
// tlOutdoor.to($print, 1, {bezier:{curviness: 0.3, values:path09Print}, scale: 1, rotation: 0, ease:Power1.easeInOut}, 0)
// .to($broadcast, 1, {bezier:{curviness: 0.3, values:path10Broadcast}, scale: 1, rotation: 0, ease:Power1.easeInOut}, 0)
// .to($outdoor, 1, {bezier:{curviness: 0.3, values:path11Outdoor}, scale: 2, rotation: 0, bottom: "0vh", left: "0vh", ease:Power1.easeInOut}, 0)
// //.to($outdoor, 1, { transformOrigin: "center center", x: getMidX("#outdoor"), y: getMidY("#outdoor") }, 0)
// .to($titleOutdoor, .25, { opacity:0, display:"none" }, 0)
// .to($online, 1, {bezier:{curviness: 0.3, values:path12Online}, scale: 1, rotation: 0, ease:Power1.easeInOut}, 0)
// tlOnline.to($print, 1, {bezier:{curviness: 0.3, values:path13Print}, scale: 1, rotation: 0, ease:Power1.easeInOut}, 0)
// .to($broadcast, 1, {bezier:{curviness: 0.3, values:path14Broadcast}, scale: 1, rotation: 0, ease:Power1.easeInOut}, 0)
// .to($outdoor, 1, {bezier:{curviness: 0.3, values:path15Outdoor}, scale: 1, rotation: 0, ease:Power1.easeInOut}, 0)
// .to($online, 1, {bezier:{curviness: 0.3, values:path16Online}, scale: 3, rotation: 0, bottom: "0vh", right: "0vh", ease:Power1.easeInOut}, 0)
// //.to($online, 1, { transformOrigin: "center center", x: getMidX("#online"), y: getMidY("#online") }, 0)
// .to($titleOnline, .25, { opacity:0, display:"none" }, 0)
// // Play onClick
// $("#print").click(function() {
// tlPrint.play(); });
// $("#broadcast").click(function() {
// tlBroadcast.play(); });
// $("#outdoor").click(function() {
// tlOutdoor.play(); });
// $("#online").click(function() {
// tlOnline.play(); });
// Timeline Function to Center Objects - this moves it in the other direction but still not centered
// Greensock forum https://greensock.com/forums/topic/13542-positioning-relative-to-center/
// Greensock CodePen https://codepen.io/sgorneau/pen/bErqdm
// tl.to(".target", 1, { x: getMidX(".target")+20, y: getMidY(".target") } ); // This line of code had been placed in timelines above and commented out
/* function getMidX( obj ){
return ( $(obj).parent().width()/2 ) - $(obj).width()/2;
}
function getMidY( obj ){
return ( $(obj).parent().height()/2 ) - $(obj).height()/2;
} */
// I also looked at https://greensock.com/forums/topic/13802-update-height-value-dinamically-on-window-resize/
// CodePen https://codepen.io/celli/pen/XdWaRv - looking at for image size and the on window resize function
Also see: Tab Triggers