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.
<!-----------------------------------------------------------------------
Click Run Code or See HTML in new window.
Explore the simulation.
-------------------------------------------------------------------------
Source/Attribution:
Codepen
Nikki Pantony
https://codepen.io/nikkipantony/pen/qoKORX
------------------------------------------------------------------------>
<head>
<title>Kanban Board Simulation</title>
<body>
<link href="https://cdnjs.cloudflare.com/ajax/libs/normalize/8.0.0/normalize.css" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="style.css">
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/dragula/3.7.2/dragula.js"></script>
<meta charset="UTF-8">
</head>
<header>
<h1>Drag & Drop<br /><span>Lean Kanban Board</span></h1>
</header>
<div class="add-task-container">
<input type="text" maxlength="12" id="taskText" placeholder="New Task..." onkeydown="if (event.keyCode == 13)
document.getElementById('add').click()">
<button id="add" class="button add-button" onclick="addTask()">Add New Task</button>
</div>
<div class="main-container">
<ul class="columns">
<li class="column to-do-column">
<div class="column-header">
<h4>To Do</h4>
</div>
<ul class="task-list" id="to-do">
<li class="task">
<p>Analysis</p>
</li>
<li class="task">
<p>Coding</p>
</li>
<li class="task">
<p>Card Sorting</p>
</li>
<li class="task">
<p>Measure</p>
</li>
</ul>
</li>
<li class="column doing-column">
<div class="column-header">
<h4>Doing</h4>
</div>
<ul class="task-list" id="doing">
<li class="task">
<p>Hypothesis</p>
</li>
<li class="task">
<p>User Testing</p>
</li>
<li class="task">
<p>Prototype</p>
</li>
</ul>
</li>
<li class="column done-column">
<div class="column-header">
<h4>Done</h4>
</div>
<ul class="task-list" id="done">
<li class="task">
<p>Ideation</p>
</li>
<li class="task">
<p>Sketches</p>
</li>
</ul>
</li>
<li class="column trash-column">
<div class="column-header">
<h4>Trash</h4>
</div>
<ul class="task-list" id="trash">
<li class="task">
<p>Interviews</p>
</li>
<li class="task">
<p>Research</p>
</li>
</ul>
<div class="column-button">
<button class="button delete-button" onclick="emptyTrash()">Delete</button>
</div>
</li>
</ul>
</div>
<footer>
<p>Built with <a href="https://github.com/bevacqua/dragula" target="_blank">Dragula</a> and Vanilla JS by <a href="http://nikkipantony.com" target="_blank">Nikki Pantony</a></p>
</footer>
<script type="text/javascript" src="script.js"></script>
@import url("https://fonts.googleapis.com/css?family=Arimo:400,700|Roboto+Slab:400,700");
:root {
font-size: calc(0.5vw + 1vh);
}
* {
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
body {
min-width: 420px;
}
h1,
h4 {
font-family: "Arimo", sans-serif;
line-height: 1.3;
}
header h1 {
font-size: 2.4rem;
margin: 4rem auto;
}
span {
font-size: 3rem;
}
p {
font-family: "Roboto Slab", serif;
}
a,
a:link,
a:active,
a:visited {
color: #0066aa;
text-decoration: none;
border-bottom: #000013 0.16rem solid;
}
a:hover {
color: #000013;
border-bottom: #0066aa 0.16rem solid;
}
header,
footer {
width: 40rem;
margin: 2rem auto;
text-align: center;
}
.add-task-container {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
width: 20rem;
height: 5.3rem;
margin: auto;
background: #a8a8a8;
border: #000013 0.2rem solid;
border-radius: 0.2rem;
padding: 0.4rem;
}
.main-container {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
}
.columns {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-align: start;
-ms-flex-align: start;
align-items: flex-start;
margin: 1.6rem auto;
}
.column {
width: 8.4rem;
margin: 0 0.6rem;
background: #a8a8a8;
border: #000013 0.2rem solid;
border-radius: 0.2rem;
}
.column-header {
padding: 0.1rem;
border-bottom: #000013 0.2rem solid;
}
.column-header h4 {
text-align: center;
}
.to-do-column .column-header {
background: #ff872f;
}
.doing-column .column-header {
background: #13a4d9;
}
.done-column .column-header {
background: #15d072;
}
.trash-column .column-header {
background: #ff4444;
}
.task-list {
min-height: 3rem;
}
ul {
list-style-type: none;
margin: 0;
padding: 0;
}
li {
list-style-type: none;
}
.column-button {
text-align: center;
padding: 0.1rem;
}
.button {
font-family: "Arimo", sans-serif;
font-weight: 700;
border: #000013 0.14rem solid;
border-radius: 0.2rem;
color: #000013;
padding: 0.6rem 1rem;
margin-bottom: 0.3rem;
cursor: pointer;
}
.delete-button {
background-color: #ff4444;
margin: 0.1rem auto 0.6rem auto;
}
.delete-button:hover {
background-color: #fa7070;
}
.add-button {
background-color: #ffcb1e;
padding: 0 1rem;
height: 2.8rem;
width: 10rem;
margin-top: 0.6rem;
}
.add-button:hover {
background-color: #ffdd6e;
}
.task {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-pack: center;
-ms-flex-pack: center;
justify-content: center;
vertical-align: middle;
list-style-type: none;
background: #fff;
-webkit-transition: all 0.3s;
transition: all 0.3s;
margin: 0.4rem;
height: 4rem;
border: #000013 0.15rem solid;
border-radius: 0.2rem;
cursor: move;
text-align: center;
vertical-align: middle;
}
#taskText {
background: #fff;
border: #000013 0.15rem solid;
border-radius: 0.2rem;
text-align: center;
font-family: "Roboto Slab", serif;
height: 4rem;
width: 7rem;
margin: auto 0.8rem auto 0.1rem;
}
.task p {
margin: auto;
}
/* Dragula CSS Release 3.2.0 from: https://github.com/bevacqua/dragula */
.gu-mirror {
position: fixed !important;
margin: 0 !important;
z-index: 9999 !important;
opacity: 0.8;
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=80)";
filter: alpha(opacity=80);
}
.gu-hide {
display: none !important;
}
.gu-unselectable {
-webkit-user-select: none !important;
-moz-user-select: none !important;
-ms-user-select: none !important;
user-select: none !important;
}
.gu-transit {
opacity: 0.2;
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=20)";
filter: alpha(opacity=20);
}
/* Custom Dragula JS */
dragula([
document.getElementById("to-do"),
document.getElementById("doing"),
document.getElementById("done"),
document.getElementById("trash")
]);
removeOnSpill: false
.on("drag", function (el) {
el.className.replace("ex-moved", "");
})
.on("drop", function (el) {
el.className += "ex-moved";
})
.on("over", function (el, container) {
container.className += "ex-over";
})
.on("out", function (el, container) {
container.className.replace("ex-over", "");
});
/* Vanilla JS to add a new task */
function addTask() {
/* Get task text from input */
var inputTask = document.getElementById("taskText").value;
/* Add task to the 'To Do' column */
document.getElementById("to-do").innerHTML +=
"<li class='task'><p>" + inputTask + "</p></li>";
/* Clear task text from input after adding task */
document.getElementById("taskText").value = "";
}
/* Vanilla JS to delete tasks in 'Trash' column */
function emptyTrash() {
/* Clear tasks from 'Trash' column */
document.getElementById("trash").innerHTML = "";
}
Also see: Tab Triggers