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. You can use the CSS from another Pen by using it's URL and the proper URL extention.
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="app-main">
<div id="right_col" class="open column fixed">
<div class="chat-container float-right">
<div class="chat-header">
<a class="button glyph-only left">
<svg class="svg-roomlist" height="16px" version="1.1" viewBox="0 0 16 16" width="16px" x="0px" y="0px">
<path clip-rule="evenodd" d="M1,13v-2h14v2H1z M1,5h13v2H1V5z M1,2h10v2H1V2z M12,10H1V8h11V10z" fill-rule="evenodd"></path>
</svg>
</a>
<p class="room-title">avalonstar</p>
</div>
<div class="chat-room">
</div>
<div class="chat-interface">
<div class="textarea-contain">
<div class="whatisthis anchor-bottom">
<div class="text">
<p>You have 1,000 Bits to spend!</p>
</div>
<div class="sub-text">
Spend more than 500 Bits to send this message
</div>
</div>
<div class="bits-image">
<img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/t-140/bit.png">
<div class="bounding-box"></div>
</div>
<textarea id="chat-message" placeholder="Send a message"></textarea>
<a class="emoticon-selector-toggle">
<svg class="svg-emoticons" height="18px" version="1.1" viewBox="0 0 18 18" width="18px" x="0px" y="0px">
<path clip-rule="evenodd" d="M9,18c-4.971,0-9-4.029-9-9s4.029-9,9-9s9,4.029,9,9S13.971,18,9,18z M14,4.111V4h-0.111C12.627,2.766,10.904,2,9,2C7.095,2,5.373,2.766,4.111,4H4v0.111C2.766,5.373,2,7.096,2,9s0.766,3.627,2,4.889V14l0.05-0.051C5.317,15.217,7.067,16,9,16c1.934,0,3.684-0.783,4.949-2.051L14,14v-0.111c1.234-1.262,2-2.984,2-4.889S15.234,5.373,14,4.111zM11,6h2v4h-2V6z M12.535,12.535C11.631,13.44,10.381,14,9,14s-2.631-0.56-3.536-1.465l0.707-0.707C6.896,12.553,7.896,13,9,13s2.104-0.447,2.828-1.172L12.535,12.535z M5,6h2v4H5V6z" fill-rule="evenodd"></path>
</svg>
</a>
</div>
<div class="chat-buttons-container clearfix">
<a class="button glyph-only float-left">
<svg class="svg-gear" height="16px" version="1.1" viewBox="0 0 16 16" width="16px" x="0px" y="0px">
<path clip-rule="evenodd" d="M15,7v2h-2.115c-0.125,0.615-0.354,1.215-0.713,1.758l1.484,1.484l-1.414,1.414l-1.484-1.484C10.215,12.531,9.615,12.76,9,12.885V15H7v-2.12c-0.614-0.126-1.21-0.356-1.751-0.714l-1.491,1.49l-1.414-1.414l1.491-1.49C3.477,10.211,3.247,9.613,3.12,9H1V7h2.116C3.24,6.384,3.469,5.785,3.829,5.242L2.343,3.757l1.414-1.414l1.485,1.485C5.785,3.469,6.384,3.24,7,3.115V1h2v2.12c0.613,0.126,1.211,0.356,1.752,0.714l1.49-1.491l1.414,1.414l-1.49,1.492C12.523,5.79,12.754,6.387,12.88,7H15z M8,6C6.896,6,6,6.896,6,8s0.896,2,2,2s2-0.896,2-2S9.104,6,8,6z" fill-rule="evenodd"></path>
</svg>
</a>
<a class="button glyph-only float-left">
<svg class="svg-viewerlist" height="16px" version="1.1" viewBox="0 0 16 16" width="16px" x="0px" y="0px">
<path clip-rule="evenodd" d="M6,12.999v-2h8v2H6z M6,6.999h8v2H6V6.999z M6,2.999h8v2H6V2.999z M2,10.999h2v2H2V10.999z M2,6.999h2v2H2V6.999z M2,2.999h2v2H2V2.999z" fill-rule="evenodd"></path>
</svg>
</a>
<button class="button primary float-right send-chat-button">Chat</button>
</div>
</div>
</div>
</div>
</div>
textarea
line-height: 28px
font: inherit
letter-spacing: inherit
color: #666
vertical-align: top
border: 1px solid rgba(0, 0, 0, 0.25)
background-clip: padding-box
background: #fff
padding: 7px
&:focus
outline: 0
box-shadow: 0 0 3px 1px rgba(185,155,235,0.75)
border: 1px solid rgba(100,65,165,0.75)
.button
position: absolute
display: inline-block
position: relative
cursor: pointer
line-height: 30px
height: 30px
font-size: 14px
font-family: inherit
padding: 0
color: #6441a5
border: 0
background: none
&.primary
background: #6441a5
color: #fff
padding: 0 10px
font-size: 12px
&.left
left: 20px
&.glyph-only
padding: 0 10px
svg
path
fill: #6441a5
.chat-container
position: absolute
top: 0
bottom: 0
right: 0
width: 340px
background-color: #f2f2f2
.chat-header
height: 30px
padding: 10px 0
line-height: 30px
text-align: center
font-size: 14px
width: 100%
box-shadow: inset 0 -1px 0 0 #dedede
.button
position: absolute
top: 10px
&.left
left: 20px
padding-left: 0
&.right
right: 20px
padding-right: 0
.svg-roomlist
width: 16px
height: 16px
margin-top: 7px
margin-bottom: 7px
float: left
.chat-room
top: 50px
left: 0
right: 0
bottom: 0
position: absolute
display: block
background-clip: content-box
.chat-interface
color: #8c8c8c
border-color: #3b3b3b
height: 111px
bottom: 0
width: 100%
position: absolute
padding: 0 20px 20px
box-sizing: border-box
.textarea-contain
width: 100%
height: 50px
margin-bottom: 10px
position: relative
textarea
width: 300px
height: 50px
padding-right: 25px
margin: 0
resize: none
box-sizing: border-box
.emoticon-selector-toggle
display: block
width: 18px
height: 18px
top: 5px
right: 5px
position: absolute
cursor: pointer
svg path
fill: rgba(0,0,0,0.2)
&:hover
svg path
fill: rgba(0,0,0,0.5)
.chat-buttons-container
width: 100%
display: block
.glyph-only
min-width: 14px
&:first-child
padding-left: 0
.bits-image
position: absolute
top: 6px
left: 100px
display: none
.bounding-box
width: 40px
height: 24px
border: 1px solid rgba(#6441a5, 0.5)
position: absolute
top: -2px
left: 18px
.whatisthis
padding: 15px
width: 270px
margin-left: -150px
display: none
.sub-text
font-size: 11px
.text p
margin-bottom: 0px
font-weight: bold
var isBitsActive = false;
$('#chat-message').keyup(function (e) {
var self = $(this);
console.log(self.val().match(/giveBits/g));
var res = self.val().match(/giveBits/g);
if(res) {
if (res[0] === 'giveBits') {
isBitsActive = true;
self.val('MLG! Nice shot!\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0');
$('.whatisthis, .bits-image').show();
}
}
console.log(isBitsActive);
if (isBitsActive) {
if (e.keyCode === 32) {
$('.bounding-box').hide();
$('.whatisthis').hide();
self.val('MLG! Nice shot!\xa0\xa0\xa0\xa0\xa0\xa0\xa0500')
isBitsActive = false;
}
}
})
$('.whatisthis').click(function () {
$('.whatisthis, .bits-image').hide();
$('#chat-message').val('');
});
Also see: Tab Triggers