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 URL's added here will be added as <link>
s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.
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.
If the stylesheet 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 CSS 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.
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 id="wrapper">
<h1>Suzhou numerals 蘇州碼子 / 花碼</h1>
<h3>Suzhou numerals converter 轉換蘇州碼子 / 花碼</h3>
<p>Enter number in textbox and click ">" to convert.<br />輸入數字然後按">".</p>
<form id="submitForm">
<input type="text" id="source_code" placeholder="Numerals" value="64" />
<input type="button" id="ston" value="<" style="display:none;" />
<input type="submit" id="ntos" value=">" />
</form>
<br />
<div id="target_code">
<div id="target_label">價錢</div>
<div id="code_wrapper">
<div id="code_number"></div>
<div id="code_unit"></div>
</div>
</div>
<h4 id="canvas_label">You can right-click and save as image file.<br />你可以按滑鼠右鍵然後儲存影像.</h4>
<div id="target_canvas"></div>
<h3>About Suzhou numerals 關於蘇州碼子 / 花碼</h3>
<p class="blockquote" cite="https://en.wikipedia.org/wiki/Suzhou_numerals">The Suzhou numerals or huama is a numeral system used in China before the introduction of Arabic numerals... Suzhou numerals were once popular in Chinese marketplaces, such as those in Hong Kong along with local transportation before the 1990s, but they have gradually been supplanted by Arabic numerals.<br />蘇州碼子又稱花碼、草碼、菁仔碼、番仔碼,是一種傳統在中國民間流行的數字,產生於中國的蘇州,起源自算籌,因其書寫便捷,曾經廣泛使用於商業中,在賬簿和發票等均有使用。現在這種數字在中國大陸及台灣幾近絕跡,但在港澳地區的街市、舊式茶餐廳及中藥房偶而仍然可見。</p>
</div>
html, body {
font-family: 'Open Sans', sans-serif;
background-color:#333;
color: #fff;
margin-bottom: 50px;
}
h2 {
margin: 10px 0px 5px 0px;
font-weight: 700;
color: #fff;
}
h3 {
margin: 40px 0px 10px 0px;
font-weight: 700;
color: #fff;
}
h3:first-of-type {
margin: 20px 0px 10px 0px;
}
p {
color: #ccc;
}
.blockquote {
margin: 10px 0px 20px 0px;
width: 700px;
line-height: 1.3em;
}
.blockquote:after {
content: " - Wikipedia";
font-weight: 700;
}
#target_code {
padding: 20px;
margin: 20px 0px 40px 0px;
display: none;
font-size: 48px;
background-color: #fff;
font-family: 'cwTeXFangSong', serif;
line-height: 1.2em;
}
#target_label {
margin-bottom: 20px;
padding-bottom: 5px;
position: relative;
border-bottom: 3px solid #006;
font-size: 36px;
font-weight: 700;
line-height: 1.2em;
color: #006;
text-align: center;
}
#code_wrapper {
margin: 0px auto;
position: relative;
font-weight: 700;
color: #900;
font-size: 48px;
}
#code_number,
#code_unit{
position: relative;
}
#code_number {
display: inline;
}
#code_unit {
display: block;
}
#canvas_label {
display:none;
}
var scode_array = [["〇","〡","〢","〣","〤","〥","〦","〧","〨","〩"], ["〇","一","二","三","〤","〥","〦","〧","〨","〩"]];
var scode_unit_array = ["","","拾","佰","仟","萬","十萬","佰萬","仟萬","億","十億","佰億","仟億","萬億","兆","十兆","百兆","千兆","京","十京","百京","千京"];
$("#ntos").click(function() {
generateCode($("#source_code").val());
});
$("#submitForm").submit(function(e){
return false;
});
function generateCode(num) {
$("#target_code").hide().width("auto");
if(!isNaN(Number(num))) {
var output = [], sNumber = num.toString(), currentSet = 0, decimal_count = scode_unit_array[sNumber.split(".")[0].length], isDecimal = sNumber.indexOf(".");
for (var i = 0, len = sNumber.length; i < len; i++) {
if (parseInt(sNumber.charAt(i-1)) >= 1 && parseInt(sNumber.charAt(i-1)) <=3) {
if (parseInt(sNumber.charAt(i)) >= 1 && parseInt(sNumber.charAt(i)) <=3) {
currentSet++;
if (currentSet > 1) {
currentSet = 0;
}
}
}
output.push(scode_array[currentSet][parseInt(sNumber.charAt(i))]);
}
$("#code_number").html(output.join(""));
$("#code_unit").html(decimal_count+"元");
$("#target_code").show();
$("#target_code").width($("#code_number").outerWidth()+10);
html2canvas($("#target_code")).then(function(canvas) {
$("#target_canvas").html(canvas);
$("#canvas_label").show();
});
} else {
alert("Please enter valid number.");
}
}
generateCode(64);
Also see: Tab Triggers