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.
<div class="folio-filter">
<h6><a href="#">Filter by role: <span id="filter-type" class="muted">All</span></a></h6>
<ul class="filter-list">
<li><a href="#" data-role="all" class="selected">All</a></li>
<li><a href="#" data-role="ux">UX</a></li>
<li><a href="#" data-role="fed">Front End</a></li>
<li><a href="#" data-role="rwd">Responsive</a></li>
<li><a href="#" data-role="gfx">Visual Design</a></li>
<li><a href="#" data-role="research">User Research</a></li>
<li><a href="#" data-role="dev">Full Stack</a></li>
<li><a href="#" data-role="ia">IA</a></li>
<li><a href="#" data-role="write">Writing</a></li>
</ul>
</div>
<ul class="folio">
<li data-roles="ux fed rwd gfx dev write edit ia ">
<a href="https://stegrainer.com/portfolio/uxcellence">
<div>
<img src="https://stegrainer.com/-/img/thumbs/uxcellence/uxcellence-thumb.jpg" alt="UXcellence" />
<h5>UXcellence</h5>
</div>
</a>
</li>
<li data-roles="ux fed rwd gfx dev ia ">
<a href="https://stegrainer.com/portfolio/elespta">
<div>
<img src="https://stegrainer.com/-/img/thumbs/elespta/elespta-thumb.jpg" alt="Echo Lake Elementary PTA" />
<h5>Echo Lake Elementary PTA</h5>
</div>
</a>
</li>
<li data-roles="ux research gfx ">
<a href="https://stegrainer.com/portfolio/diehappy">
<div>
<img src="https://stegrainer.com/-/img/thumbs/diehappy/diehappy-thumb.jpg" alt="DieHappy" />
<h5>DieHappy</h5>
</div>
</a>
</li>
<li data-roles="ux fed rwd research ">
<a href="https://stegrainer.com/portfolio/vdot">
<div>
<img src="https://stegrainer.com/-/img/thumbs/vdot/vdot3.jpg" alt="Virginia Dept of Transportation" />
<h5>Virginia Dept of Transportation</h5>
</div>
</a>
</li>
<li data-roles="fed rwd ">
<a href="https://stegrainer.com/portfolio/dccu">
<div>
<img src="https://stegrainer.com/-/img/thumbs/dccu/dccu.jpg" alt="DuPont Community Credit Union" />
<h5>DuPont Community Credit Union</h5>
</div>
</a>
</li>
<li data-roles="ux fed rwd research gfx dev write edit ia ">
<a href="https://stegrainer.com/portfolio/gameskinny">
<div>
<img src="https://stegrainer.com/-/img/thumbs/gameskinny/gs.jpg" alt="GameSkinny" />
<h5>GameSkinny</h5>
</div>
</a>
</li>
<li data-roles="ux fed research ia ">
<a href="https://stegrainer.com/portfolio/snagajob-mobile">
<div>
<img src="https://stegrainer.com/-/img/thumbs/snagajob-mobile/sajmobile.jpg" alt="Snagajob Mobile" />
<h5>Snagajob Mobile</h5>
</div>
</a>
</li>
<li data-roles="ux fed gfx dev write ">
<a href="https://stegrainer.com/portfolio/vcu-filedrop">
<div>
<img src="https://stegrainer.com/-/img/thumbs/vcu-filedrop/filedrop.jpg" alt="VCU FileDrop" />
<h5>VCU FileDrop</h5>
</div>
</a>
</li>
<li data-roles="fed gfx dev edit ia ">
<a href="https://stegrainer.com/portfolio/vcu-atoz">
<div>
<img src="https://stegrainer.com/-/img/thumbs/vcu-atoz/atoz.png" alt="VCU A-Z Web Directory" />
<h5>VCU A-Z Web Directory</h5>
</div>
</a>
</li>
</ul>
html {
background: #ddd;
font-family: "Avenir Next", system-ui, -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, Arial, sans-serif;
}
body {
padding: 0 3em;
}
ul[class] {
margin: 0 0 1.5em;
padding: 0;
}
ul[class] li {
margin: 0;
}
h5 {
font-size: 1.777rem;
line-height: 1.58;
margin: 0;
}
h6 {
font-size: 1.333rem;
line-height: 1.051;
}
.folio {
display: grid;
grid-gap: 1.4em;
grid-template-columns: repeat(auto-fill, minmax(15em, 1fr));
list-style: none;
}
.folio a div, .folio a::after {
-webkit-clip-path:url(#folioHex);
clip-path:url(#folioHex); }
.folio a {
display: block;
transition: all 0.25s ease-in-out; }
.folio a::before {
display: none; }
.folio a div {
background: hsla(265,64%,52%,1);
background: linear-gradient(0deg, rgba(78,36,135,1) 0%, rgba(81,116,240,1) 100%);
overflow: hidden;
position: relative; }
.folio a img {
display: block;
margin: 0;
transition: all 0.25s ease-in-out;
width: 100%; }
.folio a h5 {
color: #fff;
left: 5%;
line-height: 1;
opacity: 0;
position: absolute;
text-align: center;
top: 50%;
transform: scale(0.9) translateY(-25%);
transition: all 0.25s ease-in-out;
width: 90%; }
.folio a::after {
background: hsla(265,57%,34%,1);
content: '';
display: block;
height: 100%;
left: 0;
opacity: 0;
position: absolute;
width: 100%;
top: 0;
transition: all 0.25s ease-in-out;
z-index: -1; }
.folio a:hover, .folio a:focus {
transform: scale(1.1); }
.folio a:hover img, .folio a:focus img {
filter: grayscale(100%) blur(0.15em);
opacity: 0.25;
transform: rotate(-3.25deg) scale(1.25); }
.folio a:hover h5, .folio a:focus h5 {
opacity: 1;
text-shadow: 0 0.1em 0.2em hsla(265,57%,34%,1);
transform: translateY(-50%); }
.folio a:hover::after, .folio a:focus::after {
opacity: 0.33;
transform: translate(0.2em, 0.2em); }
.folio-filter h6 {
margin-bottom: 0; }
.folio-filter h6 a {
box-shadow: none;
color: #333;
cursor: default;
text-decoration: none; }
.filter-list a.selected {
color: #333;
cursor: default;
font-weight: bold; }
.folio li {
height: auto;
opacity: 1;
transform: scale(1);
transition: opacity 0.25s ease-in-out, transform 0.25s ease-in-out; }
.folio li.hidden {
opacity: 0;
order: 1;
overflow: hidden;
transform: scale(0);
transition: opacity 0.25s ease-in-out, transform 0.25s ease-in-out; }
.folio li[aria-hidden="true"] a {
visibility: hidden; }
@media screen and (max-width: 31.95em) {
.folio-filter {
background: rgba(255,255,255,0.5);
border-radius: 0.35em;
margin-bottom: 1.4em;
position: relative; }
.folio-filter::after {
border-left: 0.5em solid transparent;
border-right: 0.5em solid transparent;
border-top: 0.5em solid #333;
content: '';
display: block;
height: 0;
opacity: 0.5;
position: absolute;
right: 0.5em;
top: 0.75em;
transition: transform 0.25s ease-in-out;
width: 0; }
.folio-filter h6 a {
display: block;
padding: 0.263em; }
.filter-list {
border-top: 0.05em solid rgba(255,255,255,0.25);
height: 0;
opacity: 0;
transition: opacity 0.25s ease-in-out, height 0.25s ease-in-out; }
.folio-filter.opened::after {
transform: rotate(180deg); }
.folio-filter.opened h6 a {
border-bottom: 0.05em solid rgba(0,0,0,0.1); }
.folio-filter.opened .filter-list {
display: block;
height: auto;
list-style: none;
opacity: 1; }
.filter-list a {
color: #333;
display: block;
padding: 0.35em; }
.filter-list a.selected, .filter-list a:hover, .filter-list a:focus {
background: #fff; }
.filter-list a:hover, .filter-list a:focus {
color: #06c; }
.folio li.hidden {
height: 0; }
}
@media screen and (min-width: 32em) {
.page > header nav {
margin: 0.7em; }
.folio-filter h6 .muted {
display: none; }
.filter-list {
transform: translateX(-0.7em); }
.filter-list li {
display: inline-block;
margin: 0.35em 0; }
.filter-list a {
border-radius: 0.35em;
display: block;
padding: 0.35em 0.7em; }
.filter-list a.selected, .filter-list a:hover, .filter-list a:focus {
background: rgba(255,255,255,0.5);
color: #333; }
}
var folioFilter = document.querySelector('.folio-filter');
var filterToggle = document.querySelector('.folio-filter h6 a');
var filterChoice = document.querySelector('.folio-filter h6 span')
var filters = document.querySelectorAll('.filter-list li a');
var folio = document.querySelectorAll('.folio li');
if(folioFilter) {
filterToggle.addEventListener('click', function(e) {
folioFilter.classList.toggle('opened');
e.preventDefault();
});
filters.forEach(function(elem) {
elem.addEventListener('click', function(e) {
var filterRole = this.getAttribute('data-role');
var i = 125;
if(filterRole == "all") {
var selectedFolio = folio;
} else {
var selectedFolio = document.querySelectorAll("[data-roles*='"+ filterRole +"']");
}
folioFilter.classList.remove('opened');
filterChoice.innerHTML = this.text;
filters.forEach(function(elem) {
elem.classList.remove('selected');
});
folio.forEach(function(elem) {
elem.classList.add('hidden');
elem.setAttribute('aria-hidden',true);
});
selectedFolio.forEach(function(elem) {
setTimeout(function() {
elem.classList.remove('hidden');
elem.setAttribute('aria-hidden',false);
}, i);
i = i + 125;
});
this.classList.add('selected');
e.preventDefault();
});
});
}
Also see: Tab Triggers