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 style="text-align: center;">SpanText makes web text transform in real time to user interaction. <span class="technical2">Written in JavaScript, i</span><span class="plain1">I</span>t can be installed and used on any website.
<span class="shorter1">Move the sliders below to try it out and learn more.</span><span class="longer2" style="color: #0000ff;"><a href="http://codepen.io/nbeversluis/pen/XdexBO?editors=1000"><strong>Try writing SpanText using CodePen.io</strong></a></span></div>
</div>
<table>
<tbody>
<tr>
<td>
<div><strong>Shorter</strong></div></td>
<td><div class="spantextslider" id="SpanText1" type="input" data-spantextmin="1" data-spantextmax="5.5" data-spantextattrR="longer" data-spantextattrL="shorter" data-spantextspeed="20" data-spantextinit="1"></div></td>
<td>
<div><strong>Longer</strong></div></td>
</tr>
<tr>
<td class="slider-container-label-space">
<div class="slider-label-left"><strong>Plain Language</strong></div></td>
<td><div class="spantextslider" id="SpanText2" type="input" data-spantextmin="1" data-spantextmax="5.5" data-spantextattrR="technical" data-spantextattrL="plain" data-spantextspeed="20" data-spantextinit="1"></div></td>
<td class="slider-container-label-space">
<div class="slider-label-right"><strong>Technical Language</strong></div></td>
</tr>
</tbody>
</table>
<span class="longer2">SpanText makes web text variable and interactive, embedding multiple versions or variations of a text into a single, flexible document. <span class="longer3">Any kind of web text with potential variation in length, tone, content, vocabulary, reading level, audience, or any other attribute, may be transformed into an engrossing web reading experience using SpanText.</span><span class="longer2"> As you move the top slider on this page right, this explanation becomes longer. The bottom slider adjusts how technical the explanation is.</span>
<span class="longer2">SpanText works by separating text into segments that can be controlled from sliders in real time. </span><span class="technical3">Each text segment is enclosed within an HTML <span> tag and a class name so it can be identified and manipulated. The sliders then activate Javascript to access and hide or show the text elements in real time. </span><span class="longer3"> A segment can be as short as a single character or as long as an entire paragraph or section. </span><span class="longer4"> For example, if you move the top slider all the way to the right, this sentence will end in an exclamation marks; otherwise it will end in a period<span class="shorter4">.</span><span class="longer5">!</span></span></span>
<span class="longer4">Text can be revealed as the slider moves either right or left, then hidden as the slider moves in the opposite direction. So SpanText can adjust length, content, or both.<span class="longer5">SpanText also supports nested attributes, so text may be hidden or shown conditionally based on more than one slider's settings.</span><span class="technical3"><span class="longer5"> For example, this sentence will only display when the "length" slider is set to maximum and the "Technical" slider is three or higher.</span></span></span><span class="longer4"> As you can see, SpanText also animates the text content, so it appears to expand or contract itself. This speed is adjustable.</span> <span class="technical4">The sliders on this page have five gradations (settings), but it is possible to use less or more, with no theoretical upper limit.</span>
<span class="longer3"><span class="technical3">Writing text that will animate with SpanText requires skill in HTML. There are several examples on this website.</span><span>
<span class="longer2">Thank you for reading about SpanText! </span>
.slider-container {
border-style:none !important;
}
.slider-container-label-space {
width:25%;
padding-bottom: 10px;
padding-top: 10px;
}
Also see: Tab Triggers