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.
<!-- <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js"></script> -->
<body onload="selectInput()">
<h2 class="pad-top">Regional Indicator Emoji Writer
</h2>
<p class="txt-right">Click/Enter to copy. <strong>Ctrl/CMD + V</strong> in FB/TW to paste.</p>
<strong>String</strong>
<input type="text" id="from" class="right" placeholder="write stuff here" value="" tabindex="0" autofocus>
<br>
<div class="right">
<input type="text" value="๐ชโ๐ฒโ๐ดโ๐ฏโ๐ฎโ โ๐ดโ๐บโ๐นโ๐ตโ๐บโ๐น" id="myInput3" maxlength="2000">
<div class="tooltip">
<button onclick="myFunction3()" onmouseout="outFunc()">
<span class="tooltiptext" id="myTooltip">Copy to clipboard</span>
Copy
</button>
</div>
</div>
<h4>Currently Supports</h4>
<ul>
<li>letters</li>
<li>numbers</li>
<li> ! ? </li>
<li>spaces</li> <li>#</li> <li>-</li>
</ul>
</body>
*
margin: 0
padding: 0
html
background-color: #131313
body
color: #ddd
@import url('https://fonts.googleapis.com/css?family=Kurale|Laila')
\:root
--dark:#5B4E3E
--accent:#B5C7DD
--midtone:#897052
--light:#fdfcf6
--txt:#999590
--display:'Kurale', Serif
--body:'Laila', serif
html
display: flex
background-color: var(--accent)
background-image: url(cssimg/left-piece-shad.png), url(cssimg/right-piece-shad.png), url(cssimg/heart-repeat-03.svg)
background-repeat: repeat-y, repeat-y, repeat
background-attachment: scroll, scroll, fixed
background-size: 40px, 46px, 110px
background-position: calc(50% - 360px), calc(50% + 360px)
body
// background: var(--light)
padding: 0 49px
color: var(--txt)
font-family: var(--body)
font-size: 1.22rem
line-height: 1.9em
text-align: left
margin-left: auto
margin-right: auto
min-height: 100%
html, body
height: 99.98%
h1, h2, h3, h4, a, h5, button
font-family: var(--display)
text-shadow: 0.025em 0.025em 0.025em var(--dark)
line-height: 1.25em
// color: var(--white)
h1 + h4, h3 + p
text-align: center
padding: 0
h1
color: var(--accent)
font-size: 4em
text-align: center
line-height: 1em
padding: .46em 0 .08em .15em
text-shadow: 0.015em 0.015em 0.04em var(--dark)
h4
color: var(--txt)
font-size: 1.3em
text-align: Left
padding-left: 0
.center
display: block
margin-left: auto
margin-right: auto
padding: .15em 0 1.8em 0
h2
text-transform: uppercase
color: var(--midtone)
// color: var(--light)
font-size: 1.2em
padding-left: .5em
padding-bottom: .3em
letter-spacing: .04em
h3
font-size: 1.7em
color: var(--midtone)
padding-bottom: .5em
text-align: center
strong
font-family: var(--display)
text-shadow: 0.025em 0.025em 0.025em var(--dark)
font-size: 112%
a, button
color: var(--accent)
text-decoration: none
font-size: 1.2em
.block
display: block
button
font-size: 1.1em
input
font-family: var(--body)
color: var(--midtone)
font-size: .8em
border: 1.05pt solid var(--txt)
background: var(--light)
padding: .18em .5em
margin: 10pt 6pt
width: 475px
#from
width: 250px
margin-right: 10em
#png
margin-right: 3em
.right
position: absolute
right: calc(50% - 290px)
.txt-right
text-align: right
a:hover, input:hover, button:hover
color: var(--midtone)
a:active, input:active, button:hover
color: var(--dark)
footer
a
font-size: 1.4em
background-color: var(--light)
p
padding: 0 12px .618em 25px
margin: auto
max-width: 42em
color: var(--midtone)
h5
padding: 0 12px .618em 25px
margin: auto
max-width: 44em
color: var(--midtone)
color: var(--txt)
text-transform: uppercase
p + h5
padding: 0 12px .25rem 25px
footer
text-align: center
padding-top: .3em
padding-bottom: 1.5em
em
font-style: italic
font-weight: 500
.stretch
-moz-overflow: hidden
overflow: hidden
max-width: 800px
/*
* padding: 100rem 47px;
* margin: -100rem -47px;
padding: 2000rem 47px 2.2rem
margin: -2000rem -47px -2.2rem
background: var(--light)
.hide
visibility: none !important
color: var(--light)
.bottom
margin-bottom: auto
display: block
position: sticky
border-bottom: 0 solid var(--light)
.pad-top
padding-top: 1em
.nudge
padding-top: .25em
td
padding: 0 .618em
.ghost
opacity: .33
button
border: 1.15pt dashed var(--txt)
background: var(--light)
padding: 0 4pt 3pt 4pt
margin: 10pt 6pt
form
max-width: 44em
.tooltip
position: left
display: inline-block
.tooltiptext
visibility: hidden
width: auto
background-color: var(--dark)
color: var(--light)
text-align: center
border-radius: 6px
padding: .5em
position: absolute
z-index: 1
bottom: 160%
left: 50%
margin-left: -75px
opacity: 0
transition: opacity 0.3s
&::after
content: ""
position: absolute
top: 100%
left: 50%
margin-left: -7px
border-width: 7px
border-style: solid
border-color: var(--dark) transparent transparent transparent
opacity: .9
&:hover .tooltiptext
visibility: visible
opacity: .9
h4
padding-top: 2.5em
ul
color: var(--dark)
li
display: inline-block
function selectInput()
{var input = document.getElementById("from").focus();}
window.addEventListener('focus', selectInput);
// var from = document.getElementById('from').value;
// var stringArray = from.split("");
// var wordArray = from.split(" ");
var inpoot = document.getElementById("from");
inpoot.addEventListener("keyup", function(event) {
if (event.keyCode === 13) {
event.preventDefault();
myFunction3();
}
});
function myFunction3()
{
var emojiOutput = [];
// emojiOutput.push("โฏ");
var from = document.getElementById('from').value.toLowerCase();
var stringArray = from.split("");
var wordArray = from.split(" ");
// var stringArray = input.split("");
// emojiOutput.push("โ");
var output = stringArray.forEach(reg);
// var re = [a-z];
function reg(letter, i) {
if(/[a-z]/.test(letter)){
var reg = { "a": "๐ฆ", "b": "๐ง", "c": "๐จ", "d": "๐ฉ", "e": "๐ช", "f": "๐ซ", "g": "๐ฌ", "h": "๐ญ", "i": "๐ฎ", "j": "๐ฏ", "k": "๐ฐ", "l": "๐ฑ", "m": "๐ฒ", "n": "๐ณ", "o": "๐ด", "p": "๐ต", "q": "๐ถ", "r": "๐ท", "s": "๐ธ", "t": "๐น", "u": "๐บ", "v": "๐ป", "w": "๐ผ", "x": "๐ฝ", "y": "๐พ", "z": "๐ฟ"};
// emojiOutput.push(":regional_indicator_" + letter + ":");
emojiOutput.push(reg[letter]);
}
else if(/[0-9]/.test(letter)){
// var num = ["zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"];
var num2 = ["0๏ธโฃ", "1๏ธโฃ", "2๏ธโฃ", "3๏ธโฃ", "4๏ธโฃ", "5๏ธโฃ", "6๏ธโฃ", "7๏ธโฃ", "8๏ธโฃ", "9๏ธโฃ"];
// emojiOutput.push(":" + num[letter] + ":");
emojiOutput.push(num2[letter]);
}
else if(/ /.test(letter)){
// convert space to emspace + nbsp
emojiOutput.push("โ ");
}
else if(/!/.test(letter)){
// emojiOutput.push("โ");
randQ = Math.floor(2 * Math.random());
Q = ["โ", "โ"]
// emojiOutput.push("โ");
emojiOutput.push(Q[randQ]);
}
else if(/\?/.test(letter)){
randQ = Math.floor(2 * Math.random());
Q = ["โ", "โ"]
// emojiOutput.push("โ");
emojiOutput.push(Q[randQ]);
}
else if(/[\/]/.test(letter)){
emojiOutput.push("๐ง");
}
else if(/[\',โ]/.test(letter)){
emojiOutput.push("๐งท");
}
else if(/["]/.test(letter)){
emojiOutput.push("๐งฆ");
}
else if(/[\.]/.test(letter)){
emojiOutput.push("โซ๏ธ");
}
else if(/-/.test(letter)){
// emojiOutput.push(":small_blue_diamond:");
emojiOutput.push("๐น");
}
else if(/[โ,โ]/.test(letter)){
// emojiOutput.push(":small_blue_diamond:");
emojiOutput.push("โ");
}
else if(/#/.test(letter)){
emojiOutput.push("#๏ธโฃ");
}
else if(/\*/.test(letter)){
emojiOutput.push("*๏ธโฃ");
}
else if(/~/.test(letter)){
emojiOutput.push("ใฐ๏ธ");
}
else if(/:/.test(letter)){
emojiOutput.push("โฃ๏ธ");
}
else if(/\$/.test(letter)){
emojiOutput.push("๐ฒ");
}
else if(/\+/.test(letter)){
emojiOutput.push("โ");
}
else {
// regular thinspaces
emojiOutput.push("โฏ" + letter + "โฏ");
}
}
// nonbreaking thinspaces
// var joined = emojiOutput.join;
var final = [];
var rejoined = emojiOutput.forEach(spays);
function spays(emoji, i) {
if (/\S/.test(emoji)){
// nonbreaking thinsp
final.push(emoji + "โฏ")
}
else {
final.push(emoji)
};
};
document.getElementById("myInput3").value = final.join("");
// document.getElementById("myInput3").value = emojiOutput.join("โฏ");
var copyText = document.getElementById("myInput3");
copyText.select();
document.execCommand("copy");
var tooltip = document.getElementById("myTooltip");
tooltip.innerHTML = "Copied: " + copyText.value;
}
function outFunc() {
var tooltip = document.getElementById("myTooltip");
tooltip.innerHTML = "Copy to clipboard";
}
Also see: Tab Triggers