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>Cards</h2>
<p id="version">Last updated in <a href="https://cdn.watermarkinsights.com/css/rc/1.1.12.6/wm-global.css" target="blank">1.1.12</a></p>
<p>Cards may be used to visually organize content into sections. They may contain a header, a footer or both. The header may contain an appropriate heading (h1 - h6) with a class of <code>title</code>.</p>
<p>It may also have an element with an eyebrow title by adding an <code>eyebrowtitle</code> class.</p>
<div class="paper-card -inaset">
<div class="header">
<p class="eyebrowtitle">What it's all about</p>
<h3 class="title">The card title</h3>
</div>
<div class="body">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc aliquet consectetur ex ut pulvinar. Fusce mattis tristique tincidunt. Pellentesque id viverra tortor, eget tempor ex.</p>
<p>Morbi pulvinar tempus bibendum. In ultrices, diam ut interdum pellentesque, turpis sapien faucibus felis, tincidunt porta orci dolor eget ipsum. Vestibulum rutrum dui leo, eget fermentum quam fringilla in. Vestibulum vel nisi ac magna sollicitudin venenatis vitae eleifend dolor. Vivamus sed lobortis velit. Ut sed urna tortor. Curabitur ornare tortor ut arcu laoreet, ut ultrices turpis bibendum. Mauris diam magna, pretium ut est vel, sollicitudin porttitor dui. Morbi sit amet arcu pharetra, pharetra orci ut, vestibulum dui. Proin vulputate semper velit, a ornare ex. Suspendisse fringilla a nunc vitae elementum. Nulla blandit hendrerit magna ut faucibus.</p>
</div>
<div class="footer">
<div class="button-collection">
<wm-button>Cancel</wm-button>
<wm-button button-type="primary">Action</wm-button>
</div>
</div>
</div>
<div class="paper-card -inaset -nobottompadding">
<div class="header">
<h3 class="title">A second card in this set</h3>
</div>
<div class="body">
<p>Morbi egestas lectus vitae diam congue blandit. Proin iaculis velit enim, eu mollis quam molestie iaculis. Phasellus non tellus at justo lobortis consectetur.</p>
</div>
</div>
<div class="paper-card -empty -inaset">
<div class="header">
<h3 class="title">Data</h3>
</div>
<div class="body">
<h3 class="empty-hdr">
There is no data to show here
</h3>
<p class="description">
An explanation of why this is empty and how to go about resolving this issue.
</p>
</div>
</div>
<div class="paper-card -empty -notoppadding">
<div class="body">
<p class="description">
There is no table data.
</p>
<wm-button button-type="secondary">Add Data</wm-button>
</div>
</div>
<h2 id="variantclasseshdr">Variations</h2>
<p>The header, body and footer for standard cards, have padding aplied. By adding certain classes to the container element, this may be changed without having to write page-specific stying rules. Additionally, there are also a couple other helper classes, as follows:</p>
<table id="variantclasses" aria-labelledby="variantclasseshdr" class="data-table">
<thead>
<tr>
<th scope="col" class="dataheadercell">Class Name</th>
<th scope="col" class="dataheadercell">Effect</th>
</tr>
</thead>
<tbody>
<tr>
<td class="datacell" data-th="Class Name">-collapsed</td>
<td class="datacell" data-th="Effect">Removes the rule at the bottom of the header when a card is in a collapsed state.</td>
</tr>
<tr>
<td class="datacell" data-th="Class Name">-inaset</td>
<td class="datacell" data-th="Effect">Adds a space between cards that are stacked vertically in a set.</td>
</tr>
<tr>
<td class="datacell" data-th="Class Name">-nobottompadding</td>
<td class="datacell" data-th="Effect">Removes the padding from the bottom of the card.</td>
</tr>
<tr>
<td class="datacell" data-th="Class Name">-nopadding</td>
<td class="datacell" data-th="Effect">Removes the padding from the card.</td>
</tr>
<tr>
<td class="datacell" data-th="Class Name">-nosidepadding</td>
<td class="datacell" data-th="Effect">Removes the padding from the sides of the card.</td>
</tr>
<tr>
<td class="datacell" data-th="Class Name">-notoppadding</td>
<td class="datacell" data-th="Effect">Removes the padding from the top of the card.</td>
</tr>
<tr>
<td class="datacell" data-th="Class Name">-noborder</td>
<td class="datacell" data-th="Effect">Applied to the footer element: removes the rule above the footer.</td>
</tr>
</tbody>
</table>
html, body {
height: auto;
}
body {
padding: 0 20px 40px;
font-size: 14px;
}
h2 {
font-size: 24px;
font-weight: 600;
margin-bottom: 0;
&:not(:first-of-type) {
margin-top: 32px;
}
+ p {
margin-top: 0;
}
}
.paper-card {
max-width: 578px;
p {
margin: 0;
+ p {
margin-top: 16px;
}
}
}
#version {
font-style: italic;
}
import { defineCustomElements } from "https://cdn.jsdelivr.net/npm/@watermarkinsights/ripple@3.8.2/dist/loader/index.js";
defineCustomElements();
Also see: Tab Triggers