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="game-boy"></div>
.game-boy {
position: relative;
width: 242px;
height: 402px;
margin: 80px auto;
background-color: #D4D4D4;
border-radius: 12px 12px 55px 12px;
box-shadow: 0 0 3px 2px rgba(0,0,0,.1) inset;
background-image:
url(http://theorthodoxworks.com/demo/images/gameboy/text3.svg),
/*top*/
linear-gradient(to right, #C8C7C5, #C8C7C5),
linear-gradient(to bottom, #C8C7C5, #C8C7C5),
linear-gradient(to bottom, #C8C7C5, #C8C7C5),
linear-gradient(to bottom, #C8C7C5, #C8C7C5),
linear-gradient(to bottom, #C8C7C5, #C8C7C5),
radial-gradient(circle 4px, #C8C7C5 0%, #C8C7C5 99%, transparent),
linear-gradient(to right, #C8C7C5, #C8C7C5),
radial-gradient(circle 4px, #C8C7C5 0%, #C8C7C5 99%, transparent),
linear-gradient(to bottom, #C8C7C5, #C8C7C5),
/*bottom*/
linear-gradient(to bottom, #C8C7C5, #C8C7C5),
linear-gradient(to bottom, #C8C7C5, #C8C7C5),
linear-gradient(to bottom, #C8C7C5, #C8C7C5),
radial-gradient(circle 4px, #C8C7C5 0%, #C8C7C5 99%, transparent),
radial-gradient(circle 4px, #C8C7C5 0%, #C8C7C5 99%, transparent),
linear-gradient(to right, #C8C7C5, #C8C7C5),
/*cross button*/
radial-gradient(circle 6px, #626467 0%, #626467 99%, transparent),
radial-gradient(circle 4px, #4c4d4f 0%, #4c4d4f 99%, transparent),
radial-gradient(circle 4px, #4c4d4f 0%, #4c4d4f 99%, transparent),
radial-gradient(circle 4px, #4c4d4f 0%, #4c4d4f 99%, transparent),
radial-gradient(circle 4px, #4c4d4f 0%, #4c4d4f 99%, transparent),
linear-gradient(to bottom, #4c4d4f, #4c4d4f),
linear-gradient(to right, #4c4d4f, #4c4d4f),
linear-gradient(to right, #4c4d4f, #4c4d4f),
radial-gradient(circle 4px, #4c4d4f 0%, #4c4d4f 99%, transparent),
radial-gradient(circle 4px, #4c4d4f 0%, #4c4d4f 99%, transparent),
radial-gradient(circle 4px, #4c4d4f 0%, #4c4d4f 99%, transparent),
radial-gradient(circle 4px, #4c4d4f 0%, #4c4d4f 99%, transparent),
linear-gradient(to right, #4c4d4f, #4c4d4f),
linear-gradient(to bottom, #4c4d4f, #4c4d4f),
linear-gradient(to bottom, #4c4d4f, #4c4d4f),
radial-gradient(circle 38px, #C8C8CA 0%, #C8C8CA 99%, transparent),
/*circle button*/
radial-gradient(circle 15px, #a14270 0%, #a14270 99%, transparent),
radial-gradient(circle 15px, #a14270 0%, #a14270 99%, transparent),
radial-gradient(circle 20px, #C8C8CA 0%, #C8C8CA 99%, transparent),
radial-gradient(circle 20px, #C8C8CA 0%, #C8C8CA 99%, transparent),
linear-gradient(-24deg, #C8C8CA 50%, transparent 50%),
linear-gradient(-24deg, transparent 50%, #C8C8CA 50%),
linear-gradient(to right, #C8C8CA, #C8C8CA),
url(http://theorthodoxworks.com/demo/images/gameboy/text4.svg),
url(http://theorthodoxworks.com/demo/images/gameboy/text5.svg),
/*square button*/
radial-gradient(circle 4px, #9ca7ae 0%, #9ca7ae 99%, transparent),
radial-gradient(circle 4px, #9ca7ae 0%, #9ca7ae 99%, transparent),
linear-gradient(-24deg, #9ca7ae 50%, transparent 50%),
linear-gradient(-24deg, #9ca7ae 50%, transparent 50%),
linear-gradient(-24deg, transparent 50%, #9ca7ae 50%),
linear-gradient(-24deg, transparent 50%, #9ca7ae 50%),
radial-gradient(circle 7px, #C8C8CA 0%, #C8C8CA 99%, transparent),
radial-gradient(circle 7px, #C8C8CA 0%, #C8C8CA 99%, transparent),
linear-gradient(-24deg, #C8C8CA 50%, transparent 50%),
linear-gradient(-24deg, transparent 50%, #C8C8CA 50%),
url(http://theorthodoxworks.com/demo/images/gameboy/text6.svg),
radial-gradient(circle 4px, #9ca7ae 0%, #9ca7ae 99%, transparent),
radial-gradient(circle 4px, #9ca7ae 0%, #9ca7ae 99%, transparent),
linear-gradient(-24deg, #9ca7ae 50%, transparent 50%),
linear-gradient(-24deg, #9ca7ae 50%, transparent 50%),
linear-gradient(-24deg, transparent 50%, #9ca7ae 50%),
linear-gradient(-24deg, transparent 50%, #9ca7ae 50%),
radial-gradient(circle 7px, #C8C8CA 0%, #C8C8CA 99%, transparent),
radial-gradient(circle 7px, #C8C8CA 0%, #C8C8CA 99%, transparent),
linear-gradient(-24deg, #C8C8CA 50%, transparent 50%),
linear-gradient(-24deg, transparent 50%, #C8C8CA 50%),
url(http://theorthodoxworks.com/demo/images/gameboy/text7.svg),
/*speaker*/
radial-gradient(circle 2px, #A6A6A6 0%, #A6A6A6 99%, transparent),
radial-gradient(circle 2px, #A6A6A6 0%, #A6A6A6 99%, transparent),
linear-gradient(60deg, transparent 50%, #A6A6A6 50%),
linear-gradient(60deg, transparent 50%, #A6A6A6 50%),
linear-gradient(60deg, transparent 50%, #A6A6A6 50%),
linear-gradient(60deg, transparent 50%, #A6A6A6 50%),
linear-gradient(60deg, transparent 50%, #A6A6A6 50%),
linear-gradient(60deg, #A6A6A6 50%, transparent 50%),
linear-gradient(60deg, #A6A6A6 50%, transparent 50%),
linear-gradient(60deg, #A6A6A6 50%, transparent 50%),
linear-gradient(60deg, #A6A6A6 50%, transparent 50%),
linear-gradient(60deg, #A6A6A6 50%, transparent 50%),
linear-gradient(to right, #A6A6A6, #A6A6A6),
linear-gradient(to right, #A6A6A6, #A6A6A6),
linear-gradient(to right, #A6A6A6, #A6A6A6),
radial-gradient(circle 2px, #A6A6A6 0%, #A6A6A6 99%, transparent),
radial-gradient(circle 2px, #A6A6A6 0%, #A6A6A6 99%, transparent),
linear-gradient(60deg, transparent 50%, #A6A6A6 50%),
linear-gradient(60deg, transparent 50%, #A6A6A6 50%),
linear-gradient(60deg, transparent 50%, #A6A6A6 50%),
linear-gradient(60deg, transparent 50%, #A6A6A6 50%),
linear-gradient(60deg, transparent 50%, #A6A6A6 50%),
linear-gradient(60deg, #A6A6A6 50%, transparent 50%),
linear-gradient(60deg, #A6A6A6 50%, transparent 50%),
linear-gradient(60deg, #A6A6A6 50%, transparent 50%),
linear-gradient(60deg, #A6A6A6 50%, transparent 50%),
linear-gradient(60deg, #A6A6A6 50%, transparent 50%),
linear-gradient(to right, #A6A6A6, #A6A6A6),
linear-gradient(to right, #A6A6A6, #A6A6A6),
linear-gradient(to right, #A6A6A6, #A6A6A6),
radial-gradient(circle 2px, #A6A6A6 0%, #A6A6A6 99%, transparent),
radial-gradient(circle 2px, #A6A6A6 0%, #A6A6A6 99%, transparent),
linear-gradient(60deg, transparent 50%, #A6A6A6 50%),
linear-gradient(60deg, transparent 50%, #A6A6A6 50%),
linear-gradient(60deg, transparent 50%, #A6A6A6 50%),
linear-gradient(60deg, transparent 50%, #A6A6A6 50%),
linear-gradient(60deg, transparent 50%, #A6A6A6 50%),
linear-gradient(60deg, #A6A6A6 50%, transparent 50%),
linear-gradient(60deg, #A6A6A6 50%, transparent 50%),
linear-gradient(60deg, #A6A6A6 50%, transparent 50%),
linear-gradient(60deg, #A6A6A6 50%, transparent 50%),
linear-gradient(60deg, #A6A6A6 50%, transparent 50%),
linear-gradient(to right, #A6A6A6, #A6A6A6),
linear-gradient(to right, #A6A6A6, #A6A6A6),
linear-gradient(to right, #A6A6A6, #A6A6A6),
radial-gradient(circle 2px, #A6A6A6 0%, #A6A6A6 99%, transparent),
radial-gradient(circle 2px, #A6A6A6 0%, #A6A6A6 99%, transparent),
linear-gradient(60deg, transparent 50%, #A6A6A6 50%),
linear-gradient(60deg, transparent 50%, #A6A6A6 50%),
linear-gradient(60deg, transparent 50%, #A6A6A6 50%),
linear-gradient(60deg, transparent 50%, #A6A6A6 50%),
linear-gradient(60deg, transparent 50%, #A6A6A6 50%),
linear-gradient(60deg, #A6A6A6 50%, transparent 50%),
linear-gradient(60deg, #A6A6A6 50%, transparent 50%),
linear-gradient(60deg, #A6A6A6 50%, transparent 50%),
linear-gradient(60deg, #A6A6A6 50%, transparent 50%),
linear-gradient(60deg, #A6A6A6 50%, transparent 50%),
linear-gradient(to right, #A6A6A6, #A6A6A6),
linear-gradient(to right, #A6A6A6, #A6A6A6),
linear-gradient(to right, #A6A6A6, #A6A6A6),
radial-gradient(circle 2px, #A6A6A6 0%, #A6A6A6 99%, transparent),
radial-gradient(circle 2px, #A6A6A6 0%, #A6A6A6 99%, transparent),
linear-gradient(60deg, transparent 50%, #A6A6A6 50%),
linear-gradient(60deg, transparent 50%, #A6A6A6 50%),
linear-gradient(60deg, transparent 50%, #A6A6A6 50%),
linear-gradient(60deg, transparent 50%, #A6A6A6 50%),
linear-gradient(60deg, transparent 50%, #A6A6A6 50%),
linear-gradient(60deg, #A6A6A6 50%, transparent 50%),
linear-gradient(60deg, #A6A6A6 50%, transparent 50%),
linear-gradient(60deg, #A6A6A6 50%, transparent 50%),
linear-gradient(60deg, #A6A6A6 50%, transparent 50%),
linear-gradient(60deg, #A6A6A6 50%, transparent 50%),
linear-gradient(to right, #A6A6A6, #A6A6A6),
linear-gradient(to right, #A6A6A6, #A6A6A6),
linear-gradient(to right, #A6A6A6, #A6A6A6),
radial-gradient(circle 2px, #A6A6A6 0%, #A6A6A6 99%, transparent),
radial-gradient(circle 2px, #A6A6A6 0%, #A6A6A6 99%, transparent),
linear-gradient(60deg, transparent 50%, #A6A6A6 50%),
linear-gradient(60deg, transparent 50%, #A6A6A6 50%),
linear-gradient(60deg, transparent 50%, #A6A6A6 50%),
linear-gradient(60deg, transparent 50%, #A6A6A6 50%),
linear-gradient(60deg, transparent 50%, #A6A6A6 50%),
linear-gradient(60deg, #A6A6A6 50%, transparent 50%),
linear-gradient(60deg, #A6A6A6 50%, transparent 50%),
linear-gradient(60deg, #A6A6A6 50%, transparent 50%),
linear-gradient(60deg, #A6A6A6 50%, transparent 50%),
linear-gradient(60deg, #A6A6A6 50%, transparent 50%),
linear-gradient(to right, #A6A6A6, #A6A6A6),
linear-gradient(to right, #A6A6A6, #A6A6A6),
linear-gradient(to right, #A6A6A6, #A6A6A6),
linear-gradient(-28deg, rgba(0,0,0,.05) 50%, transparent 50%);
background-size:
134px 12px,
/*top*/
100% 4px,
4px 18px,
3px 8px,
3px 8px,
3px 8px,
8px 8px,
38px 8px,
8px 8px,
4px 20px,
/*bottom*/
3px 9px,
3px 9px,
3px 9px,
8px 8px,
8px 8px,
30px 8px,
/*cross button*/
13px 13px,
8px 8px,
8px 8px,
8px 8px,
8px 8px,
21px 52px,
13px 10px,
13px 10px,
8px 8px,
8px 8px,
8px 8px,
8px 8px,
51px 21px,
10px 13px,
10px 13px,
76px 76px,
/*circle button*/
30px 30px,
30px 30px,
40px 40px,
40px 40px,
46px 30px,
46px 30px,
15px 15px,
6px 6px,
6px 6px,
/*square button*/
10px 10px,
8px 8px,
18px 8px,
17px 8px,
18px 8px,
15px 8px,
16px 16px,
14px 14px,
23px 10px,
23px 13px,
30px 18px,
10px 10px,
8px 8px,
18px 8px,
17px 8px,
18px 8px,
15px 8px,
16px 16px,
14px 14px,
23px 10px,
23px 13px,
27px 17px,
/*speaker*/
4px 4px,4px 4px,
5px 8px,5px 8px,5px 8px,5px 8px,5px 8px,
5px 8px,5px 8px,5px 8px,5px 8px,5px 8px,
3px 3px,3px 3px,3px 3px,
4px 4px,4px 4px,
5px 8px,5px 8px,5px 8px,5px 8px,5px 8px,
5px 8px,5px 8px,5px 8px,5px 8px,5px 8px,
3px 3px,3px 3px,3px 3px,
4px 4px,4px 4px,
5px 8px,5px 8px,5px 8px,5px 8px,5px 8px,
5px 8px,5px 8px,5px 8px,5px 8px,5px 8px,
3px 3px,3px 3px,3px 3px,
4px 4px,4px 4px,
5px 8px,5px 8px,5px 8px,5px 8px,5px 8px,
5px 8px,5px 8px,5px 8px,5px 8px,5px 8px,
3px 3px,3px 3px,3px 3px,
4px 4px,4px 4px,
5px 8px,5px 8px,5px 8px,5px 8px,5px 8px,
5px 8px,5px 8px,5px 8px,5px 8px,5px 8px,
3px 3px,3px 3px,3px 3px,
4px 4px,4px 4px,
5px 8px,5px 8px,5px 8px,5px 8px,5px 8px,
5px 8px,5px 8px,5px 8px,5px 8px,5px 8px,
3px 3px,3px 3px,3px 3px,
150px 80px;
background-position:
16px 193px,
/*top*/
0 18px,
14px 0,
29px 0,
34px 0,
39px 0,
24px 6px,
29px 6px,
64px 6px,
220px 0,
/*bottom*/
103px 100%,
109px 100%,
115px 100%,
85px 387px,
115px 387px,
88px 387px,
/*cross button*/
40px 267px,
36px 243px,
49px 243px,
36px 295px,
49px 295px,
36px 247px,
40px 243px,
40px 293px,
17px 263px,
17px 276px,
68px 263px,
68px 276px,
21px 263px,
17px 267px,
66px 267px,
9px 235px,
/*circle button*/
151px 264px,
192px 246px,
146px 259px,
187px 241px,
155px 237px,
172px 273px,
179px 263px,
176px 298px,
215px 281px,
/*square button*/
69px 333px,
92px 324px,
71px 327px,
78px 324px,
75px 334px,
83px 331px,
66px 330px,
89px 321px,
70px 322px,
76px 333px,
74px 334px,
110px 333px,
133px 324px,
112px 327px,
119px 324px,
116px 334px,
124px 331px,
107px 330px,
130px 321px,
111px 322px,
117px 333px,
117px 334px,
/*speaker*/
148px 360px,165px 390px,
148px 363px,152px 370px,156px 377px,160px 384px,161px 386px,
151px 360px,155px 367px,159px 374px,163px 381px,164px 383px,
152px 367px,156px 374px,160px 381px,
160px 354px,177px 384px,
160px 357px,164px 364px,168px 371px,172px 378px,173px 380px,
163px 354px,167px 361px,171px 368px,175px 375px,176px 377px,
164px 361px,168px 368px,172px 375px,
172px 348px,189px 378px,
172px 351px,176px 358px,180px 365px,184px 372px,185px 374px,
175px 348px,179px 355px,183px 362px,187px 369px,188px 371px,
176px 355px,180px 362px,184px 369px,
184px 342px,201px 372px,
184px 345px,188px 352px,192px 359px,196px 366px,197px 368px,
187px 342px,191px 349px,195px 356px,199px 363px,200px 365px,
188px 349px,192px 356px,196px 363px,
196px 336px,213px 366px,
196px 339px,200px 346px,204px 353px,208px 360px,209px 362px,
199px 336px,203px 343px,207px 350px,211px 357px,212px 359px,
200px 343px,204px 350px,208px 357px,
208px 330px,225px 360px,
208px 333px,212px 340px,216px 347px,220px 354px,221px 356px,
211px 330px,215px 337px,219px 344px,223px 351px,224px 353px,
212px 337px,216px 344px,220px 351px,
120px 328px;
background-repeat: no-repeat;
}
.game-boy::before {
content: '';
position: absolute;
top: 34px;
left: 16px;
width: 206px;
height: 155px;
border-radius: 11px 11px 36px 11px;
background-color: #6E7882;
background-image:
/*screen*/
linear-gradient(to right, #5cb547, #5cb547),
linear-gradient(to right, #833675, #833675),
linear-gradient(to right, #301F56, #301F56),
linear-gradient(to right, #833675, #833675),
linear-gradient(to right, #301F56, #301F56),
radial-gradient(circle 3px, #e73424 0%, #e73424 99%, transparent),
url(http://theorthodoxworks.com/demo/images/gameboy/text1.svg),
url(http://theorthodoxworks.com/demo/images/gameboy/text2.svg);
background-size:
/*screen*/
127px 116px,
54px 1px,
54px 1px,
23px 1px,
23px 1px,
6px 6px,
101px 5px,
26px 5px;
background-position:
/*screen*/
39px 19px,
9px 7px,
9px 11px,
174px 7px,
174px 11px,
13px 55px,
69px 7px,
7px 66px;
background-repeat: no-repeat;
}
Also see: Tab Triggers