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.
<h1>GDPR</h1>
<p>Example popup</p>
<ul>
<li><a href="http://placehold.it/600x600" class="btn popup-link">Privacy Details and Opt-ins</a></li>
</ul>
$primary-color: #388ff6;
body {
padding: 40px;
background: $primary-color;
font-family: 'Open Sans', sans-serif;
color:#fff;
text-align:center;
font-weight:300;
}
h1 {
margin-bottom:0;
}
p {
margin:0;
color: lighten($primary-color, 25%);
}
ul {
list-style-type: none;
margin:20px auto;
padding-left: 0;
}
li {
margin-bottom:10px;
display:inline;
}
.mfp-figure figure {
margin:0;
}
.btn {
color: lighten($primary-color, 25%);
display:inline;
padding: 10px 20px;
background: darken($primary-color, 10%);
text-decoration:none;
border-radius:3px;
transition: all 0.3s ease-in-out;
line-height:50px;
box-shadow: 0px 3px 0px 0px darken($primary-color, 15%);
&:hover {
color: lighten($primary-color, 40%);
box-shadow: 0px 1px 0px 0px darken($primary-color, 15%);
background: darken($primary-color, 8%);
}
&:active, &:focus {
-webkit-appearance: none;
outline:none;
}
}
.k tr>*:first-child {
min-width:300px;
max-width:500px;
width:400px;
}
.k td {
vertical-align:middle !important;
}
.k tr>*:not(:nth-child(1)) {
text-align:center;
}
p {
padding-top: 25px;
}
.mfp-close-btn-in .mfp-close {
color: #ffffff;
}
.white-popup {
position: relative;
padding: 20px;
width: auto;
margin: 20px auto;
}
$(document).ready(function() {
$(".popup-link").magnificPopup({
items: {
removalDelay: 300,
src: '<div class="white-popup animated fadeInUp"> <form id="gdpr" action="#" method="post"> <div class="container"> <div class="row"> <div class="col-xs-12"> <h2>Keep in touch with us<br /><small>Marketing permissions & preferences</small></h2> <p>Please tick the boxes below to tell us all the ways you would prefer to hear from us:</p> </div> </div> <div class="row"> <div class="col-xs-12"> <table class="table table-responsive k"> <tr> <th></th> <th> Email<br /> <input type="checkbox" name="lvl1-email" id="lvl1-email" checked /> </th> <th> SMS<br /> <input type="checkbox" name="lvl1-sms" id="lvl1-sms" checked /> </th> <th> Mobile<br /> <input type="checkbox" name="lvl1-mobile" id="lvl1-mobile" checked /> </th> <th> Landline<br /> <input type="checkbox" name="lvl1-landline" id="lvl1-landline" checked /> </th> <th> Post<br /> <input type="checkbox" name="lvl1-post" id="lvl1-post" checked /> </th> </tr> <tr> <td> <h3>Marketing<br /><small>Exciting offers and news about our products and services</small></h3> </td> <td><input type="checkbox" class="lvl2-email" name="lvl2-email-marketing" id="lvl2-email-marketing" checked /></td> <td><input type="checkbox" class="lvl2-sms" name="lvl2-sms-marketing" id="lvl2-sms-marketing" checked /></td> <td><input type="checkbox" class="lvl2-mobile" name="lvl2-mobile-marketing" id="lvl2-mobile-marketing" checked /></td> <td><input type="checkbox" class="lvl2-landline" name="lvl2-landline-marketing" id="lvl2-landline-marketing" checked /></td> <td><input type="checkbox" class="lvl2-post" name="lvl2-post-marketing" id="lvl2-post-marketing" checked /></td> </tr> <tr> <td> <h3>Rewards<br /><small>Don"t miss out on the biggest events</small></h3> <p class="text-right"></td><td></td> <td></td> <td></td> </tr> <tr class="lvl3 active"> <td> <p class="text-right">Sports</p> </td> <td><input type="checkbox" class="lvl3-email-reward" name="lvl3-email-reward-sports" id="lvl3-email-reward-sports" checked /></td> <td><input type="checkbox" class="lvl3-sms-reward" name="lvl3-sms-reward-sports" id="lvl3-sms-reward-sports" unchecked /></td> <td></td> <td></td> <td></td> </tr> <tr class="lvl3 active"> <td> <p class="text-right">Music</p> </td> <td><input type="checkbox" class="lvl3-email-reward" name="lvl3-email-reward-music" id="lvl3-email-reward-music" checked /></td> <td><input type="checkbox" class="lvl3-sms-reward" name="lvl3-sms-reward-music" id="lvl3-sms-reward-music" unchecked /></td> <td></td> <td></td> <td></td> </tr> <tr class="lvl3 active"> <td> <p class="text-right">Family</p> </td> <td><input type="checkbox" class="lvl3-email-reward" name="lvl3-email-reward-family" id="lvl3-email-reward-family" checked /></td> <td><input type="checkbox" class="lvl3-sms-reward" name="lvl3-sms-reward-family" id="lvl3-sms-reward-family" unchecked /></td> <td></td> <td></td> <td></td> </tr> </table> </div> </div> <div class="row"> <div class="col-xs-12"> <h2>Profiling permission<br /><small>What is profiling?</small></h2> <p>Profiling helps our company to provide you with the best customer journey. Thanks to automated processing on your personal data, <strong>we are able to send you offers that meet your needs and news you could be interested in</strong>.</p> <p><input type="checkbox" name="profiling" id="profiling" unchecked /> <strong>I do not agree with profiling.</strong></p> <p></p></div> </div> <div class="row"> <div class="col-md-6"> <div class="panel panel-default"> <div class="panel-body"> <h2>Survey<br /><small>Help us to improve our services and products</small></h2> <p>At company X, we are always seeking new ways to improve our products and services. And the best way to do that is to ask our customers. We really appreciate your time and the valuable insights which you can provide. If you have a minute to spare, your response would be much appreciated.</p> <p><input type="checkbox" name="survey" id="survey" unchecked /> <strong>Yes, I want to participate to a survey for a better understanding of my consumption.</strong></p> <p class="text-left">Time needed to complete the survey: 10 to 15 minutes.</p> <p>Our Customer Service will contact you soon.</p> </div> </div> </div> <div class="col-md-6"> <div class="panel panel-default"> <div class="panel-body"> <h2>Rewards - Our partners</h2> <p>Tell us if you would like information from our venue partners.</p> <p><input type="checkbox" name="rewards-partners" id="survey" unchecked /> <strong>Yes, I would like to hear about the latest news and events. </strong></p> <p>From time to time as a member of our company, we may need to transfer your personal information to one/or all of our carefully selected venue partners (for their own marketing purposes). We need your consent to transfer this information. If at any time you change your mind, just let us know.</p> <p>If at any time you would like to change any of your preferences, please be aware that you can do so free of charge by contacting us at XXXX XX XX XX or through your online account in the My Details section. We are open Monday to Friday from 8am to 8pm. These calls will be charged at Lo Call rates from any landline in the Republic of Ireland. Calls made from mobiles will cost more.</p> </div> </div> </div> <div class="clearfix"></div> <div class="col-xs-12"> <p class="text-center"><button type="button" name="display-json" class="btn btn-primary btn-lg">Save my preferences</button></p> <p>All changes will be effective in a delay of 48 hours. Last update: XX/XX/XXXX</p> </div> </div> </div> </form> </div>',
type: 'inline'
}
});
});
Also see: Tab Triggers