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.
<div class="version">
<h2>SignWriting Character Viewer v1</h2>
<a href="https://slevinski.github.io/SignWriting_Character_Viewer/SignWriting_Character_Viewer.html" target="_blank">
Symbol Key names with plane 16 codepoints
<br>Based on Private Use Area codepoints
<br>100,000 ligatures to support ASCII, Unicode 8, and Plane 15
</a>
</div>
<div class="version">
<h2>SignWriting Character Viewer v2</h2>
<a href="https://slevinski.github.io/SignWriting_Character_Viewer/SignWriting_Character_Viewer_2.html" target="_blank">
Symbol Key names with plane 4 codepoints
<br>No private use area and no ligatures
<br>Proposed for Unicode 10
</a>
</div>
<div>
<p>Formal SignWriting</p>
<input type="fsw" class="form-control" id="fsw" placeholder="enter Formal SignWriting" oninput="fswChange();" value="M528x518S15a07472x487S1f010490x503S26507515x483 M516x515S1e020493x485S21901485x493 S38800464x496 R518x518S2ff00482x483S15a10494x432S22a04494x464S32107482x483 S38700463x496 M571x518S32107482x483S15a37548x494S15a37522x494 M543x546S15008457x503S15000518x503S34400482x483S26a16484x519S26a02502x519 M521x518S2ff00482x483S10612495x457S22f04488x477 S38700463x496 R571x518S32107482x483S15a37548x494S15a37522x494 R534x532S14c30508x468S14c38468x468S2a204511x504S2a21c466x504 R510x537S20302494x463S2030a490x480S20340495x505S20348490x522 R526x548S30124482x477S26500512x519S10010486x518 M527x524S18741490x477S18706498x501S2e834474x492 M526x536S15a50474x465S15a31479x513S24103494x482 M541x518S2ff00482x483S15a11518x485 M571x518S32107482x483S15a37548x494S15a37522x494 M524x525S26501482x476S14c19477x496S15a01501x502 M538x529S22a14484x500S1150a463x472S20500485x518S20500504x518S20500486x486S20500504x485S22a04502x500S11502508x472 M521x518S2ff00482x483S10612495x457S22f04488x477 S38900464x493 L528x534S1ce40506x472S1ce48473x494S2b711481x467S2c604499x508 L544x516S18217519x485S1821f465x485S20500456x505S2d600487x488S20500534x505 L546x518S2ff00482x483S19a10518x469S19a18453x471S22f03508x484S22f15470x486 L554x518S2ff00482x483S1ce17527x491S26b00523x469 M571x518S32107482x483S15a37548x494S15a37522x494 M521x524S1150a491x509S11520506x476S2e50c479x479 M540x520S10011519x490S2ff00482x483S2df08518x462 M551x524S20337504x482S20331476x484S3770b488x497S37713490x498S2891f451x497S28907525x497S20326536x478S20326450x477 M529x538S2e74c472x513S14220498x462S2e700514x497S14228471x478 M518x534S1e141470x506S34600482x483S2ff00482x483 M538x568S2ff00482x483S10011517x488S22a04518x525S15d39493x542S15d51501x545 S38800464x496">
<br>
<input type="button" class="form-control" id="dozenhours" onclick="cssChange();" value="CSS" />
<input type="range" class="form-control" id="zoom" oninput="zoomChange();" value="30" min="0" max="100" />
</div>
<div id="signtext" class="signtext"></div>
div.version {
float: left;
width: 50%;
text-align: center;
padding-bottom: 3%;
}
@font-face {
font-family: "SignWriting 2010";
src:
local('SignWriting 2010'),
local('SignWriting_2010'),
url('https://cdn.rawgit.com/Slevinski/signwriting_2010_fonts/master/fonts/SignWriting%202010.ttf') format('truetype');
}
@font-face {
font-family: "SignWriting 2010 Filling";
src:
local('SignWriting 2010 Filling'),
local('SignWriting_2010_Filling'),
url('https://cdn.rawgit.com/Slevinski/signwriting_2010_fonts/master/fonts/SignWriting%202010%20Filling.ttf') format('truetype');
}
svg {
overflow: visible !important;
}
div.signtext {
-webkit-writing-mode: vertical-lr;
-moz-writing-mode: vertical-lr;
-ms-writing-mode: tb-lr;
writing-mode: vertical-lr;
font-size: 0%;
border-left: 1px solid blue;
height: 93%;
}
div#signtext {
transform-origin: top left;
-ms-transform-origin: top left;
-moz-transform-origin: top left;
-webkit-transform-origin: top left;
bottom': '0';
right': '0';
overflow: hidden;
background-color: white;
}
span.outside {
border-left: 1px solid blue;
vertical-align: top;
}
span.middle {
vertical-align: bottom;
}
span.inside {
border-left: 1px dashed transparent;
}
div.sign {
writing-mode: horizontal-tb;
display: inline-block;
vertical-align: middle;
padding: 20px;
}
#fsw {
width:98%;
margin-bottom: 1%;
}
#zoom {
width: 88%;
valign: top;
margin-bottom: 1%;
display: inline-block;
vertical-align: top;
}
#dozenhours {
width: 7%;
valign: top;
display: inline-block;
vertical-align: top;
}
div#signtext.midnight {
background-color: black;
}
div#signtext.midnight div.sign svg g text.sym-line {
fill: white !important;
}
div#signtext.midnight div.sign svg g text.sym-fill {
fill: black !important;
}
div#signtext.midnight {
border-left: 1px solid yellow;
}
div#signtext.midnight span.outside {
border-left: 1px solid yellow;
}
div#signtext.midnight span.inside {
border-left: 1px dashed white;
}
function zoomChange() {
document.getElementById("zoom").scrollIntoView();
var zoom = (2.5*document.getElementById("zoom").value+25);
// if (document.getElementById("signtext").style.zoom) {
// document.getElementById("signtext").style.zoom = zoom + "%";
// } else {
var height = zoom*.98;
height = (100/zoom) * 98;
document.getElementById("signtext").style.height = height + "%";
zoom = zoom/100;
document.getElementById("signtext").style.transform = 'scale(' + zoom + ')';
// }
}
function fswChange(){
var signtext = document.getElementById("fsw").value;
var signs = sw10.signtext(signtext).map(function(fsw) {
var bbox = sw10.bbox(fsw).split(' ');
var w = bbox[1]-bbox[0];
var h = bbox[3]-bbox[2];
var adj = 1000 - bbox[0] - bbox[1];
adj += 2; //adjust for center dotted line
if (fsw.indexOf('L')>-1) adj += 150;
if (fsw.indexOf('R')>-1) adj -= 150;
var style = 'width: ' + w + 'px;height: ' + h + 'px;'
if (adj>0) {
style += 'margin-right: ' + adj + 'px;'
} else if (adj<0) {
adj = -adj;
style += 'border-left: ' + adj + 'px solid transparent;';
}
return '<div class="sign" style="' + style + '">' + sw10.svg(fsw + '-C') + '</div>';
});
document.getElementById("signtext").innerHTML = '<span class="outside"><span class="middle"><span class="inside">' + signs.join('') + '</span></span></span>';
}
function cssChange(){
//document.getElementById("zoom").scrollIntoView();
document.getElementById("signtext").classList.toggle("midnight")
}
fswChange();
Also see: Tab Triggers