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.
<!-- This is the sample code for a classic Search Bar widget, that will be pointing your website to the eviivo Booking Engine. The Search Bar will need to be placed in the desired space in your website.
<!-- IMPORTANT! In order for the link to work, you need to replace the variable (https://URLLink) by the URL that matches your website implementation as detailed in the eviivo Help documentation -->
<!--
Technical requirements
* jQuery
* jQueryUI
* jQuery UI CSS
-->
<script src="https://code.jquery.com/jquery-3.6.0.min.js" integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script>
<script src="https://code.jquery.com/ui/1.13.0/jquery-ui.min.js" integrity="sha256-hlKLmzaRlE8SCJC1Kw8zoUbU8BxA+8kR3gseuKfMjxA=" crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://code.jquery.com/ui/1.13.0/themes/smoothness/jquery-ui.css">
<style>
/* Copy and insert the CSS code here below this line. The "CSS" code is visible in the middle "CSS" window -->
DATE FIELDS: background colour for calendar headers */
.ui-widget-header {
background: #ffffff;
}
</style>
<script type="text/javascript">
// Copy and insert the JavaScript code here below this line. The "JS" code is visible in the last "JS" window -->
</script>
<div class="ev-searchbox">
<!--
* Replace the expression https://URLLink below by the URL link that is specific to your website, as provided in eviivo's help documentation.
-->
<form id="ev-availabilitySearchResults" action="https://URLLink" method="GET" name="availabilitySearchResults">
<div class="ev-startDate ev-options">
<!-- Change or Translate the word "Arrival" below to suit your needs-->
<label for="startdate" class="ev-label">Arrival</label>
<input id="startdate" type="text" name="n" value="" class="ev-input" />
<input id="startdate1" type="hidden" name="startdate" value="" />
</div>
<div class="ev-endDate ev-options">
<!-- Change or Translate the word "Departure" below to suit your needs-->
<label for="enddate" class="ev-label">Departure</label> <!-- Translate -->
<input id="enddate" type="text" name="b" value="" class="ev-input" />
<input id="enddate1" type="hidden" name="enddate" value="" />
</div>
<div class="mod-options">
<div class="ev-adults ev-options">
<!-- Change or Translate the word "Adults" below to suit your needs-->
<label for="adults1" class="ev-label">Adults</label>
<select name="adults1" class="ev-select">
<option value="1">1</option>
<!-- By default, if the guest does not input anything in the search bar, the search will default to 2 adults. If you want the default to be a value other than 2, then remove the expression [ selected="selected" ] which appears next to number 2 and copy it next to the value you want to use as default, to suit your needs-->
<option value="2" selected="selected">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
<option value="10">10</option>
<option value="11">11</option>
<option value="12">12</option>
<option value="13">13</option>
<option value="14">14</option>
</select>
</div>
<div class="ev-children ev-options">
<!-- Change or Translate the word "Children" below to suit your needs -->
<label for="children1" class="ev-label">Children</label>
<select name="children1" class="ev-select">
<!-- By default, if the guest does not input anything in the search bar, the search will default to 0 children. If you want the default to be a value other than 0, then remove the expression [ selected="selected" ] which appears next the value 0 and copy it next to the value you want to use as default, to suit your needs-->
<option selected="selected" value="0">0</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
<option value="10">10</option>
<option value="11">11</option>
<option value="12">12</option>
<option value="13">13</option>
<option value="14">14</option>
</select>
</div>
</div>
<!--To change the booking button text, just replace "CHECK AVAILABILITY" below with the expression that best suits your needs -->
<input class="ev-button" value="CHECK AVAILABILITY" type="Submit">
</form>
<div class="s-ev-num-nights"></div>
</div>
/*STYLING THE SEARCH BAR */
.ev-searchbox {
/*Search Bar font family*/
font-family: Helvetica, Sans-Serif;
/*Search Bar background colour*/
background-color: #ffffff;
/*Search Bar inner space*/
padding: 10px;
/*Search Bar width*/
width: auto;
/*Search Bar shadow, RGBa black colour colour. Opacity set to 25%*/
box-shadow: 0 0 10px rgba(0, 0, 0, 0.25);
display: inline-block;
}
/*STYLING THE FIELD HEADERS*/
.ev-searchbox .ev-label {
display: block;
/*Space below the field names*/
margin: 0 0 3px 0;
/*Font size for the field names*/
font-size: 13px;
}
/*STYLING THE INPUT FIELDS*/
.ev-searchbox .ev-input,
.ev-searchbox .ev-select {
/*Input fields font size*/
font-size: 13px;
margin: 0;
/*Input fields inner spacing*/
padding: 6px;
width: 100%;
box-sizing: border-box;
/*Input fields border colour*/
border: 1px solid #ededed;
border-radius: 0px;
}
.ev-searchbox .ev-options {
margin: 0;
display: inline-block;
/*Input dates field width*/
width: 100px;
}
/*BOOKING BUTTON STYLING*/
.ev-searchbox .ev-button {
/*Button Text colour*/
color: #fff;
/*Button Background colour*/
background-color: #708090;
/*Button inner spacing*/
padding: 6px 12px;
/*Button Font-size*/
font-size: 14px;
/*Button Font-weight (thickness) */
font-weight: 500;
text-align: center;
margin: 0;
cursor: pointer;
border-radius: 6px;
border: none;
width: auto;
}
/*STYLING the Number of Nights message which appears after guests select dates*/
.ev-searchbox .s-ev-num-nights {
/*Font size*/
font-size: 12px;
padding-bottom: 6px;
/*Font colour*/
color: #708090;
}
.ev-searchbox .ev-invalid {
/*Styling how user errors are flagged: add red border if mandatory input fields are empty*/
border: 1px solid rgb(255, 0, 0);
}
.mod-options {
display: inline-block;
}
// $evjq SPECIALISED jQuery code to avoid conflicts
var $evjq = jQuery.noConflict();
$evjq(function () {
// The next few lines set up different date formats.
// 22 Apr 2022
var dateFormatUser_EU = "dd M yy";
// 12/22/2022
var dateFormatUser_US_ex1 = "M dd yy";
// 12/Apr/2022
var dateFormatUser_US_ex2 = "mm-dd-yy";
// Replace "EU" in the expresssion "dateformatUser_EU" below, by one of the above "US_ex1", or "US_ex2" to switch to a US date format.
var userDateFormat = dateFormatUser_EU; // Choose option from above
// DO NOT MODIFY without professional advice
var urlQueryParameterDateFormat = "yy-mm-dd";
// TRANSLATE CALENDAR AND CALENDAR COMMANDS BELOW
$evjq.defaultsLocalization = {
closeText: "Done",
prevText: "Prev",
nextText: "Next",
currentText: "Today",
monthNames: [
"January",
"February",
"March",
"April",
"May",
"June",
"July",
"August",
"September",
"October",
"November",
"December"
],
monthNamesShort: [
"Jan",
"Feb",
"Mar",
"Apr",
"May",
"Jun",
"Jul",
"Aug",
"Sep",
"Oct",
"Nov",
"Dec"
],
dayNames: [
"Sunday",
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
"Friday",
"Saturday"
],
dayNamesShort: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
dayNamesMin: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"],
weekHeader: "Wk",
firstDay: 1, // 1 - Monday, 0 Sunday
isRTL: false,
showMonthAfterYear: false,
yearSuffix: ""
};
$evjq.datepicker.setDefaults($evjq.defaultsLocalization);
$evjq("#startdate").datepicker({
// DO NOT MODIFY without professional advice
dateFormat: userDateFormat,
onSelect: showDays,
onClose: function (selectedDate) {
var dParts = selectedDate.split("-");
var in1Days = new Date(dParts[2] + "/" + dParts[1] + "/" + (+dParts[0] + 1));
$evjq("#enddate").datepicker("option", "minDate", in1Days);
$evjq("#enddate").datepicker("show");
},
minDate: 0,
// DO NOT MODIFY without professional advice
altFormat: urlQueryParameterDateFormat,
altField: "#startdate1"
});
$evjq("#enddate").datepicker({
// DO NOT MODIFY without professional advice
dateFormat: userDateFormat,
onSelect: showDays,
minDate: 0,
// DO NOT MODIFY without professional advice
altFormat: urlQueryParameterDateFormat,
altField: "#enddate1"
});
function showDays() {
var start = $evjq("#startdate").datepicker("getDate");
var end = $evjq("#enddate").datepicker("getDate");
if (!start || !end) return;
var days = (end - start) / 1000 / 60 / 60 / 24;
$evjq(".s-ev-num-nights")
// Change or Translate the text "Number of Nights" by another expression to suit you needs, for example: "Length of stay". The number of nights message appears after a guest has selected their stay dates to confirm the length of stay in number of nights.
.text("Number of nights " + days)
.show();
}
// DO NOT MODIFY without professional advice
var date = new Date(),
dateString =
date.getMonth() +
1 +
"/" +
date.getDate() +
"/" +
date.getFullYear().toString().substr(2, 2);
$evjq("#startdate").datepicker("setDate", date);
$evjq("#startdate,#enddate").blur(function () {
$evjq("#startdate,#enddate").removeClass("ev-invalid");
});
// DO NOT MODIFY without professional advice
$evjq("#availabilitySearchResults").submit(function () {
if ($evjq.trim($evjq("#startdate").val()) === "") {
$evjq("#startdate").addClass("ev-invalid");
return false;
}
if ($evjq.trim($evjq("#enddate").val()) === "") {
$evjq("#enddate").addClass("ev-invalid");
return false;
} else {
$evjq("#startdate,#enddate").removeClass("ev-invalid");
$evjq("#startdate,#enddate", this).attr("name", "");
$evjq("#startdate,#enddate", this).attr("value", "");
return true;
}
});
});
Also see: Tab Triggers