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.
<!--Add Floating Labels
https://getbootstrap.com/docs/5.0/forms/floating-labels/
-->
<div class="container d-grid gap-3">
<div class="mt-5">
<div>
<label for="audienceName" class="form-label">
<h3>Audience Preset</h3>
</label>
<select id="audienceName" class="form-select d-flex" aria-label="Audience Present Select">
<option selected>--Select--</option>
<option value="1">Searching US 30 Days</option>
<option value="2">i18n example</option>
<option value="">Access Every Day?</option>
<option value="">Has Searched in the last 6 Months but has No Resume</option>
</select>
</div>
<div class="mt-5">
<hr />
<h3>Jobsearch/Mobsearch</h3>
<div class="row align-items-baseline">
<div class="col col-auto">
<select id="description_who" class="form-select" aria-label="Who are we targeting?">
<option selected>--Select--</option>
<option value="1">Accounts</option>
<option value="2">Advertisers</option>
</select>
</div>
<div class="col col-auto">
that have
</div>
<div class="col col-auto">
<select id="description_haveDone" class="form-select" aria-label="What have they done?">
<option selected>--Select--</option>
<option value="1">searched</option>
<option value="2">applied</option>
<option value="3">posted</option>
</select>
</div>
<div class="col col-auto">
about
</div>
<div class="col col-auto">
<input placeholder="keywords">
</div>
<div class="col col-auto">
and not about
</div>
<div class="col col-auto">
<input placeholder="keywords">
</div>
<div class="col col-auto">
located
</div>
<div class="col col-auto">
<!-- Change this to an input field that will give the option of another menu "Zipcode" is picked-->
<select id="description_where" class="form-select" aria-label="Where are they looking?">
<option selected>--Select--</option>
<option value="1">in the US</option>
<option value="2">in Zipcode(s)</option>
<option value="3">in Select Countries</option>
<option value="3">in All Countries</option>
</select>
</div>
<div class="col col-auto">
via
</div>
<div class="col col-auto">
<select id="description_how" class="form-select" aria-label="How did they search?">
<option selected>--Select--</option>
<option value="1">mobile or desktop</option>
<option value="2">mobile</option>
<option value="3">desktop</option>
</select>
</div>
<div class="col col-auto">
in the last
</div>
<div class="col col-auto">
<select id="description_when" class="form-select" aria-label="Timeframe">
<option selected>--Select--</option>
<option value="1">30 days</option>
<option value="2">14 days</option>
<option value="3">7 days</option>
</select>
</div>
</div>
<div class="mt-2">
<div class="row row-cols-4 g-2">
<div class="col col-auto">
<b>And Also</b>
</div>
<div class="col col-auto">
</div>
<div class="btn btn-outline-primary btn-sm" type="button" data-bs-toggle="collapse" data-bs-target="#collapseExample" aria-expanded="false" aria-controls="collapseExample">Expand</div>
</div>
<div class="collapse" id="collapseExample">
<div class="list-group mt-2">
<label class="list-group-item d-flex align-items-baseline">
<input class="form-check-input me-1" type="checkbox" value=""><!--
<br>Help text (info icon=index tied to)-->
<div class="input-group mb-3">
<span class="input-group-text" id="inputGroup-sizing-default">Keywords</span>
<input type="text" class="form-control" aria-label="Sizing example input" aria-describedby="inputGroup-sizing-default">
</div>
<div class="input-group mb-3">
<span class="input-group-text" id="inputGroup-sizing-default">Exclude Keywords</span>
<input type="text" class="form-control" aria-label="Sizing example input" aria-describedby="inputGroup-sizing-default">
</div>
</label>
<label class="list-group-item d-flex align-items-baseline">
<input class="form-check-input me-1" type="checkbox" value="">
<div class="input-group mb-3">
<span class="input-group-text" id="inputGroup-sizing-default">Search Terms</span>
<input type="text" class="form-control" aria-label="Sizing example input" aria-describedby="inputGroup-sizing-default">
</div>
</label>
<label class="list-group-item d-flex gap-2">
<input class="form-check-input me-1" type="checkbox" value="">
<p>Has a resume:</p>
<span>No</span>
<div class="form-check form-switch">
<input class="form-check-input" type="checkbox" id="flexSwitchCheckDefault">
</div>
<span>Yes</span>
</label>
<!-- <label class="list-group-item">
<input class="form-check-input me-1" type="checkbox" value="">
Fourth checkbox
</label>
<label class="list-group-item">
<input class="form-check-input me-1" type="checkbox" value="">
Fifth checkbox
</label> -->
</div>
<br><button type="button" class="btn btn-secondary">+ Custom Field</button>
</div>
</div>
<!--This is the third part for the picker-->
<div class="mt-5">
<hr />
<div class="d-flex gap-2 justify-content-end">
<button type="button" class="btn btn-outline-primary" data-bs-toggle="modal" data-bs-target="#exampleModal">Save Preset</button>
<button type="button" class="btn btn-primary">Generate Code</button>
</div>
</div>
<!-- Modal -->
<div class="modal fade" id="exampleModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Save Audience Preset</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<div class="input-group mb-3">
<span class="input-group-text" id="inputGroup-sizing-default">Name</span>
<input type="text" class="form-control" aria-label="Sizing example input" aria-describedby="inputGroup-sizing-default">
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-outline-primary" data-bs-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary">Save</button>
</div>
</div>
</div>
</div>
<!-- Modal End-->
<div class="mt-5">
<label for="generatedCode" class="form-label">Generated Code</label>
<br>
<textarea name="message" rows="5" class="col-12 p-3">
Code here.
</textarea>
</div>
</div>
</div>
<!--- End Containter-->
.form-select, textarea, input {
border-radius: 12px;
border: 1px solid #ccc;
margin: 2px 0px;
}
input {
padding-left: 5px;
}
import * as bootstrap from "https://cdn.skypack.dev/bootstrap@5.1.0";
var mySelect = document.getElementById("audienceName");
mySelect.onchange = function () {
var x1 = document.getElementById("description_who");
var x2 = document.getElementById("description_haveDone");
var x3 = document.getElementById("description_aboutWhat");
var x4 = document.getElementById("description_where");
var x5 = document.getElementById("description_how");
var x6 = document.getElementById("description_when");
if (mySelect.value == 1) {
x1.value = "1";
x2.value = "1";
x3.value = "1";
x4.value = "1";
x5.value = "1";
x6.value = "1";
} else if (mySelect.value == 2){
x1.value = "2";
x2.value = "1";
x3.value = "2";
x4.value = "2";
x5.value = "3";
x6.value = "1";
}
};
Also see: Tab Triggers