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.
<div class="row">
<a class="demo" href="#">link for focus (not part of pattern)</a>
<div class="col-md-12" role="toolbar" aria-label="ODS filters">
<select id="ODS-locations" name="ODS-locations" class="ods-filter" multiple>
<optgroup label="Maine">
<option value="40,520,60,860">Freeport, ME</option>
</optgroup>
<optgroup label="Colorado">
<option value="840">Lone Tree, CO</option>
</optgroup>
<optgroup label="Connecticut">
<option value="960">Danbury, CT</option>
<option value="540">South Windsor, CT</option>
</optgroup>
<optgroup label="Illinois">
<option value="780">Skokie, IL</option>
<option value="790">South Barrington, IL</option>
</optgroup>
<optgroup label="Kansas">
<option value="1120">Leawood, KS</option>
</optgroup>
<optgroup label="Massachusetts">
<option value="500">Burlington, MA</option>
<option value="770">Dedham, MA</option>
<option value="550">Mansfield, MA</option>
<option value="1280">Mashpee, MA</option>
</optgroup>
<optgroup label="Michigan">
<option value="1180">Clinton, MI</option>
</optgroup>
<optgroup label="Minnesota">
<option value="990">Bloomington, MN</option>
</optgroup>
<optgroup label="New Hampshire">
<option value="410">West Lebanon, NH</option>
</optgroup>
<optgroup label="New Jersey">
<option value="950">Freehold, NJ</option>
<option value="320">Marlton, NJ</option>
<option value="900">Paramus, NJ</option>
</optgroup>
<optgroup label="New York">
<option value="530">Albany, NY</option>
<option value="970">Fayetteville, NY</option>
<option value="1200">Lake Grove, NY, NY</option>
<option value="810">Victor, NY</option>
<option value="820">Yonkers, NY</option>
</optgroup>
<optgroup label="Ohio">
<option value="1130">Cincinnati, OH</option>
<option value="1110">Columbus, OH</option>
<option value="1000">Lyndhurst, OH</option>
</optgroup>
<optgroup label="Pennsylvania">
<option value="510">Center Valley, PA</option>
<option value="890">King of Prussia, PA</option>
<option value="800">Pittsburgh, PA</option>
</optgroup>
<optgroup label="Rhode Island">
<option value="1140">Cranston, RI</option>
</optgroup>
<optgroup label="Virginia">
<option value="1360">Charlottesville, VA</option>
<option value="50">Tysons Corner Center, VA</option>
<option value="1090">Richmond, VA</option>
<option value="1170">Virginia Beach, VA</option>
</optgroup>
<optgroup label="Vermont">
<option value="980">Burlington, VT</option>
</optgroup>
<optgroup label="Wisconsin">
<option value="1190">Brookfield, WI</option>
</optgroup>
</select>
<select id="ODS-event-type" name="ODS-event-type" class="ods-filter" multiple>
<option data-attr="2944">Competition</option>
<option data-attr="2945">L.L.Bean Adventures at Sunday River</option>
<option data-attr="2436">Instructional Course</option>
<option data-attr="2437">Overnight Trip</option>
<option data-attr="2438">Day Tour</option>
<option data-attr="2439">Instructor Certification Course</option>
<option data-attr="2600">Youth Camps</option>
<option data-attr="2440">Women's-Only Adventure</option>
<option data-attr="2441">Private Lesson</option>
<option data-attr="2474">Discovery Course</option>
<option data-attr="-1">Free Events</option>
</select>
<select id="ODS-skill-level" name="ODS-skill-level" class="ods-filter" multiple>
<option data-attr="2074">Intermediate</option>
<option data-attr="2443">Advanced</option>
<option data-attr="2475">Beginner</option>
</select>
<select id="ODS-price" class="ods-filter" multiple>
<option data-attr="-1">Free</option>
<option data-attr="1">$1 to $30</option>
<option data-attr="2">$30 to $50</option>
<option data-attr="3">$50 to $100</option>
<option data-attr="4">$100+</option>
</select>
<a id="clearer" href="#">Reset all filters</a>
</div>
</div>
.multiselect-container li.active a {
background-color: #fff;
color: #000;
}
.multiselect-container>li.multiselect-all {
border-bottom: 1px solid #e9e9e9;
padding: 5px 0;
margin-bottom: 15px;
}
#clearer {
padding-left: 10px;
vertical-align: middle;
}
.row {
padding: 20px;
}
a.demo {
padding: 20px;
display: block;
}
$("#ODS-locations").multiselect({
enableClickableOptGroups: true,
//includeSelectAllOption: true,
nonSelectedText: "Events near",
//enableCollapsibleOptGroups: true,
//selectAllText: "View all",
maxHeight: 400,
// button text test code
buttonText: function(options, select) {
if (
options.length === 0 ||
options.length === $("#ODS-locations option").length
) {
return "Events near";
} else {
return "Events near (" + options.length + ")";
}
}
});
$("#ODS-event-type").multiselect({
enableClickableOptGroups: true,
//includeSelectAllOption: true,
nonSelectedText: "Event type",
//selectAllText: "View all",
maxHeight: 400,
// button text test code
buttonText: function(options, select) {
if (
options.length === 0 ||
options.length === $("#ODS-event-type option").length
) {
return "Event type";
} else {
return "Event type (" + options.length + ")";
}
}
});
$("#ODS-skill-level").multiselect({
enableClickableOptGroups: true,
//includeSelectAllOption: true,
nonSelectedText: "Skill level",
//selectAllText: "View all",
maxHeight: 400,
// button text test code
buttonText: function(options, select) {
if (
options.length === 0 ||
options.length === $("#ODS-skill-level option").length
) {
return "Skill level";
} else {
return "Skill level (" + options.length + ")";
}
}
});
$("#ODS-price").multiselect({
enableClickableOptGroups: true,
//includeSelectAllOption: true,
nonSelectedText: "Price",
//selectAllText: "View all",
maxHeight: 400,
// button text test code
buttonText: function(options, select) {
if (
options.length === 0 ||
options.length === $("#ODS-price option").length
) {
return "Price";
} else {
return "Price (" + options.length + ")";
}
}
});
// Reset all
$("#clearer").on("click", function() {
// remove selected options
$(".ods-filter option").each(function(element) {
$(this).removeAttr("selected").prop("selected", false);
});
//refresh multiselect
$(".ods-filter").multiselect("refresh");
});
Also see: Tab Triggers