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 URL's added here will be added as <link>
s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.
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.
If the stylesheet 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 CSS 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.
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 Skypack, which makes packages from npm not only available on a CDN, but prepares them for native JavaScript ES6 import
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="container">
<div class="tv">
<div class="screen">
<svg class="dvd" xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="0 0 210 107"><title>DVD logo</title><path d="M118.895,20.346c0,0-13.743,16.922-13.04,18.001c0.975-1.079-4.934-18.186-4.934-18.186s-1.233-3.597-5.102-15.387H81.81H47.812H22.175l-2.56,11.068h19.299h4.579c12.415,0,19.995,5.132,17.878,14.225c-2.287,9.901-13.123,14.128-24.665,14.128H32.39l5.552-24.208H18.647l-8.192,35.368h27.398c20.612,0,40.166-11.067,43.692-25.288c0.617-2.614,0.53-9.185-1.054-13.053c0-0.093-0.091-0.271-0.178-0.537c-0.087-0.093-0.178-0.722,0.178-0.814c0.172-0.092,0.525,0.271,0.525,0.358c0,0,0.179,0.456,0.351,0.813l17.44,50.315l44.404-51.216l18.761-0.092h4.579c12.424,0,20.09,5.132,17.969,14.225c-2.29,9.901-13.205,14.128-24.75,14.128h-4.405L161,19.987h-19.287l-8.198,35.368h27.398c20.611,0,40.343-11.067,43.604-25.288c3.347-14.225-11.101-25.293-31.89-25.293h-18.143h-22.727C120.923,17.823,118.895,20.346,118.895,20.346L118.895,20.346z"/><path d="M99.424,67.329C47.281,67.329,5,73.449,5,81.012c0,7.558,42.281,13.678,94.424,13.678c52.239,0,94.524-6.12,94.524-13.678C193.949,73.449,151.664,67.329,99.424,67.329z M96.078,85.873c-11.98,0-21.58-2.072-21.58-4.595c0-2.523,9.599-4.59,21.58-4.59c11.888,0,21.498,2.066,21.498,4.59C117.576,83.801,107.966,85.873,96.078,85.873z"/><polygon points="182.843,94.635 182.843,93.653 177.098,93.653 176.859,94.635 179.251,94.635 178.286,102.226 179.49,102.226 180.445,94.635 182.843,94.635"/><polygon points="191.453,102.226 191.453,93.653 190.504,93.653 187.384,99.534 185.968,93.653 185.013,93.653 182.36,102.226 183.337,102.226 185.475,95.617 186.917,102.226 190.276,95.617 190.504,102.226 191.453,102.226"/></svg>
</div>
<div class="rca">
<div class="rca-y"></div>
<div class="rca-w"></div>
<div class="rca-r"></div>
</div>
<div>
<svg class="logo" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" version="1.1" viewBox="0 0 2667 2667">
<defs>
<linearGradient id="grad1" x1="0%" y1="0%" x2="100%" y2="0%">
<stop offset="0%" style="stop-color:rgb(200,200,200);stop-opacity:1" />
<stop offset="100%" style="stop-color:rgb(255,255,255);stop-opacity:1" />
</linearGradient>
</defs>
<g id="Layer_x0020_1">
<metadata id="CorelCorpID_0Corel-Layer"/>
<path d="M1717 1333l7 -15 -9 0 0 0c-140,1 -423,48 -531,71l0 0 16 -27 -393 45 195 -204 -56 0 325 -316 -332 38 21 -44 -333 45 -13 -60 -229 248 0 0c0,0 210,-33 267,-37l0 0 -35 46 16 -3 0 0c33,-7 165,-26 220,-30l0 0 -370 268 0 0c0,0 80,-7 102,-6 -83,63 -502,411 -528,439 0,0 757,-251 885,-267l0 0 -26 36 17 -6 0 0c98,-32 454,-125 592,-133l0 0 -21 32 15 -4 0 0c199,-53 673,-139 1056,-151 -190,-36 -772,26 -858,37l0 0z"/>
<path d="M527 1341l364 -263 -17 -1 0 0c-31,-1 -173,19 -227,29l0 0 31 -41 0 0c0,0 -202,22 -258,31l0 0 189 -204 10 48 322 -43 -16 34 -5 10 11 -1 308 -36 -320 312 57 0 -199 208 403 -46 -17 30 13 -3 0 0c94,-21 384,-70 533,-74l0 0 -8 17 11 -1 0 0c6,-1 523,-65 781,-53 -357,18 -766,89 -958,139l0 0 17 -25 -11 0 0 0c-122,4 -468,92 -589,129l0 0 19 -26 -12 0 0 0c-85,0 -690,192 -842,248 101,-88 467,-390 493,-406l0 0 14 -9 -17 -2 0 0c-16,-2 -47,-2 -76,0l0 0z"/>
<polygon points="1155,1034 1378,1020 1332,1109 1233,1115 1215,1148 1314,1142 1285,1197 1185,1204 1169,1237 1269,1229 1219,1325 978,1349 1155,1034 "/>
<polygon points="1286,1317 1444,1015 1559,1008 1585,1115 1643,1003 1775,996 1622,1288 1522,1297 1489,1173 1419,1306 1286,1317 "/>
<polygon class="fil1" points="1686,1283 1839,991 1971,983 1818,1275 1686,1283 "/>
<path d="M2011 981c34,-1 183,-10 253,-9l0 0 -56 107 -61 1 -95 182 -133 6 98 -184 -62 1 56 -104 0 0z"/>
<polygon points="2145,1254 2294,972 2422,972 2374,1062 2444,1062 2492,972 2620,972 2473,1250 2344,1252 2397,1154 2325,1154 2274,1253 2145,1254 "/>
<path d="M1469 1468c-7,-7 -16,-11 -26,-11 -10,0 -19,4 -26,11 -7,7 -11,16 -11,26 0,10 4,19 11,26 7,7 16,11 26,11 10,0 19,-4 26,-11 7,-7 11,-16 11,-26 0,-10 -4,-19 -11,-26l0 0zm-4 49c-6,6 -14,9 -23,9 -9,0 -16,-3 -23,-9 -6,-6 -9,-14 -9,-23 0,-9 3,-16 9,-23 6,-6 14,-9 23,-9 9,0 16,3 23,9 6,6 9,14 9,23 0,9 -3,16 -9,23l0 0z"/>
<path d="M1460 1514c0,0 0,-1 0,-2 0,-1 0,-2 0,-3l0 -3c0,-2 -1,-4 -2,-6 -1,-2 -4,-3 -7,-4 3,0 5,-1 6,-2 3,-2 4,-4 4,-8 0,-5 -2,-9 -6,-10 -2,-1 -6,-1 -11,-1l-14 0 0 41 7 0 0 -16 6 0 0 0c4,0 6,0 8,1 3,2 4,5 4,9l0 3 0 1 0 0c0,0 0,0 0,0 0,0 0,0 0,0l7 0 0 -1 0 0zm-11 -21c-2,1 -4,1 -7,1l-6 0 0 -15 6 0 0 0c4,0 7,0 9,2 2,1 3,3 3,6 0,3 -1,5 -4,6l0 0z"/>
</g>
</svg>
</div>
</div>
</div>
$bg: papayaWhip;
$primary: steelBlue;
$scale: 1.5;
$tv-w: 340px;
$tv-h: 330px;
$tv-p: 20px;
$logo-w: 95px;
$logo-h: 54px;
$logo-duration: 6s;
html, body {height: 100%;}
body {
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
background: $bg;
perspective: 400px;
}
.container {
position: relative;
//border: dashed 2px red;
}
.top {
position: absolute;
left: 0; right: 0; top: -50%;
width: $tv-w;
height: 330px;
background: #222;
}
.tv {
background: #333;
background:
radial-gradient(at center, rgba(255,255,255,0.4) 40px, transparent 90%),
// linear-gradient(to bottom, rgba(0,0,0,0.2) 20%, rgba(255,255,255,0.2) 50%, transparent 80%),
#111;
width: calc(#{$tv-w} - (#{$tv-p}*2));
height: 330px;
padding: $tv-p;
border-top-left-radius: 40% 7px;
border-top-right-radius: 40% 7px;
border-bottom-left-radius: 10px;
border-bottom-right-radius: 10px;
transform: scale(#{$scale});
}
.screen {
position: relative;
width: 100%;
height: 273px;
margin: 0 auto;
background:
radial-gradient(at 50% 70%, rgba(255,255,255,0.25) 40px, transparent 90%),
#333;
border-radius: 50% / 4%;
box-shadow:
inset 0 0 0 5px rgba(0,0,0,0.3),
inset -3px 0 5px -2px rgba(255,255,255,0.1),
inset 3px 0 5px -2px rgba(255,255,255,0.1);
}
.rca {
display: flex;
justify-content: space-between;
width: 36px;
margin: 10px 0 30px;
padding: 3px;
background: #111;
border-radius: 20px;
box-shadow: inset 0 0 15px rgba(0,0,0,0.5);
& > * {
width: 10px;
height: 10px;
border-radius: 50%;
}
.rca-y {
background: radial-gradient(at center, #000 0%, #000 30%, yellow 30%, yellow 60%, #ddd 60%, #ddd 100%);
}
.rca-w {
background: radial-gradient(at center, #000 0%, #000 30%, white 30%, white 60%, #ddd 60%, #ddd 100%);
}
.rca-r {
background: radial-gradient(at center, #000 0%, #000 30%, red 30%, red 60%, #ddd 60%, #ddd 100%);
}
}
.dvd {
position: absolute;
width: $logo-w;
height: $logo-h;
top: 7px;
animation:
slideVert #{$logo-duration * 1.1} linear alternate infinite,
slideHori #{$logo-duration * 0.78} linear alternate infinite,
colorChange #{$logo-duration * 5} linear infinite;
}
.logo {
position: absolute;
bottom: 20px; left:0; right: 0;
margin: 0 auto;
//border: dashed 1px red;
width: 50px;
fill: url(#grad1);
}
@keyframes slideVert {
from {top: 7px;}
to {top: calc(100% - #{$logo-h});}
}
@keyframes slideHori {
from {left: 0;}
to {left: calc(100% - #{$logo-w});}
}
@keyframes colorChange {
0% {fill: #ff2400;}
11.11% {fill: #e81d1d;}
22.22% {fill: #e8b71d;}
33.33% {fill: #e3e81d;}
44.44% {fill: #1de840;}
55.55% {fill: #1ddde8;}
66.66% {fill: #2b1de8;}
77.77% {fill: #dd00f3;}
88.88% {fill: #dd00f3;}
100% {fill: #ff2400;}
}
Also see: Tab Triggers