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. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.
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.
If the stylesheet 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 CSS 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.
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.
<p class="head"><i class="fa fa-jsfiddle" aria-hidden="true"></i> <a href="https://getbutterfly.com/javascript/">More JavaScript tutorials and code snippets</a></p>
<div class="bounty-wrapper">
<div class="bounty-offer" id="bounty1">
<div class="bounty-title"><i class="fa fa-ship"></i> Bounty Title</div>
<div class="bounty-map"><a href="#img1">View map <i class="fa fa-chevron-circle-right"></i></a></div>
<img src="https://placeimg.com/370/135/tech" class="bounty-image" alt="">
<div class="bounty-meta">
<div class="bounty-hr"></div>
<div><b>Date:</b> November 7th, 2016</div>
<div><b>Duration:</b> 3 weeks</div>
<div><b>Bounty Ship:</b> Queen of the Seas</div>
<div><b>Itinerary:</b> Unknown</div>
<div><b>Includes:</b> Breakfast, lunch and dinner</div>
<div><b>Upgrades:</b> Oceanview cabin and balcony</div>
</div>
<div class="bounty-bottom">
<div class="bounty-price"><b>Now from</b><br><span>$1,899<small>pps</small></span></div>
<div class="bounty-call">Call <b>04555 27120</b><br><small>to speak to our bounty team</small></div>
<a href="#" class="button toggleCallback1" onclick="return false;"><i class="fa fa-phone"></i> Request callback</a>
<a href="#" class="button toggleQuote1" onclick="return false;"><i class="fa fa-envelope"></i> Email me this bounty</a>
</div>
<div class="bounty-request-callback callback1">
<a href="#" class="button closeCallback1" onclick="return false;"><i class="fa fa-fw fa-times"></i></a>
<h3><i class="fa fa-phone"></i> Request callback</h3>
<form method="post">
<p>
<label>Your name</label>
<input type="text" placeholder="Your name">
</p>
<p>
<label>Your phone number</label>
<input type="text" placeholder="Your phone number">
</p>
<p>
<label>Preferred contact time</label>
<select>
<option value="">Select...</option>
<option>10:30am to 13:00pm</option>
<option>1:15pm to 3:30pm</option>
<option>3:30pm to 5:15pm</option>
</select>
</p>
<p>
<input type="submit" name="requestCallback" class="button" value="Request callback">
</p>
</form>
</div>
<div class="bounty-request-quote quote1">
<a href="#" class="button closeQuote1" onclick="return false;"><i class="fa fa-fw fa-times"></i></a>
<h3><i class="fa fa-envelope"></i> Email me this bounty</h3>
<form method="post">
<p>
<label>Name</label>
<input type="text" placeholder="Your name">
</p>
<p>
<label>Email address</label>
<input type="text" placeholder="Your email address">
</p>
<p><input type="checkbox"> Add a message?</p>
<div class="hideme">
<p>
<label>From (add your name)</label>
<input type="text" placeholder="From">
</p>
<p>
<label>Message</label>
<textarea rows="3"></textarea>
</p>
</div>
<p>
<input type="submit" name="requestQuote" class="button" value="Send">
</p>
</form>
</div>
<a href="#_" class="lightbox" id="img1"><img src="http://placehold.it/800x600"></a>
</div>
<div class="bounty-offer" id="bounty2">
<div class="bounty-title"><i class="fa fa-ship"></i> Bounty Title</div>
<div class="bounty-map"><a href="#img2">View map <i class="fa fa-chevron-circle-right"></i></a></div>
<img src="https://placeimg.com/370/135/arch" class="bounty-image" alt="">
<div class="bounty-meta">
<div class="bounty-hr"></div>
<div><b>Date:</b> November 7th, 2016</div>
<div><b>Duration:</b> 3 weeks</div>
<div><b>Bounty Ship:</b> Queen of the Seas</div>
<div><b>Itinerary:</b> Unknown</div>
<div><b>Includes:</b> Breakfast, lunch and dinner</div>
<div><b>Upgrades:</b> Oceanview cabin and balcony</div>
</div>
<div class="bounty-bottom">
<div class="bounty-price"><b>Now from</b><br><span>$1,899<small>pps</small></span></div>
<div class="bounty-call">Call <b>04555 27120</b><br><small>to speak to our bounty team</small></div>
<a href="#" class="button toggleCallback2" onclick="return false;"><i class="fa fa-phone"></i> Request callback</a>
<a href="#" class="button toggleQuote2" onclick="return false;"><i class="fa fa-envelope"></i> Email me this bounty</a>
</div>
<div class="bounty-request-callback callback2">
<a href="#" class="button closeCallback2" onclick="return false;"><i class="fa fa-fw fa-times"></i></a>
<h3><i class="fa fa-phone"></i> Request callback</h3>
<form method="post">
<p>
<label>Your name</label>
<input type="text" placeholder="Your name">
</p>
<p>
<label>Your phone number</label>
<input type="text" placeholder="Your phone number">
</p>
<p>
<label>Preferred contact time</label>
<select>
<option value="">Select...</option>
<option>10:30am to 13:00pm</option>
<option>1:15pm to 3:30pm</option>
<option>3:30pm to 5:15pm</option>
</select>
</p>
<p>
<input type="submit" name="requestCallback" class="button" value="Request callback">
</p>
</form>
</div>
<div class="bounty-request-quote quote2">
<a href="#" class="button closeQuote2" onclick="return false;"><i class="fa fa-fw fa-times"></i></a>
<h3><i class="fa fa-envelope"></i> Email me this bounty</h3>
<form method="post">
<p>
<label>Name</label>
<input type="text" placeholder="Your name">
</p>
<p>
<label>Email address</label>
<input type="text" placeholder="Your email address">
</p>
<p><input type="checkbox"> Add a message?</p>
<div class="hideme">
<p>
<label>From (add your name)</label>
<input type="text" placeholder="From">
</p>
<p>
<label>Message</label>
<textarea rows="3"></textarea>
</p>
</div>
<p>
<input type="submit" name="requestQuote" class="button" value="Send">
</p>
</form>
</div>
<a href="#_" class="lightbox" id="img2"><img src="http://placehold.it/800x600"></a>
</div>
<div class="bounty-offer" id="bounty3">
<div class="bounty-title"><i class="fa fa-ship"></i> Bounty Title</div>
<div class="bounty-map"><a href="#img3">View map <i class="fa fa-chevron-circle-right"></i></a></div>
<img src="https://placeimg.com/370/135/nature" class="bounty-image" alt="">
<div class="bounty-meta">
<div class="bounty-hr"></div>
<div><b>Date:</b> November 7th, 2016</div>
<div><b>Duration:</b> 3 weeks</div>
<div><b>Bounty Ship:</b> Queen of the Seas</div>
<div><b>Itinerary:</b> Unknown</div>
<div><b>Includes:</b> Breakfast, lunch and dinner</div>
<div><b>Upgrades:</b> Oceanview cabin and balcony</div>
</div>
<div class="bounty-bottom">
<div class="bounty-price"><b>Now from</b><br><span>$1,899<small>pps</small></span></div>
<div class="bounty-call">Call <b>04555 27120</b><br><small>to speak to our bounty team</small></div>
<a href="#" class="button toggleCallback3" onclick="return false;"><i class="fa fa-phone"></i> Request callback</a>
<a href="#" class="button toggleQuote3" onclick="return false;"><i class="fa fa-envelope"></i> Email me this bounty</a>
</div>
<div class="bounty-request-callback callback3">
<a href="#" class="button closeCallback3" onclick="return false;"><i class="fa fa-fw fa-times"></i></a>
<h3><i class="fa fa-phone"></i> Request callback</h3>
<form method="post">
<p>
<label>Your name</label>
<input type="text" placeholder="Your name">
</p>
<p>
<label>Your phone number</label>
<input type="text" placeholder="Your phone number">
</p>
<p>
<label>Preferred contact time</label>
<select>
<option value="">Select...</option>
<option>10:30am to 13:00pm</option>
<option>1:15pm to 3:30pm</option>
<option>3:30pm to 5:15pm</option>
</select>
</p>
<p>
<input type="submit" name="requestCallback" class="button" value="Request callback">
</p>
</form>
</div>
<div class="bounty-request-quote quote3">
<a href="#" class="button closeQuote3" onclick="return false;"><i class="fa fa-fw fa-times"></i></a>
<h3><i class="fa fa-envelope"></i> Email me this bounty</h3>
<form method="post">
<p>
<label>Name</label>
<input type="text" placeholder="Your name">
</p>
<p>
<label>Email address</label>
<input type="text" placeholder="Your email address">
</p>
<p><input type="checkbox"> Add a message?</p>
<div class="hideme">
<p>
<label>From (add your name)</label>
<input type="text" placeholder="From">
</p>
<p>
<label>Message</label>
<textarea rows="3"></textarea>
</p>
</div>
<p>
<input type="submit" name="requestQuote" class="button" value="Send">
</p>
</form>
</div>
<a href="#_" class="lightbox" id="img3"><img src="http://placehold.it/800x600"></a>
</div>
<div class="clearfix"></div>
</div>
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
font-size: 14px;
line-height: 1.5;
}
.head {
text-align: center;
color: #2C3E50;
}
.head a {
color: #2C3E50;
}
.bounty-wrapper {
background-color: #2C3E50;
padding: 40px;
margin: 0;
}
.bounty-wrapper * {
box-sizing: border-box;
}
.bounty-wrapper .bounty-offer {
border-radius: 4px;
margin: 0 78px 56px 0;
position: relative;
padding: 0 0 8px 0;
width: 370px;
height: 600px;
float: left;
background-color: #f1f1f1;
box-shadow: 0 4px 4px rgba(0, 0, 0, 0.25);
}
.bounty-wrapper .bounty-offer:nth-child(n+3) {
margin-right: 0;
}
.bounty-wrapper .bounty-offer .bounty-title {
text-transform: uppercase;
background-color: #34495E;
padding: 8px 10px;
color: #ffffff;
}
.bounty-wrapper .bounty-offer .bounty-map {
background-color: #3498DB;
padding: 6px 10px;
color: #ffffff;
font-size: 14px;
}
.bounty-wrapper .bounty-offer .bounty-map a {
color: #ffffff;
}
.bounty-wrapper .bounty-offer .bounty-map .fa {
float: right;
}
.bounty-wrapper .bounty-offer .bounty-hr {
width: 60%;
border-bottom: 1px solid #cccccc;
margin: 4px 0 4px 0;
}
.bounty-wrapper .bounty-offer .bounty-meta,
.bounty-wrapper .bounty-offer .bounty-price {
font-size: 14px;
line-height: 1.3;
}
.bounty-wrapper .bounty-offer .bounty-price span {
font-size: 32px;
font-weight: bold;
color: #3498DB;
}
.bounty-wrapper .bounty-offer .bounty-price span small {
font-size: 12px;
}
.bounty-wrapper .bounty-offer .bounty-call {
font-size: 24px;
border-bottom: 1px dotted #cccccc;
margin: 4px 0 8px 0;
padding: 0 0 4px 0;
}
.bounty-wrapper .bounty-offer .bounty-call small {
font-size: 18px;
line-height: 1;
}
.bounty-wrapper .bounty-offer .button {
display: inline-block;
background-color: #34495E;
color: #ffffff;
border-radius: 4px;
padding: 8px 6px;
text-decoration: none;
cursor: pointer;
font-size: 15px;
}
.bounty-wrapper .bounty-offer .button:hover {
background-color: #3498DB;
}
.bounty-wrapper .bounty-offer .bounty-image {
width: 370px;
height: 135px;
}
.bounty-wrapper .bounty-offer .bounty-meta,
.bounty-wrapper .bounty-offer .bounty-bottom {
margin: 0 10px;
}
.bounty-wrapper .bounty-offer .bounty-bottom {
position: absolute;
bottom: 10px;
left: 0;
}
.bounty-wrapper .bounty-offer input[type="submit"] {
border: 0 none;
font-family: inherit;
font-size: inherit;
}
.bounty-wrapper .bounty-offer input[type="text"],
.bounty-wrapper .bounty-offer input[type="email"],
.bounty-wrapper .bounty-offer select {
font-family: inherit;
font-size: inherit;
padding: 4px;
}
.bounty-wrapper .lightbox {
display: none;
position: fixed;
z-index: 999;
width: 100%;
height: 100%;
text-align: center;
top: 0;
left: 0;
background: rgba(0, 0, 0, 0.8);
}
.bounty-wrapper .lightbox {
transition: all 500ms ease-out 1s;
}
.bounty-wrapper .lightbox img {
max-width: 90%;
max-height: 80%;
margin-top: 2%;
}
.bounty-wrapper .lightbox:target {
outline: none;
display: block;
}
/* OVERLAYS */
.bounty-request-callback {
-ms-transform: rotate(-10deg);
transform: rotate(-10deg);
margin: 0 0 0 -72px;
opacity: 0;
filter: alpha(opacity=0);
z-index: -1;
background-color: rgba(255, 255, 255, 0.9);
position: absolute;
top: 0;
left: 0;
width: 370px;
height: 600px;
padding: 10px;
}
.bounty-request-callback.hover {
-ms-transform: rotate(0deg);
transform: rotate(0deg);
margin: 0 0 0 0;
opacity: 1;
filter: alpha(opacity=100);
z-index: 1;
}
.bounty-request-callback h3 {
margin: 32px 0;
font-size: 18px;
font-weight: bold;
}
.bounty-request-callback a.button {
float: right;
}
.bounty-request-callback form p {
margin: 0 0 16px 0;
}
.bounty-request-callback form label {
display: block;
margin: 0 0 4px 0;
}
.bounty-request-callback form input[type="text"],
.bounty-request-callback form input[type="email"],
.bounty-request-callback form textarea,
.bounty-request-callback form select {
width: 100%;
}
.bounty-request-callback {
transition: all 450ms cubic-bezier(0.680, -0.550, 0.265, 1.550);
}
.bounty-request-quote {
-ms-transform: rotate(10deg);
transform: rotate(10deg);
margin: 0 0 0 72px;
opacity: 0;
filter: alpha(opacity=0);
z-index: -1;
background-color: rgba(255, 255, 255, 0.9);
position: absolute;
top: 0;
left: 0;
width: 370px;
height: 600px;
padding: 10px;
}
.bounty-request-quote.hover {
-ms-transform: rotate(0deg);
transform: rotate(0deg);
margin: 0 0 0 0;
opacity: 1;
filter: alpha(opacity=100);
z-index: 1;
}
.bounty-request-quote h3 {
margin: 32px 0;
font-size: 18px;
font-weight: bold;
}
.bounty-request-quote a.button {
float: right;
}
.bounty-request-quote form p {
margin: 0 0 16px 0;
}
.bounty-request-quote form label {
display: block;
margin: 0 0 4px 0;
}
.bounty-request-quote form input[type="text"],
.bounty-request-quote form input[type="email"],
.bounty-request-quote form textarea,
.bounty-request-quote form select {
width: 100%;
}
.bounty-request-quote {
transition: all 450ms cubic-bezier(0.680, -0.550, 0.265, 1.550);
}
.clearfix {
clear: both;
}
@media screen and (max-width: 480px) {
.bounty-wrapper {
width: 90%;
}
.bounty-wrapper .bounty-offer {
width: 100%;
height: 700px;
}
.bounty-wrapper .bounty-offer .bounty-image {
width: 100%;
height: auto;
}
.bounty-wrapper .bounty-offer .bounty-bottom .button {
width: 100%;
margin: 0 0 10px 0;
padding: 14px 14px;
}
.bounty-request-callback {
width: 100%;
height: 600px;
}
.bounty-request-quote {
width: 100%;
height: 600px;
}
}
(function() {
/* button 1 */
var toggleBtn1 = document.querySelector('.toggleCallback1'),
closeBtn1 = document.querySelector('.closeCallback1'),
flipContainer1 = document.querySelector('.callback1');
var toggleQuoteBtn1 = document.querySelector('.toggleQuote1'),
closeQuoteBtn1 = document.querySelector('.closeQuote1'),
quoteContainer1 = document.querySelector('.quote1');
toggleBtn1.addEventListener('click', function() {
flipContainer1.classList.toggle('hover');
});
closeBtn1.addEventListener('click', function() {
flipContainer1.classList.toggle('hover');
});
toggleQuoteBtn1.addEventListener('click', function() {
quoteContainer1.classList.toggle('hover');
});
closeQuoteBtn1.addEventListener('click', function() {
quoteContainer1.classList.toggle('hover');
});
/* button 2 */
var toggleBtn2 = document.querySelector('.toggleCallback2'),
closeBtn2 = document.querySelector('.closeCallback2'),
flipContainer2 = document.querySelector('.callback2');
var toggleQuoteBtn2 = document.querySelector('.toggleQuote2'),
closeQuoteBtn2 = document.querySelector('.closeQuote2'),
quoteContainer2 = document.querySelector('.quote2');
toggleBtn2.addEventListener('click', function() {
flipContainer2.classList.toggle('hover');
});
closeBtn2.addEventListener('click', function() {
flipContainer2.classList.toggle('hover');
});
toggleQuoteBtn2.addEventListener('click', function() {
quoteContainer2.classList.toggle('hover');
});
closeQuoteBtn2.addEventListener('click', function() {
quoteContainer2.classList.toggle('hover');
});
/* button 3 */
var toggleBtn3 = document.querySelector('.toggleCallback3'),
closeBtn3 = document.querySelector('.closeCallback3'),
flipContainer3 = document.querySelector('.callback3');
var toggleQuoteBtn3 = document.querySelector('.toggleQuote3'),
closeQuoteBtn3 = document.querySelector('.closeQuote3'),
quoteContainer3 = document.querySelector('.quote3');
toggleBtn3.addEventListener('click', function() {
flipContainer3.classList.toggle('hover');
});
closeBtn3.addEventListener('click', function() {
flipContainer3.classList.toggle('hover');
});
toggleQuoteBtn3.addEventListener('click', function() {
quoteContainer3.classList.toggle('hover');
});
closeQuoteBtn3.addEventListener('click', function() {
quoteContainer3.classList.toggle('hover');
});
})();
Also see: Tab Triggers