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 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.
.header
.large-title
h1 Style Guideline
hr
.intro Follow this style guideline to make sure your website is in a way of consistency.
img.face(src="https://i.imgur.com/WW0mNDi.png", alt="")
.font
.font1
.small-title
h5 Title Font:
.br Roboto Slab
.display.slab Aa
span.font2
.small-title
h5 Paragraph Font:
.br Source Serif Pro
.display.serif Aa
.size1
.large
.small-title
h5 Big Title:
.br 40px
.size-display
h2 The quick brown fox jumps over the lazy dog.
span.medium
.small-title
h5 Medium Title:
.br 30px
.size-display
h3 The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
.size2
.small
.small-title
h5 Small Title:
.br 20px
.size-display
h4 The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
span.paragraph
.small-title
h5 Paragraph:
.br 15px
.size-display
p The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
.color-button
.color
.small-title
h5 Color System
.whole-color-block
.color-block
.color-number.color1 #ADAB13
.chip.chip1
.color-text BRAND
.color-block
.color-number.color2 #0E2A9C
.chip.chip2
.color-text BRAND
.color-block
.color-number.color3 #2B2B2B
.chip.chip3
.color-text BRAND
span.button
.small-title
h5 Button
.whole-button-block
.button-block1
.button-type1-color1 Click
.button-type1-color2 Click
.button-type1-color3 Click
.button-block2
.button-type2-color1 Click
.button-type2-color2 Click
.button-type2-color3 Click
@mixin size($w,$h)
width: $w
height: $h
@mixin center
position: absolute
left: 50%
top: 50%
transform: translateX(-50%) translateY(-50%)
@mixin center-horizontal
position: absolute
left: 50%
transform: translateX(-50%)
@mixin center-vertical
position: absolute
top: 50%
transform: translateY(-50%)
$title-font: Roboto Slab
$paragraph-font: Source Serif Pro
$font-size: 10px
$color1: #ADAB13
$color2: #0E2A9C
$color3: #2B2B2B
*
// border: solid 1px
box-sizing: border-box
padding: 0px
margin: 0px
body, html
min-width: 831px
color: $color3
.header
+size(100%,300px)
position: relative
.font
+size(100%,300px)
background-color: $color1
color: $color2
.font1, .font2
+size(50%,300px)
display: inline-block
position: relative
.size1, .size2
+size(100%,300px)
.size1
background-color: $color2
color: $color1
.size2
background-color: $color3
color: white
.large, .medium, .small, .paragraph
+size(50%,300px)
display: inline-block
position: relative
.color-button
+size(100%,300px)
.color, .button
+size(50%,300px)
display: inline-block
position: relative
.large-title
font-family: $title-font
position: absolute
top: 25px
margin-left: 25px
hr
border: 0
height: 5px
background-color: $color3
.intro
position: absolute
top: 150px
left: 25px
font-family: $paragraph-font
font-size: 1.5*$font-size
.face
position: absolute
bottom: 25px
right: 25px
width: 60px
.small-title
position: absolute
top: 25px
left: 25px
font-family: $title-font
.display
+center-horizontal
bottom: 10%
font-size: 17*$font-size
font-weight: 900
.slab
font-family: $title-font
.serif
font-family: $paragraph-font
.size-display
+size(100%,auto)
+center-horizontal
padding: 25px
bottom: 10%
position: absolute
font-family: $title-font
.whole-color-block
+size(auto,auto)
position: relative
top: 87px
.color-block
+size(100%,50px)
position: relative
.chip
+center-vertical
+size(100px,40px)
left: 25%
font-family: $title-font
.chip1
background-color: $color1
color: $color2
.chip2
background-color: $color2
color: $color1
.chip3
background-color: $color3
color: white
.color-text
+center
text-align: center
.color-number
+center-vertical
+size(100px,auto)
right: 25%
font-family: $title-font
text-align: center
.color1
color: $color1
.color2
color: $color2
.color3
color: $color3
.whole-button-block
+size(auto,auto)
position: relative
top: 87px
.button-block1, .button-block2
+size(100%,75px)
position: relative
font-family: $title-font
font-size: 30px
color: $color3
text-align: center
.button-block2
color: white
font-size: 2*$font-size
.button-type1-color1
+center-vertical
+size(80px,40px)
border-bottom: solid 3px $color1
left: 15%
.button-type1-color2
+center
+size(80px,40px)
border-bottom: solid 3px $color2
.button-type1-color3
+center-vertical
+size(80px,40px)
border-bottom: solid 3px $color3
right: 15%
.button-type2-color1
+center-vertical
+size(80px,auto)
background-color: $color1
left: 15%
.button-type2-color2
+center
+size(80px,auto)
background-color: $color2
.button-type2-color3
+center-vertical
+size(80px,auto)
background-color: $color3
right: 15%
h1
font-size: 6*$font-size
h2
font-size: 4*$font-size
h3
font-size: 3*$font-size
h4
font-size: 2*$font-size
font-weight: 500
h5
font-size: 1.2*$font-size
p
font-size: 1.5*$font-size
font-family: $paragraph-font
Also see: Tab Triggers