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.
form.charsheet
header
section.charname
label for="charname" Character Name
input name="charname" placeholder="Thoradin Fireforge"
section.misc
ul
li
label for="classlevel"Class & Level
input name="classlevel" placeholder="Paladin 2"
li
label for="background" Background
input name="background" placeholder="Acolyte"
li
label for="playername" Player Name
<input name="playername" placeholder="Player McPlayerface">
li
label for="race" Race
input name="race" placeholder="Half-elf"
li
label for="alignment"Alignment
input name="alignment" placeholder="Lawful Good"
li
label for="experiencepoints" Experience Points
input name="experiencepoints" placeholder="3240"
main
section
section.attributes
div.scores
ul
- for attr in [ "Strength", "Dexterity", "Constitution", "Wisdom", "Intelligence", "Charisma" ] do
li
.score
label for="#{attr}score" #{attr}
input name="#{attr}score" placeholder="10"
.modifier
input name="#{attr}mod" placeholder="+0"
div.attr-applications
div.inspiration.box
div.label-container
label for="inspiration" Inspiration
input name="inspiration" type="checkbox"
div.proficiencybonus.box
div.label-container
label for="proficiencybonus" Proficiency Bonus
input name="proficiencybonus" placeholder="+2"
div.saves.list-section.box
ul
- for attr in [ "Strength", "Dexterity", "Constitution", "Wisdom", "Intelligence", "Charisma" ] do
li
label for="#{attr}-save" #{attr}
input name="#{attr}-save" type="text" placeholder="+0"
input name="#{attr}-save-prof" type="checkbox"
div.label Saving Throws
div.skills.list-section.box
ul
- for skill in [ \
{ "name" => "Acrobatics", "attr" => "Dex"}, \
{ "name" => "Animal Handling", "attr" => "Wis"}, \
{ "name" => "Arcana", "attr" => "Int"}, \
{ "name" => "Athletics", "attr" => "Str"}, \
{ "name" => "Deception", "attr" => "Cha"}, \
{ "name" => "History", "attr" => "Int"}, \
{ "name" => "Insight", "attr" => "Wis"}, \
{ "name" => "Intimidation", "attr" => "Cha"}, \
{ "name" => "Investigation", "attr" => "Int"}, \
{ "name" => "Medicine", "attr" => "Wis"}, \
{ "name" => "Nature", "attr" => "Int"}, \
{ "name" => "Perception", "attr" => "Wis"}, \
{ "name" => "Performance", "attr" => "Cha"}, \
{ "name" => "Persuasion", "attr" => "Cha"}, \
{ "name" => "Religion", "attr" => "Int"}, \
{ "name" => "Sleight of Hand", "attr" => "Dex"}, \
{ "name" => "Stealth", "attr" => "Dex"}, \
{ "name" => "Survival", "attr" => "Wis"}, \
] do
li
label for="#{skill["name"]}" #{skill["name"]} <span class="skill">(#{skill["attr"]})</span>
input name="#{skill["name"]}" type="text" placeholder="+0"
input name="#{skill["name"]}-prof" type="checkbox"
div.label Skills
div.passive-perception.box
div.label-container
label for="passiveperception" Passive Wisdom (Perception)
input name="passiveperception" placeholder="10"
div.otherprofs.box.textblock
label for="otherprofs" Other Proficiencies and Languages
textarea name="otherprofs"
section
section.combat
div.armorclass
div
label for="ac" Armor Class
input type="text" name="ac" placeholder="10"
div.initiative
div
label for="initiative" Initiative
input type="text" name="initiative" placeholder="+0"
div.speed
div
label for="speed" Speed
input type="text" name="speed" placeholder="30"
div.hp
div.regular
div.max
label for="maxhp" Hit Point Maximum
input type="text" name="maxhp" placeholder="10"
div.current
label for="currenthp" Current Hit Points
input type="text" name="currenthp"
div.temporary
label for="temphp" Temporary Hit Points
input type="text" name="temphp"
div.hitdice
div
div.total
label for="totalhd" Total
input type="text" name="totalhd" placeholder="2d10"
div.remaining
label for="remaininghd" Hit Dice
input type="text" name="remaininghd"
div.deathsaves
div
div.label
label Death Saves
div.marks
div.deathsuccesses
label Successes
div.bubbles
- for i in [1,2,3] do
input type="checkbox" name="deathsuccess#{i}"
div.deathfails
label Failures
div.bubbles
- for i in [1,2,3] do
input type="checkbox" name="deathfail#{i}"
section.attacksandspellcasting
div
label Attacks & Spellcasting
table
thead
tr
th Name
th Atk Bonus
th Damage/Type
tbody
-for i in [1,2,3] do
tr
td
input type="text" name="atkname#{i}"
td
input type="text" name="atkbonus#{i}"
td
input type="text" name="atkdamage#{i}"
textarea
section.equipment
div
label Equipment
div.money
ul
- for type in ["cp", "sp", "ep", "gp", "pp"] do
li
label for="#{type}" #{type}
input name="#{type}"
textarea placeholder="Equipment list here"
section
section.flavor
div.personality
label for="personality" Personality
textarea name="personality"
div.ideals
label for="ideals" Ideals
textarea name="ideals"
div.bonds
label for="bonds" Bonds
textarea name="bonds"
div.flaws
label for="flaws" Flaws
textarea name="flaws"
section.features
div
label for="features" Features & Traits
textarea name="features"
$sheet-width: 800px
$bg: white
$faded: #ddd
$faded-light: #eee
$faded-dark: #bbb
$radius: 10px
$gutter: 10px
$bubble-size: 10px
$small-box-width: 30px
$large-box-width: 70px
.red
background: red
.blue
background: blue
.hide
display: none !important
textarea
font-size: 12px
text-align: left
width: calc(100% - #{$radius*2} - 2px)
border-radius: $radius
padding: $radius
resize: none
overflow: hidden
height: 15em
input[type="checkbox"]
cursor: pointer
div.box
margin-top: $gutter
form.charsheet
width: $sheet-width
right: 0
left: 0
margin-right: auto
margin-left: auto
margin-top: 10px
div.textblock
display: flex
flex-direction: column-reverse
width: 100%
align-items: center
label
text-align: center
border: 1px solid black
border-top: 0
font-size: 10px
width: calc(100% - #{$radius*2} - 2px)
border-radius: 0 0 $radius $radius
padding: 4px 0
font-weight: bold
textarea
border: 1px solid black
ul
margin: 0
padding: 0
li
list-style-image: none
display: block
::placeholder
color: $faded-dark
label
text-transform: uppercase
font-size: 12px
header
display: flex
align-contents: stretch
align-items: stretch
section.charname
border: 1px solid black
border-right: 0
border-radius: $radius 0 0 $radius
padding: 5px 0
background-color: $faded-light
width: 30%
display: flex
flex-direction: column-reverse
bottom: 0
top: 0
margin: auto
input
padding: 0.5em
margin: 5px
border: 0
label
padding-left: 1em
section.misc
width: 70%
border: 1px solid black
border-radius: $radius
padding-left: 1em
padding-right: 1em
ul
padding: 10px 0px 5px 0px
display: flex
flex-wrap: wrap
li
width: 33.33333%
display: flex
flex-direction: column-reverse
label
margin-bottom: 5px
input
border: 0
border-bottom: 1px solid $faded
main
display: flex
justify-content: space-between
margin-top: $gutter*2
div.label-container
position: relative
width: 100%
height: $small-box-width - $radius - 2px
margin-top: $radius / 2 + 1px
border: 1px solid black
border-left: 0
text-align: center
> label
position: absolute
left: 0
top: 1px
transform: translate(0%, 50%)
width: 100%
font-size: 8px
> section
width: 32%
display: flex
flex-direction: column
section.attributes
$attr-width: 70px
$attr-height: 80px
$attr-gutter: 31px
width: 100%
display: flex
flex-direction: row
justify-content: space-between
div.scores
width: $attr-width + $attr-gutter
background-color: $faded-dark
border-radius: $radius
padding-bottom: $gutter / 2
label
font-size: 8px
font-weight: bold
ul
display: flex
flex-direction: column
justify-content: space-around
align-items: center
height: 100%
li
height: $attr-height
width: $attr-width
background-color: $bg
border: 1px solid black
text-align: center
display: flex
flex-direction: column
border-radius: $radius
input
width: 100%
padding: 0
border: 0
div.score
input
text-align: center
font-size: 40px
padding: 2px 0px 0px 0px
background: $bg
div.modifier
margin-top: 3px
input
background: $bg
width: $radius*3
height: $radius*2
border: 1px inset black
border-radius: $radius*2
margin: -1px
text-align: center
div.attr-applications
div.inspiration
display: flex
flex-direction: row-reverse
justify-content: flex-end
input
appearance: none
border: 1px solid black
padding: $small-box-width / 2
border-radius: $radius
div.proficiencybonus
display: flex
flex-direction: row-reverse
justify-content: flex-end
input
width: $small-box-width
height: $small-box-width - 2
border: 1px solid black
text-align: center
border-radius: $radius
div.list-section
border: 1px solid black
border-radius: $radius
padding: $gutter $gutter/2
div.label
margin-top: $gutter
margin-bottom: $gutter / 4
text-align: center
text-transform: uppercase
font-size: 10px
font-weight: bold
ul li
display: flex
align-items: center
> *
margin-left: $gutter / 2
label
text-transform: none
font-size: 8px
text-align: left
order: 3
span.skill
color: $faded-dark
input
&[type="text"]
width: 30px
font-size: 12px
text-align: center
border: 0
border-bottom: 1px solid black
order: 2
&[type="checkbox"]
appearance: none
width: $bubble-size
height: $bubble-size
border: 1px solid black
border-radius: $bubble-size
order: 1
&:checked
background-color: black
div.passive-perception
display: flex
flex-direction: row-reverse
justify-content: flex-end
input
width: $small-box-width
height: $small-box-width - 2px
text-align: center
border: 1px solid black
border-radius: $radius
div.otherprofs textarea
height: 26em
section.combat
background-color: $faded-light
display: flex
flex-wrap: wrap
border-radius: $radius
> div
overflow: hidden
&.armorclass, &.initiative, &.speed
flex-basis: 33.333%
> div
display: flex
flex-direction: column-reverse
align-items: center
margin-top: $gutter
label
font-size: 8px
width: $large-box-width - $radius*2
border: 1px solid black
border-top: 0
background-color: $bg
text-align: center
padding-top: 5px
padding-bottom: 5px
border-radius: 0 0 $radius $radius
input
height: $large-box-width
width: $large-box-width
border-radius: $radius
border: 1px solid black
text-align: center
font-size: 30px
&.hp
flex-basis: 100%
> div.regular
background-color: $bg
border: 1px solid black
margin: $gutter
margin-bottom: $gutter / 2
border-radius: $radius $radius 0 0
> div.max
display: flex
justify-content: space-around
align-items: baseline
label
font-size: 10px
text-transform: none
color: $faded-dark
input
width: 40%
border: 0
border-bottom: 1px solid $faded
font-size: 12px
text-align: center
> div.current
display: flex
flex-direction: column-reverse
input
border: 0
width: 100%
padding: 1em 0
font-size: 20px
text-align: center
label
font-size: 10px
padding-bottom: 5px
text-align: center
font-weight: bold
> div.temporary
margin: $gutter
margin-top: 0
border: 1px solid black
border-radius: 0 0 $radius $radius
display: flex
flex-direction: column-reverse
background-color: $bg
input
padding: 1em 0
font-size: 20px
border: 0
text-align: center
label
font-size: 10px
padding-bottom: 5px
text-align: center
font-weight: bold
&.hitdice, &.deathsaves
$height: 100px
flex: 1 50%
height: $height
> div
height: $height - $gutter*2
&.hitdice > div
background-color: $bg
margin: $gutter
border: 1px solid black
border-radius: $radius
display: flex
flex-direction: column
> div.total
display: flex
align-items: baseline
justify-content: space-around
padding: $gutter/2 0
label
font-size: 10px
color: $faded-dark
margin: 0.25em
text-transform: none
input
font-size: 12px
flex-grow: 1
border: 0
border-bottom: 1px solid $faded
width: 50%
margin-right: 0.25em
padding: 0 0.25em
text-align: center
> div.remaining
flex: 1
display: flex
flex-direction: column-reverse
label
text-align: center
padding: 2px
font-size: 10px
input
text-align: center
border: 0
flex: 1
&.deathsaves
> div
margin: $gutter
background: $bg
border: 1px solid black
border-radius: $radius
display: flex
flex-direction: column-reverse
> div.label
text-align: center
label
font-size: 10px
> div.marks
display: flex
flex: 1
flex-direction: column
justify-content: center
div.deathsuccesses, div.deathfails
display: flex
align-items: center
> *
label
font-size: 8px
text-align: right
flex: 1 50%
div.bubbles
flex: 1 40%
margin-left: $gutter / 2
input[type="checkbox"]
appearance: none
width: $bubble-size
height: $bubble-size
border: 1px solid black
border-radius: $bubble-size
&:checked
background-color: black
section.attacksandspellcasting
border: 1px solid black
border-radius: $radius
margin-top: $gutter
> div
margin: $gutter
display: flex
flex-direction: column
> label
order: 3
text-align: center
> table
width: 100%
th
font-size: 10px
color: $faded
input
width: calc(100% - 4px)
border: 0
background-color: $faded-light
font-size: 10px
padding: 3px
textarea
border: 0
section.equipment
border: 1px solid black
border-radius: $radius
margin-top: $gutter
> div
padding: $gutter
display: flex
flex-direction: row
flex-wrap: wrap
> div.money
$labelwidth: 20px
$labelpadding: 3px
ul
display: flex
flex-direction: column
justify-content: space-between
height: 100%
> li
display: flex
align-items: center
label
border: 1px solid black
border-radius: $radius 0 0 $radius
border-right: 0
width: $labelwidth
font-size: 8px
text-align: center
padding: $labelpadding 0
input
border: 1px solid black
border-radius: $radius
width: 40px
padding: 10px 3px
font-size: 12px
text-align: center
> label
order: 3
text-align: center
flex: 100%
> textarea
flex: 1
border: 0
section.flavor
padding: $gutter
background: $faded-dark
border-radius: $radius
div
background: $bg
display: flex
flex-direction: column-reverse
padding: 5px
border: 1px solid black
label
text-align: center
font-size: 10px
margin-top: 3px
textarea
border: 0
border-radius: 0
height: 4em
&:first-child
border-radius: $radius $radius 0 0
&:not(:first-child)
margin-top: $gutter
&:last-child
border-radius: 0 0 $radius $radius
section.features
padding: $gutter
div
padding: $gutter
border: 1px solid black
border-radius: $radius
display: flex
flex-direction: column-reverse
label
text-align: center
textarea
border: 0
padding: 5px
height: 43em
Also see: Tab Triggers