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.
<h2>fancybox v3.5 - Scrollable content</h2>
<p>
Additional wrapping element is needed to keep the close button in place.<br />
This example also demonstrates how to disable touch events using <code>data-touch="false"</code> attribute.
</p>
<hr class="my-5" />
<p>
<a data-fancybox data-touch="false" href="#modal" class="btn btn-primary">Open demo</a>
</p>
<div id="modal">
<div class="content-header">
<button class="btn" onclick="javascript:$('#more').toggle();;">Toggle content</button>
</div>
<div class="content-scroll">
<p>
Cras at massa a tortor laoreet ullamcorper ac vitae felis. In ut sodales felis. Nam ante diam, porttitor ac sapien eu, hendrerit finibus mauris. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos.
</p>
<div id="more">
<p>
Ut auctor, justo et convallis viverra, risus augue egestas orci, vel pellentesque elit orci vel nisi. Duis in vehicula ligula, et finibus velit. Ut eu urna varius ligula tincidunt maximus. Fusce tincidunt tortor ac risus placerat laoreet. Cras feugiat, nibh ut vulputate mollis, diam lectus hendrerit mauris, euismod elementum velit diam sit amet nisl. Curabitur auctor ex felis, quis interdum ligula euismod non. Cras dignissim commodo nibh, a feugiat purus scelerisque at.
</p>
<p>
Quisque commodo elementum quam, id faucibus dui euismod in. Nam dapibus, libero ut feugiat commodo, velit velit ultricies tortor, auctor eleifend lorem tellus in urna. Phasellus nunc metus, facilisis eget malesuada cursus, tempus vitae nisl. Maecenas condimentum turpis libero, quis varius orci lacinia non. Donec vel massa elementum, molestie tortor vel, laoreet justo. Suspendisse potenti. Maecenas et luctus libero.
</p>
<p>
Proin tincidunt vestibulum velit, a congue odio porta interdum. Nunc congue congue enim vel vestibulum. Fusce ac diam at sem rhoncus tristique. Nullam imperdiet rhoncus mi et feugiat. Praesent tempus convallis mattis. Mauris sit amet ante non dui ullamcorper pretium eget quis lacus. Duis id velit est. Fusce a convallis purus. Nullam non orci risus. Vivamus sed vulputate eros. Sed non bibendum turpis. Sed gravida lorem sem, et hendrerit erat cursus nec. Proin feugiat purus ut varius suscipit. Aenean lobortis sem eget lacinia eleifend. Morbi vulputate sodales lobortis.
</p>
<p>
Nunc vitae est orci. Vivamus dignissim ex eu turpis dignissim, nec finibus dui faucibus. Vestibulum sed orci id elit tincidunt elementum. Aliquam imperdiet dictum tellus, sed iaculis sem ornare sed. Quisque blandit malesuada efficitur. Nulla molestie ultrices ornare. Nulla placerat enim eu pulvinar hendrerit. Pellentesque a consectetur erat. Pellentesque quis enim ut magna tincidunt egestas vel suscipit mauris. Donec porttitor venenatis finibus. Proin sit amet fermentum magna. Quisque lorem nibh, viverra quis libero quis, semper pulvinar sapien.
</p>
<p>
Donec ac sapien vitae turpis malesuada tempor vel ut nulla. Aliquam vehicula facilisis blandit. Suspendisse bibendum erat vel erat sollicitudin, ut imperdiet felis pretium. Nunc convallis, mi a condimentum pretium, nunc purus varius elit, ac tincidunt sapien elit non sem. Praesent id ipsum at mi aliquam accumsan. Fusce dapibus in leo id finibus. Curabitur hendrerit nisl vitae mauris suscipit, vel ultricies mauris dapibus.
</p>
<p>
Nullam in justo nisi. Maecenas tempor lacinia hendrerit. In hac habitasse platea dictumst. Donec lacus sapien, tincidunt in tellus a, vulputate porttitor est. Fusce ac felis eget ligula ullamcorper venenatis. Cras semper, ante sed tempus luctus, elit augue vehicula turpis, eget lobortis dui magna ac eros. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras sollicitudin metus ut velit lacinia dignissim. Donec dictum sed justo et finibus. Aliquam pharetra dictum iaculis. Nulla facilisi. Curabitur ullamcorper non dui eu eleifend.
</p>
<p>
Maecenas ex turpis, mollis non mauris sit amet, tempus aliquet ex. Vivamus et ultrices tellus. Maecenas tempus diam turpis, vitae consequat nunc pharetra a. Donec porta ex a tellus vehicula placerat. Nullam id pulvinar est. Nulla luctus pretium ligula sit amet porta. Pellentesque fermentum tempor elit, tempus porta sapien cursus et. Sed tortor ligula, ullamcorper eu tortor nec, pulvinar porttitor urna. Quisque eu neque rhoncus, blandit ante sit amet, sodales diam. Mauris interdum dictum massa, in euismod sem venenatis id. Nunc consectetur risus non diam ornare, eu pulvinar augue eleifend. Fusce nec tempor augue, eu ultrices nunc. Etiam nec purus augue. Maecenas elementum, neque viverra sollicitudin rutrum, urna metus malesuada libero, quis eleifend lacus tortor ac turpis. Donec vel felis velit.
</p>
<p>
Vestibulum cursus vitae diam vel ultricies. Donec scelerisque lacinia sodales. Sed facilisis massa in sem auctor, in iaculis velit egestas. Cras commodo risus a metus tristique, a cursus mi dapibus. Phasellus volutpat erat tincidunt augue sollicitudin efficitur. Quisque in ultrices neque, at aliquam turpis. Quisque tincidunt elementum sodales. Nulla auctor efficitur magna, ut semper leo ultricies vel. Aliquam ac odio eu orci elementum bibendum id ut tellus. Sed sed maximus enim, eu mollis elit. Nullam convallis gravida nisi, dignissim posuere nulla ultrices non. Fusce elementum finibus arcu, ac tempor sem facilisis eu. Curabitur semper faucibus maximus.
</p>
<p>
Praesent neque metus, pharetra vitae dolor et, ultricies vehicula massa. Praesent efficitur libero vitae facilisis dignissim. Fusce eleifend volutpat dolor at hendrerit. Proin at euismod lorem. Maecenas eget posuere orci. Donec convallis nisl arcu, in tristique purus consectetur ut. Ut laoreet sed neque sed volutpat. Ut semper tortor et ipsum volutpat porta. Fusce consectetur urna nulla, quis dapibus erat condimentum ut. Praesent a lacinia ante, non congue massa. Morbi congue tortor turpis, vel lacinia erat aliquam nec. Fusce pellentesque odio non volutpat blandit. Nulla in turpis nisl.
</p>
<p>
Proin fringilla rhoncus risus, nec consectetur nunc interdum at. Mauris posuere turpis quam, ut fringilla arcu molestie vulputate. Cras accumsan maximus tortor tristique condimentum. Fusce leo ex, tempus vel ante sed, varius tristique mi. Cras lobortis erat id nisi tempor, non auctor lectus commodo. Quisque id nisi pulvinar, lobortis nulla eu, mollis massa. Nunc fringilla faucibus placerat. Duis eu euismod lorem. In nec ultrices magna, sit amet tincidunt magna. Cras sollicitudin felis tortor, quis iaculis ligula mollis in. Suspendisse tincidunt vel lorem et tincidunt. Etiam tristique dolor sit amet metus consequat ullamcorper. Duis rutrum arcu et dolor commodo, vel scelerisque justo pulvinar.
</p>
</div>
</div>
</div>
#modal {
display: none;
width: 100%;
max-width: 600px;
padding: 0 0 40px 0;
text-align: justify;
border-radius: 3px;
box-shadow: 0 10px 20px rgba(0,0,0,0.19), 0 6px 6px rgba(0,0,0,0.23);
}
#modal .fancybox-close-small {
top: 15px;
}
#modal .content-header {
border-bottom: 1px solid #eee;
padding: 20px;
}
#modal .content-scroll {
max-height: calc(100vh - 200px);
overflow: auto;
padding: 40px 20px 0 20px;
}
Also see: Tab Triggers