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="container">
<p class="text-muted">Hover and click the pencil icon (<a href="https://codepen.io/jesperkc/pen/QNOEMJ" target="_blank">Updated version here</a>)</p>
<div class="row" data-bind="foreach: logs">
<div class="col-xs-4">
<div class="flip-container log-box" data-bind="css: css">
<div class="flipper embed-responsive embed-responsive-16by9">
<div class="front" data-bind="css: colorStyle">
<h3 data-bind="text: Name">Log name</h3>
<a href="#" class="log-box-button log-box-button-edit " data-bind="click: $parent.editLog, visible: Access() === 'Administrator'" title="Edit"><i class="fa fa-pencil"></i></a>
<div class="sparkline" data-bind="sparkline: sparklinedata"></div>
<div class="log-box-buttons-buttom">
<div class="access" data-bind="text: Access() + ' access'">Administrator access</div>
</div>
<div class="log-box-buttons-buttom">
<a href="#" class="log-box-button log-box-button-install" data-bind="click: $parent.viewLogSearch"><i class="fa fa-search"></i></a><a href="#" class="log-box-button log-box-button-install" data-bind="click: $parent.viewInstallLog, visible: Access() === 'Administrator'" title="Settings"><i class="fa fa-cogs"></i></a>
</div>
</div>
<div class="back" data-bind="css: colorStyle">
<div class="row">
<form method="POST" data-bind="submit: $parent.saveLog">
<div class="col-xs-7 col-sm-8 col-md-8 col-lg-9">
<input type="text" class="form-control" data-bind="value: Name" placeholder="Enter log name"><span class="validationMessage" style="display: none;"></span>
</div>
<div class="col-xs-5 col-sm-4 col-md-4 col-lg-3">
<input type="submit" class="btn btn-default btn-block" data-bind="click: $parent.saveLog" value="Save">
</div>
</form>
</div>
<div class="checkbox">
<label>
<input type="checkbox" data-bind="checked: DailyDigestEmail"> Daily Digest Email <span data-toggle="popover" data-trigger="hover" data-container="body" data-content="Daily Digest is a daily email containing a summary of the errors logged within the last 24 hours." class="fa fa-question-circle"></span>
</label>
</div>
<div class="checkbox">
<label>
<input type="checkbox" data-bind="checked: NewErrorEmail"> New Error Email <span data-toggle="popover" data-container="body" data-trigger="hover" data-content="New Error is a transactional email sent every time a new error is logged." class="fa fa-question-circle"></span>
</label>
</div>
<ul class="colorpicker">
<li class="green-bg selected" data-bind="click: $parent.selectColor, css: {selected: Color() == 'green'}"><span class="fa fa-check"></span></li>
<li class="lightgreen-bg" data-bind="click: $parent.selectColor, css: {selected: Color() == 'lightgreen'}"><span class="fa fa-check"></span></li>
<li class="lime-bg" data-bind="click: $parent.selectColor, css: {selected: Color() == 'lime'}"><span class="fa fa-check"></span></li>
<li class="yellow-bg" data-bind="click: $parent.selectColor, css: {selected: Color() == 'yellow'}"><span class="fa fa-check"></span></li>
<li class="orange-bg" data-bind="click: $parent.selectColor, css: {selected: Color() == 'orange'}"><span class="fa fa-check"></span></li>
<li class="deeporange-bg" data-bind="click: $parent.selectColor, css: {selected: Color() == 'deeporange'}"><span class="fa fa-check"></span></li>
<li class="red-bg" data-bind="click: $parent.selectColor, css: {selected: Color() == 'red'}"><span class="fa fa-check"></span></li>
<li class="pink-bg" data-bind="click: $parent.selectColor, css: {selected: Color() == 'pink'}"><span class="fa fa-check"></span></li>
<li class="purple-bg" data-bind="click: $parent.selectColor, css: {selected: Color() == 'purple'}"><span class="fa fa-check"></span></li>
<li class="deeppurple-bg" data-bind="click: $parent.selectColor, css: {selected: Color() == 'deeppurple'}"><span class="fa fa-check"></span></li>
<li class="blue-bg" data-bind="click: $parent.selectColor, css: {selected: Color() == 'blue'}"><span class="fa fa-check"></span></li>
<li class="lightblue-bg" data-bind="click: $parent.selectColor, css: {selected: Color() == 'lightblue'}"><span class="fa fa-check"></span></li>
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
body {
background: #e7edf2;
margin: 3em;
}
@green: #0da58e;
@light-green: #8cc152;
@lime: #cdda49;
@yellow: #fdc02f;
@orange: #fd9727;
@deep-orange: #fc5830;
@red: #e2202c;
@pink: #e62565;
@purple: #9b2fae;
@deep-purple: #673fb4;
@blue: #4054b2;
@light-blue: #587bf8;
.green-bg {
background-color: @green;
}
.lightgreen-bg {
background-color: @light-green;
}
.lime-bg {
background-color: @lime;
}
.yellow-bg {
background-color: @yellow;
}
.orange-bg {
background-color: @orange;
}
.deeporange-bg {
background-color: @deep-orange;
}
.red-bg {
background-color: @red;
}
.pink-bg {
background-color: @pink;
}
.purple-bg {
background-color: @purple;
}
.deeppurple-bg {
background-color: @deep-purple;
}
.blue-bg {
background-color: @blue;
}
.lightblue-bg {
background-color: @light-blue;
}
.log-box{
color: #fff;
h3 {
margin-top: 0;
margin-bottom: 3px;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
line-height: 20px;
padding-bottom: 10px;
}
.log-box-button{
color: #fff;
display: none;
opacity: .5;
padding: 5px 8px;
font-size: 13px;
margin-bottom: -5px;
&:hover{
opacity: 1;
}
}
.log-box-button-edit{
position: absolute;
right: 10px;
bottom: 10px;
}
.log-box-buttons-buttom{
position: absolute;
left: 10px;
bottom: 10px;
a{
margin-left: 0px;
}
}
.colorpicker {
font-size: 0;
padding: 0;
margin: 0;
position: absolute;
bottom: 0;
left: 0;
width: 100%;
border-top: 1px solid rgba(255, 255, 255, 0.3);
li {
display: inline-block;
width: 8.333333333333334%;
height: 40px;
position: relative;
font-size: 14px;
color: #fff;
cursor: pointer;
&:first-child{
border-radius: 0 0 0 5px;
}
&:last-child{
border-radius: 0 0 5px 0;
}
span{
width: 100%;
height: 40px;
text-align: center;
padding-top: 13px;
pointer-events: none;
&:before{
opacity: 0;
}
}
&.selected span:before{
opacity: 1;
}
&:hover span:before{
opacity: .5;
}
}
}
div[class*=col-]{
&:first-child{
padding-right: 7px;
}
&:last-child{
padding-left: 7px;
}
}
.access{
opacity: .5;
}
&:hover{
.access{
display: none;
}
.log-box-button{
display: inline-block;
}
}
.btn{
background-color: transparent;
border-color: #fff;
color: #fff;
&:active{
background-color: transparent;
border-color: #fff;
color: #fff;
}
}
}
.sparkline{
font-size: 0;
position: absolute;
top: 60px;
bottom: 38px;
left: 0;
right: 0;
}
.sparkline path {
stroke-width: 2;
fill: none;
stroke: white;
}
.flip-container {
-webkit-perspective: 1000;
-moz-perspective: 1000;
}
.flip-container, .front, .back {
width: 100%;
height: 100%;
}
.flip-container.flipped {
}
.flip-container .flipper {
box-shadow: 0 ;
}
.flip-container.flipped .flipper {
-webkit-transform: rotateY(180deg);
-moz-transform: rotateY(180deg);
margin: -20px -20px 0 -20px;
box-shadow: 0 6px 10px rgba(0,0,0,.1), 0 60px 90px rgba(0,0,0,.3);
}
.flip-container.flipped .front {
}
.flipper {
-webkit-transition: 0.6s;
-webkit-transform-style: preserve-3d;
-moz-transition: 0.6s;
-moz-transform-style: preserve-3d;
position: relative;
overflow: initial;
border-radius: 5px;
//background-color: #000;
}
.front, .back {
-webkit-backface-visibility: hidden;
-moz-backface-visibility: hidden;
position: absolute;
top: 0;
left: 0;
border-radius: 5px;
padding: 15px;
}
.front {
z-index: 1;
}
.back {
-webkit-transform: rotateY(-180deg);
-moz-transform: rotateY(-180deg);
border-width: 0px;
top: 0;
bottom: -40px;
height: auto;
.row:first-child{
margin-bottom: 17px;
}
transition: background-color .3s;
}
ko.bindingHandlers.sparkline = {
init: function (element, valueAccessor, allBindingsAccessor, viewModel, bindingContext) {
},
update: function (element, valueAccessor, allBindingsAccessor, viewModel, bindingContext) {
var value = valueAccessor(), allBindings = allBindingsAccessor();
value = value();
console.log(value);
if (value) {
var setMuteClass = false;
if (!value.length) {
setMuteClass = true;
value = [1, 1];
}
var w = $(element).width(), h = $(element).height(), padding = 1;
h = h - (padding * 2);
//w = w - (padding * 2);
var yWind = d3.scale.linear().domain([d3.min(value), d3.max(value)]).range([0, h]),
x = d3.scale.linear().domain([0, value.length - 1]).range([0, w]);
var vis = d3.select(element)
.html("")
.append("svg:svg")
.attr("width", w + (padding * 2))
.attr("height", h + (padding * 2));
var g = vis.append("svg:g")
.attr("transform", "translate(0, " + h + ")");
var lineWind = d3.svg.line()
.x(function (d, i) { return x(i); })
.y(function (d) { return -1 * yWind(d); });
if (setMuteClass == true) {
g.append("svg:path").attr("d", lineWind(value)).attr("class", "muted");
} else {
g.append("svg:path").attr("d", lineWind(value));
}
}
}
};
module elmah {
export class log {
public Id = ko.observable(1);
public Name = ko.observable('Elmah.io');
public Color = ko.observable('Orange');
public Access = ko.observable('Administrator');
public DailyDigestEmail = ko.observable(false);
public NewErrorEmail = ko.observable(false);
public editing = ko.observable(false);
public css = ko.computed(()=>{return this.editing() ? 'flipped' : ''});
public colorStyle = ko.computed(()=>{return this.Color().toLowerCase() + '-bg'});
public sparklinedata = ko.observableArray([0,1,2,5,4,2,0,1,0,0, 0,0,2,3,5,8,4,4,3,1,1,0,0,0]);
}
export class dashboard {
public logs = ko.observableArray();
constructor(){
this.logs.push(new elmah.log());
this.logs.push(new elmah.log());
this.logs.push(new elmah.log());
this.logs()[0].Color('green');
this.logs()[1].Color('lightgreen');
this.logs()[2].Color('lime');
this.logs()[1].Name('Codepen.io');
this.logs()[2].Name('Google.dk');
}
public selectColor = (n,t)=>{
n.Color($(t.target).attr("class").replace("-bg","").replace("-",""));
}
public editLog = (obj)=>{
this.logs().forEach((obj)=>{obj.editing(false);});
obj.editing(true);
}
public saveLog = (obj)=>{
obj.editing(false);
}
}
}
var vm = new elmah.dashboard();
ko.applyBindings(vm);
$(function () {
$('[data-toggle="popover"]').popover()
})
$(".user-switch").tooltip();
$(".user-switch").on('click', function(){
$(this).toggleClass("selected");
});
// run demo if in searchresult preview
function demo(){
setTimeout(function(){
$(".log-box").eq(2).addClass('flipped');
}, 1000);
}
$(document).ready(function(){
if (document.location.pathname.indexOf('fullcpgrid')>-1){
demo();
}
});
Also see: Tab Triggers