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.
<main>
<section class="style-one">
<div class="wordart">
<h1 class="preview" data-content="CodePen">CodePen</h1>
</div>
</section>
<section>
<div class="container">
<form>
<select name="wordart-style" id="wordart-style" class="form-item">
<option value="one" id="one">WordArt Style 1</option>
<option value="two" id="two">WordArt Style 2</option>
<option value="three" id="three">WordArt Style 3</option>
<option value="four" id="four">WordArt Style 4</option>
<option value="five" id="five">WordArt Style 5</option>
<option value="six" id="six">WordArt Style 6</option>
<option value="seven" id="seven">WordArt Style 7</option>
<option value="eight" id="eight">WordArt Style 8</option>
<option value="nine" id="nine">WordArt Style 9</option>
<option value="ten" id="ten">WordArt Style 10</option>
<option value="eleven" id="eleven">WordArt Style 11</option>
<option value="twelve" id="twelve">WordArt Style 12</option>
<option value="thirteen" id="thirteen">WordArt Style 13</option>
<option value="fourteen" id="fourteen">WordArt Style 14</option>
<option value="fifteen" id="fifteen">WordArt Style 15</option>
<option value="sixteen" id="sixteen">WordArt Style 16</option>
<option value="seventeen" id="seventeen">WordArt Style 17</option>
<option value="eighteen" id="eighteen">WordArt Style 18</option>
<option value="nineteen" id="nineteen">WordArt Style 19</option>
<option value="twenty" id="twenty">WordArt Style 20</option>
<option value="twentyone" id="twentyone">WordArt Style 21</option>
<option value="twentytwo" id="twentytwo">WordArt Style 22</option>
</select>
<textarea name="text" placeholder="Enter your text here" id="text" cols="30" rows="1" maxlength="30" class="form-item"></textarea>
</form>
</div>
</section>
</main>
@mixin pseudo ($content: attr(data-content)) {
position: absolute;
content: $content;
}
* {
box-sizing: border-box;
&::before, &::after {
box-sizing: border-box;
}
}
body {
font-family: Arial, sans-serif;
font-size: 1rem;
background: #fff;
margin: 0;
display: flex;
align-items: center;
justify-content: center;
text-align: center;
min-height: 100vh;
overflow: hidden;
}
.container {
margin: auto;
padding: 0 1rem;
max-width: 20rem;
width: 100%;
}
.wordart {
position: relative;
display: inline-block;
.preview {
margin: 0 0 2rem;
padding: 2rem;
}
}
h1 {
font-size: 9vmin;
white-space: nowrap;
overflow: hidden;
}
section {
position: relative;
&.style-one {
.wordart {
transform: scale(1.05, 1.25);
.preview {
font-weight: 900;
color: #fff;
-webkit-text-fill-color: #fff;
-webkit-text-stroke: 1px #000;
}
}
}
&.style-two {
.wordart {
transform: scaleY(1.65);
.preview {
font-weight: 900;
color: #000;
transform: rotate(-3deg) skewY(-10deg);
}
}
}
&.style-three {
.wordart {
transform: scaleY(1.65);
.preview {
font-style: italic;
color: #fff;
-webkit-text-fill-color: #fff;
-webkit-text-stroke: 1px #000;
text-shadow: 3px 2px 0 #999;
}
}
}
&.style-four {
.wordart {
.preview {
font-family: Times New Roman, serif;
font-weight: 400;
color: #336699;
text-shadow: 2px 1px 0 #c1c1c1;
}
}
}
&.style-five {
.wordart {
transform: scaleY(1.25);
.preview {
font-weight: 900;
color: #d8d8d8;
-webkit-text-fill-color: #d8d8d8;
-webkit-text-stroke: 1px #3333cc;
-webkit-background-clip: text;
background-clip: text;
&::before {
@include pseudo;
color: #9999ff;
-webkit-text-fill-color: #9999ff;
-webkit-text-stroke: transparent;
transform: translate(0.4vw, 0.25vw);
mix-blend-mode: darken;
}
}
}
}
&.style-six {
.wordart {
transform: scaleX(0.85) translateZ(0);
.preview {
font-weight: 900;
color: transparent;
background: linear-gradient(#adadad, #fff);
-webkit-text-fill-color: transparent;
-webkit-background-clip: text;
background-clip: text;
letter-spacing: 0.25rem;
&::before {
@include pseudo;
z-index: -1;
text-shadow: 0.125em 0.125em #717171;
}
}
}
}
&.style-seven {
.wordart {
transform: scaleY(1.25);
.preview {
font-family: Impact, sans-serif;
color: #0066cc;
-webkit-text-fill-color: #0066cc;
-webkit-text-stroke: 0.016em #99ccff;
-webkit-background-clip: text;
background-clip: text;
&::before {
@include pseudo;
z-index: -1;
text-shadow: 0.094em 0.078em #990000;
}
}
}
}
&.style-eight {
.wordart {
transform: scaleY(1.25);
.preview {
font-family: Impact, sans-serif;
color: transparent;
background: radial-gradient(ellipse at center, #fff812, #ff9a32);
-webkit-text-fill-color: transparent;
-webkit-background-clip: text;
background-clip: text;
&::before {
@include pseudo;
z-index: -1;
text-shadow: 0.094em 0.063em #cdcdcd;
}
}
}
}
&.style-nine {
.wordart {
transform: scale(0.9, 1.65) rotate(-3deg) skewY(-3deg) translateZ(0);
.preview {
font-family: Impact, sans-serif;
font-weight: 700;
color: transparent;
background: linear-gradient(#6900cc, #cb00cc);
-webkit-text-fill-color: transparent;
-webkit-text-stroke: 0.016em #d2a2fe;
-webkit-background-clip: text;
background-clip: text;
&::before {
@include pseudo;
z-index: -1;
-webkit-text-stroke: transparent;
text-shadow: 0.094em 0.063em #adadff;
}
}
}
}
&.style-ten {
.wordart {
transform: scale(0.85, 1.25);
.preview {
font-family: Times New Roman, serif;
font-weight: 400;
color: #1a4b28;
-webkit-text-fill-color: #1a4b28;
-webkit-text-stroke: 1.5px #008000;
&::before {
@include pseudo();
z-index: -1;
font-size: 10vmin;
color: #d2e5dc;
-webkit-text-fill-color: #d2e5dc;
-webkit-text-stroke: transparent;
transform: translate(-2.5vmin, -4vmin);
}
}
}
}
&.style-eleven {
.wordart {
transform: scaleY(1.65);
.preview {
font-weight: 900;
color: transparent;
background: linear-gradient(to left, #a104ad, #0b2be0, #329941, #f7f658, #f16412, #e92153, #aa04a7);
-webkit-text-fill-color: transparent;
-webkit-text-stroke: 0.016em #eaeaea;
-webkit-background-clip: text;
background-clip: text;
letter-spacing: 0.1rem;
&::before {
@include pseudo;
z-index: -1;
color: #cdcdcd;
-webkit-text-fill-color: #cdcdcd;
-webkit-text-stroke: transparent;
transform: rotateX(63deg) skew(60deg) scaleY(0.65) translate3d(2em, -2.15em, -1em);
}
}
}
}
&.style-twelve {
.wordart {
.preview {
font-family: Times New Roman, serif;
font-weight: 400;
color: transparent;
background: linear-gradient( #999cfc, #1b999c);
-webkit-text-fill-color: transparent;
-webkit-background-clip: text;
background-clip: text;
&::before {
@include pseudo;
z-index: -1;
text-shadow: 0.031em 0.031em #cdcdcd;
}
}
}
}
&.style-thirteen {
.wordart {
transform: scale(0.65, 1.65);
.preview {
font-weight: 900;
color: #896640;
&::before {
@include pseudo;
z-index: -1;
text-shadow: 1px 0 #1b0d00, 2px 0 #1b0d00, 3px 0 #1b0d00, 4px 0 #1b0d00, 5px 0 #1b0d00, 6px 0 #1b0d00, 7px 0 #1b0d00;
}
}
}
}
&.style-fourteen {
.wordart {
transform: scale(0.85, 1.3) translateZ(0);
.preview {
font-family: Times New Roman, serif;
font-weight: 400;
background: linear-gradient(#fffecb, #ff9999);
-webkit-text-fill-color: transparent;
-webkit-background-clip: text;
background-clip: text;
letter-spacing: -0.1vw;
&::before {
@include pseudo;
z-index: -1;
text-shadow: -1px 0 0 #002245, 0 -1px 0 #0050a0, -2px -1px 0.25px #002245, -1px -2px 0.25px #0050a0, -3px -2px 0.25px #002245, -2px -3px 0.25px #0050a0, -4px -3px 0.25px #002245, -3px -4px 0.25px #0050a0, -5px -4px 0px #002245, -4px -5px 0px #0050a0;
}
}
}
}
&.style-fifteen {
.wordart {
transform: perspective(200px) rotateX(30deg) scaleY(1.65);
.preview {
font-weight: 900;
color: transparent;
background: linear-gradient(#551700, #fecb00);
-webkit-text-fill-color: transparent;
-webkit-text-stroke: 1px #b2b2b2;
-webkit-background-clip: text;
background-clip: text;
letter-spacing: 0.1vw;
&::before {
@include pseudo;
z-index: -1;
color: #ab8d56;
-webkit-text-fill-color: #ab8d56;
-webkit-text-stroke: transparent;
transform: perspective(250px) translateY(-0.643em) rotateX(70deg) scale(1) translateZ(-1em);
}
}
}
}
&.style-sixteen {
.wordart {
transform: scale(0.8, 1.2);
.preview {
font-family: Impact, sans-serif;
font-weight: 900;
color: #33ccff;
-webkit-text-stroke: 1.25px #000099;
text-shadow: 0.35rem -0.35rem 0 #000099;
letter-spacing: -0.15vw;
}
}
}
&.style-seventeen {
.wordart {
transform: scale(1.05, 1.25);
.preview {
font-weight: 900;
color: transparent;
background:
repeating-linear-gradient(180deg, transparent, transparent 1px, #ffff00 1px, #ffff00 4px), repeating-linear-gradient(-50deg, #808080, #808080 5px, #ffff00 5px, #ffff00 8px);
-webkit-text-fill-color: transparent;
-webkit-text-stroke: 1px #000;
-webkit-background-clip: text;
background-clip: text;
&::before {
@include pseudo;
z-index: -1;
text-shadow: 3px 2px 0 #999;
}
}
}
}
&.style-eighteen {
.wordart {
transform: scaleY(1.5) translateZ(0);
.preview {
font-family: Times New Roman, serif;
font-weight: 400;
background: linear-gradient(#b6b6b6 0%, #5f5f5f 20%, #b1b1b1 30%, #fff 64%, #6c6c6c 65%, #373737 66%, #515151 67%, #787878 75%, #d2d2d2 80%, #d2d2d2 100%);
-webkit-text-fill-color: transparent;
-webkit-background-clip: text;
background-clip: text;
&::before {
@include pseudo;
z-index: -1;
text-shadow: -1px 0 0 #4a4a4a, 0 -1px 0 #8b8b8b, -2px -1px 0.125px #4a4a4a, -1px -1px 0.125px #8b8b8b, -3px -2px 0.125px #4a4a4a, -2px -2px 0.125px #8b8b8b, -4px -3px 0.125px #4a4a4a, -3px -3px 0.125px #8b8b8b, -5px -4px 0.125px #4a4a4a, -4px -4px 0.125px #8b8b8b, -5px -5px 0 #4a4a4a, -5px -5px 0 #8b8b8b;
}
}
}
}
&.style-nineteen {
.wordart {
transform: scale(0.65, 1.75);
.preview {
font-weight: 900;
color: #0f3a1a;
transform: perspective(100px) rotateY(6deg) rotateZ(-7deg);
&::before {
@include pseudo;
z-index: -1;
text-shadow: -1px 0 0 #000800, 0 -1px 0 #005600, -2px -1px 0.125px #000800, -1px -2px 0.125px #005600, -3px -2px 0.125px #000800, -2px -3px 0.125px #005600, -4px -3px 0.125px #000800, -3px -4px 0.125px #005600, -5px -4px 0.125px #000800, -4px -5px 0.125px #005600, -6px -5px 0.125px #000800, -5px -6px 0.125px #005600, -7px -6px 0 #000800;
}
}
}
}
&.style-twenty {
.wordart {
transform: perspective(100px) rotateY(6deg) rotateZ(-3deg) skewY(15deg) scale(0.8, 1.25);
.preview {
font-family: Impact, sans-serif;
color: transparent;
background: linear-gradient(to left, #747474, #fff, #747474);
-webkit-text-fill-color: transparent;
-webkit-background-clip: text;
background-clip: text;
&::before {
@include pseudo;
z-index: -1;
text-shadow: -1px 0 0 #72745b, 0 1px 0 #2c2d23, -2px 1px 0.5px #72745b, -1px 2px 0.5px #2c2d23, -3px 2px 0.5px #72745b, -2px 3px 0.5px #2c2d23, -4px 3px 0.5px #72745b, -3px 4px 0.5px #2c2d23, -5px 4px 0.5px #72745b, -4px 5px 0.5px #2c2d23, -6px 5px 0.5px #72745b, -5px 6px 0.5px #2c2d23, -7px 6px 0.5px #72745b, -6px 7px 0.5px #2c2d23, -8px 7px 0.5px #72745b, -7px 8px 0.5px #2c2d23, -9px 8px 0.5px #72745b, -8px 9px 0.5px #2c2d23, -10px 9px 0.5px #72745b, -9px 10px 0.5px #2c2d23, -11px 10px 0.5px #72745b, -10px 11px 0.5px #2c2d23, -12px 11px 0.5px #72745b, -11px 12px 0.5px #2c2d23, -13px 12px 0.5px #72745b, -12px 13px 0.5px #2c2d23, -14px 13px 0.5px #72745b, -13px 14px 0.5px #2c2d23, -15px 14px 0.5px #72745b, -14px 15px 0.5px #2c2d23, -16px 15px 0.5px #72745b, -15px 16px 0.5px #2c2d23, -17px 16px 0.5px #72745b, -16px 17px 0.5px #2c2d23, -18px 17px 0 #72745b, -17px 18px 0 #2c2d23;
}
}
}
}
&.style-twentyone {
.wordart {
transform: scaleY(1.5) skewY(-8deg) rotateZ(-3deg) translateZ(0);
.preview {
font-family: Impact, sans-serif;
color: transparent;
background: linear-gradient(to bottom left, #fee601, #fee601 15%, #fe4201);
-webkit-text-fill-color: transparent;
-webkit-background-clip: text;
background-clip: text;
&::before {
@include pseudo;
z-index: -1;
text-shadow: 1px 0 0 #813300, 0 1px 0 #c14d00, 2px 1px 0.35px #813300, 1px 2px 0.35px #c14d00, 3px 2px 0.35px #813300, 2px 3px 0.35px #c14d00, 4px 3px 0.35px #813300, 3px 4px 0.35px #c14d00, 5px 4px 0.35px #813300, 4px 5px 0.35px #c14d00, 6px 5px 0.35px #813300, 5px 6px 0.35px #c14d00, 7px 6px 0.35px #813300, 6px 7px 0.35px #c14d00;
}
}
}
}
&.style-twentytwo {
.wordart {
transform: scale(0.75, 1.65) translateZ(0);
.preview {
font-weight: 900;
background: linear-gradient(#ccdfec 0%, #7a97bc 20%, #8aacc6 30%, #fff 50%, #b8908f 51%, #80302d 52%, #b84d4a 55%, #e7cfc9 75%, #916e66 100%);
-webkit-text-fill-color: transparent;
-webkit-background-clip: text;
background-clip: text;
letter-spacing: -0.2vw;
&::before {
@include pseudo;
z-index: -1;
text-shadow: 1px 0 0 #000, 0 1px 1px #a1a1a1, 2px 1px 1px #000, 1px 2px 1px #a1a1a1, 3px 2px 1px #000, 2px 3px 1px #a1a1a1, 4px 3px 1px #000, 3px 4px 1px #a1a1a1, 5px 4px 1px #000, 4px 5px 1px #a1a1a1, 6px 5px 1px #000, 5px 6px 1px #a1a1a1, 7px 6px 1px #000, 6px 7px 1px #a1a1a1, 8px 7px 1px #000, 7px 8px 1px #a1a1a1, 9px 8px 1px #000, 8px 9px 1px #a1a1a1, 10px 9px 0 #000;
}
}
}
}
}
textarea, select {
position: relative;
display: block;
z-index: 1;
font-family: inherit;
font-size: 0.875rem;
width: 100%;
padding: 0.6rem 1rem;
appearance: none;
background: transparent;
border: 1px solid #d1d1d1;
box-shadow: none;
transition: border-color 0.1s ease-in-out, box-shadow 0.1s ease-in-out;
&:focus {
outline: 0;
border-color: #396fb9;
box-shadow: 0 0 0 2px #b3cdf4;
}
}
select#wordart-style {
margin-bottom: 1rem;
background: #fff url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="%23727272" viewBox="0 0 20 20"><path d="M5 8l6 6 6-6z"/></svg>') right 0.5rem center no-repeat;
padding: 0.75rem 1.5rem 0.75rem 0.75rem;
}
textarea {
height: 4rem;
}
const styleSelect = document.querySelector('#wordart-style');
const styleChange = document.querySelector('section');
const text = document.querySelector('#text');
const previews = document.querySelectorAll('.preview');
styleSelect.addEventListener('change',function(e){
previews.forEach(preview => {
styleChange.removeAttribute('class');
styleChange.classList.add('style-' + this.value);
});
})
function changePreview(e) {
previews.forEach(preview => {
if (preview.getAttribute('data-content') == preview.textContent) {
preview.textContent = preview.setAttribute('data-content', e.target.value);
}
preview.textContent = e.target.value;
});
}
text.addEventListener('keyup', changePreview);
Also see: Tab Triggers