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 id="top">
<h1>CSS <span>Filter</span></h1>
<div class="top-menu">
<a href="#codigo" class="btn">Code</a>
</div>
<input name="url" class="img-url" type="text" placeholder="Paste a URL and press enter">
</div>
<!-- =============================================================
FIM TOP
=============================================================-->
<aside>
<div class="group">
<h2>Filter</h2>
<ul id="filter">
<li >
<label>Blur</label>
<span id="blur-val">0</span>
<input id="blur" class="slider" type="range" value="0" step="1" max="20" >
</li>
<li >
<label>Saturate</label>
<input id="saturate" class="slider" type="range" value="0" step=".1" max="10" >
<span id="saturate-val">0</span>
</li>
<li >
<label>Contrast</label>
<input id="contrast" class="slider" type="range" value="2" step=".1" max="10" >
<span id="contrast-val">0</span>
</li>
<li >
<label>Brightness</label>
<input id="brightness" class="slider" type="range" value="1" step=".1" max="10" >
<span id="brightness-val">0</span>
</li>
<li >
<label>Invert</label>
<input id="invert" class="slider" type="range" value="0" step=".01" max="1" >
<span id="invert-val">0</span>
</li>
<li >
<label>Sepia</label>
<input id="sepia" class="slider" type="range" value="0" step=".01" max="1" >
<span id="sepia-val">0</span>
</li>
<li >
<label>Grayscale</label>
<input id="grayscale" class="slider" type="range" value="0" step=".01" max="1" >
<span id="grayscale-val">0</span>
</li>
<li >
<label>Hue</label>
<input id="hue" class="slider" type="range" value="0" step="1" max="360" >
<span id="hue-val">0</span>
</li>
<div class="reset">Reset Filter</div>
</ul>
</div>
<p class="name"><span>Under construction</span> By Jordano Aragão
</aside>
<div id="corpo" >
<div id="imgout">
<img id="imagem" src="https://lh4.googleusercontent.com/-Q7A3wyV6-rM/U4ACjLzIEjI/AAAAAAAAEcs/hSNfUfWvoj0/w1545-h869-no/komb.jpg">
</div>
</div>
<div id="codigo">
<pre>
<code class="css">
#codigo pre code {
display: block;
background: rgba(0, 0, 0, 0);
color: #c5c8c6;
font-family: lato, Menlo, Monaco, Consolas, monospace;
line-height: 1.5;
padding: 10px;
}
</code>
</pre>
</div>
<div class="zoom"> <div class="group" >
<label>Zoom</label>
<input id="zoom" class="slider" type="range" value=".9" step=".01" min=".1" max="10" >
<span id="zoom-val">0</span>
</div>
</div>
<script src="https://yandex.st/highlightjs/7.5/highlight.min.js"></script>
<link rel="stylesheet" href="https://yandex.st/highlightjs/7.5/styles/default.min.css">
@import url(https://fonts.googleapis.com/css?family=Open+Sans:400,300,600,700);
body{font-family: 'open sans', helvetica, arial, 'sans-serif';
background:#131313;
background-image:
linear-gradient(0deg, rgba(255, 2555, 255, .03) 1px, transparent 1px),
linear-gradient(90deg, rgba(255, 255, 255, .03) 1px, transparent 1px);
background-size:10px 10px;}
#top{width:100%; height:56px; background:#699; position:fixed; top:0; z-index:99;
}
#top h1{line-height:56px; margin:0; padding:0 0 0 10px; font-weight:200; font-size:21px; color:#333; display:block;width:210px; float:left}
#top h1 span{font-weight:600;}
.img-url{float:right; height:32px; line-height:32px; padding:0 5px; margin:12px 30px; font-weight:200; border:none; width:240px}
#top a{text-decoration:none !important}
.top-menu{ display:block; float:left; overflow:hidden}
.top-menu > *{line-height:56px; border-left:1px solid rgba(0, 0, 0, .3); padding:0 11px 0 10px; text-align:center; cursor:pointer; color:#222; float:left; font-weight:200; text-shadow: 1px 0 #222;
transition:all .5s ease;}
.top-menu > *:hover{color:#222; background:#5aa;
}
.top-menu > *:last-child{border-right:1px solid rgba(0, 0, 0, .3); }
.top-menu .active{color:#399; background:#222;}
/* ======================================================================
FIM TOP
======================================================================*/
aside{width:220px; padding:; background:#222;top:56px; bottom:0; position:fixed; z-index:99;}
aside ul{margin:0; padding:0; display:none;
transition:all 3s ease; overflow:hidden; }
aside li{ overflow:hidden; margin-top:10px;}
aside label{color:#ccc; font-size:13px; }
#filter span{font-size:13px;
right:0; padding:0 5px;
}
aside .group{ padding:10px; border-bottom:1px solid #333;overflow:hidden;}
aside h2{ font-size:16px; margin:0; line-height:30px; font-weight:200; color:#666; cursor:pointer; position:relative;transition:all 1s ease;}
aside h2:after{content:"+"; position:absolute; right:10px;line-height:30px;}
aside h2:hover{color:#399}
.activegroup:after{content:"-" !important;}
.activegroup + ul{display:block}
/*---------------------------------------------------
Range
-----------------------------------------------------*/
/* Desperate to remove focus outline in firefox */
::-moz-focus-inner {
outline:0;
}
:focus {
outline:0;
}
input[type=range]{
padding: 0;
margin: 0;
background: transparent;
border: none;
box-sizing: border-box;
background-clip: padding-box;
vertical-align: top;
outline: none;
-webkit-appearance: none;
float:right;
}
/*
Declarations get duplicated because an invalid selector
invalidates the entire declaration block
*/
input[type=range]::-webkit-slider-thumb {
cursor: pointer;
-webkit-appearance: none;
-webkit-transition:all .5s ease;
}
input[type=range]::-moz-range-thumb {
cursor: pointer;
}
input[type=range]{
border-radius: 0px;
border: 1px solid #000;
background: rgba(0,0,0,.5);
height: 1rem;
border-radius: 0;
border:none
}
input[type=range]::-moz-range-track {
border-radius: 0;
background: rgba(0,0,0,.5);
height: 1rem;
border-radius: 0px;
border:none
}
input[type=range]{
height: 5px;
}
input[type=range]::-moz-range-track {
height: 5px; border:none;
}
/*
Declarations get duplicated because an invalid selector
invalidates the entire declaration block
*/
input[type=range]::-webkit-slider-thumb {
height: 13px;
width: 13px;
border-radius: 0px;
background: #3A3A3A;
}
input[type=range]::-webkit-slider-thumb {
height: 13px;
width: 13px;
background: #3A3A3A;
border-radius:0px;
}
input[type=range]::-moz-range-thumb {
height: 13px;
width: 13px;
border:none;
border-radius: 0px;
background: #3A3A3A;
background-size: 7px 18px;
-moz-transition:all .5s ease;
}
input[type=range]::-moz-range-thumb {
height: 13px;
width: 13px;
background: #3A3A3A;
border-radius:0px;
transition:all .5s ease;
}
/*
hover state
*/
input[type=range]:hover::-webkit-slider-thumb {
background: #399;
}
input[type=range]:hover::-moz-range-thumb {
background: #399;
}
/*
Active state
*/
input[type=range]:active::-webkit-slider-thumb {
background: #366;
}
input[type=range]:active::-moz-range-thumb {
background: #366;
}
input[type=range]{ margin:15px 0; padding:0px 0; width:100%;}
/*---------------------------------------------------
reset
-----------------------------------------------------*/
.reset{ width:100%; height:42px; background:#3a3a3a; text-align:center; cursor:pointer; line-height:42px; margin-top:20px;
transition:all .5s ease;}
.reset:hover{background:#399}
.reset:active{background:#366}
/* ======================================================================
FIM aside
======================================================================*/
#corpo{ position:fixed;top:56px; left:220px; overflow: scroll; z-index:2; border: solid 3px #131313;
}
img{max-width:100%; max-height:90%;
z-index:1;
transform: scale(1);
-webkit-filter: ;
}
#imgout{border:solid 1px #000; display:inline-block;
/*position:absolute; top:0; bottom:0;left:0; right:0;*/ box-shadow:0 0 10px 2px #000; overflow:hidden; margin:auto;}
/* ======================================================================
FIM corpo
======================================================================*/
#codigo{ width:340px; background:#131313; z-index:4;
height:100%; position:fixed;top:58px; bottom:0; left:-360px; transition:all 1s ease; box-shadow: 3px 0 2px 0 #000}
#codigo.active{left:220px;}
.zoom{position:fixed; padding-left:224px; bottom: 0; z-index:3; margin:auto; left:0; right: 0;}
#corpo:hover ~.zoom, .zoom:hover{background: rgba(33, 33, 33, .8);}
.zoom > .group{ overflow:hidden; padding:5px 0; margin:0; width:90%; margin:auto}
/* ======================================================================
FIM code
======================================================================*/
/* Tema para os códigos */
.tomorrow-comment, pre .comment, pre .title {
color: #969896 !important;
}
.tomorrow-red, pre .variable, pre .attribute, pre .tag, pre .regexp, pre .ruby .constant, pre .xml .tag .title, pre .xml .pi, pre .xml .doctype, pre .html .doctype, pre .css .id, pre .css .class, pre .css .pseudo {
color: #cc6666 !important;
}
#codigo .tomorrow-orange, pre .number, pre .preprocessor, pre .built_in, pre .literal, pre .params, pre .constant {
color: #F99157 !important;
}
.tomorrow-yellow, pre .class, pre .ruby .class .title, pre .css .rules .attribute {
color: #f0c674 !important;
}
.tomorrow-green, pre .string, pre .value, pre .inheritance, pre .header, pre .ruby .symbol, pre .xml .cdata {
color: #b5bd68 !important;
}
.tomorrow-aqua, pre .css .hexcolor {
color: #8abeb7 !important;
}
.tomorrow-blue, pre .function, pre .python .decorator, pre .python .title, pre .ruby .function .title, pre .ruby .title .keyword, pre .perl .sub, pre .javascript .title, pre .coffeescript .title {
color: #81a2be !important;
}
.tomorrow-purple, pre .keyword, pre .javascript .function {
color: #b294bb !important;
}
#codigo pre code {
display: block;
background: rgba(0, 0, 0, 0);
color: #c5c8c6;
font-family: lato, Menlo, Monaco, Consolas, monospace;
line-height: 1.5;
padding: 10px;
font-size:13px;
}
#codigo pre{margin:0; padding:0}
.name{ bottom: 0; left: 0; right: 0; position: absolute; text-align:center; font-size:11px; color:#666}
.name span{display:block; font-size:13px}
.rule {
display: block;
width: 100%;
}
.value {
display: block;
overflow: hidden;
width: 100%;
}
.function {
float: left; margin-left:5px
}
$(window).resize(function(){
var wi = $(window).width();
var he = $(window).height();
$("#corpo").css('height', he-62 );
$("#corpo").css('width', wi-226 );
var imgheight = $("#imagem").height();
var imgwidth = $("#imagem").width();
var ww = $("#corpo").width();
var hh = $("#corpo").height();
$("#imgout").css('margin-top', he/2-$("#imagem").height()/2);
$("#imgout").css('margin-left', ww/2-$("#imagem").width()/2);
}).eq(0).resize();
$(".group h2").click(function () {
$(this).toggleClass('activegroup');
});
$(".btn").click(function () {
$(this).toggleClass('active');
var x = ($(this).attr('href'));
$(x).toggleClass('active');
});
$('.img-url').change(function(e) {
e.preventDefault();
$('#imagem').attr('src', $('input[name="url"]').val());
$(".reset").click();
$("window").trigger("resize");
});
/*
-----------------------------------------------------
Filter
-----------------------------------------------------*/
$(".reset").click(function() {
$("#blur, #hue, #invert, #sepia, #grayscale").val( "0" );
$("#saturate, #contrast, #brightness").val( "1" );
$("aside *").change();
}).eq(0).click();
$("aside *").on('input change', function() {
var blur = $("#blur").val();
var saturate = $("#saturate").val();
var hue = $("#hue").val();
var contrast = $("#contrast").val();
var invert = $("#invert").val();
var sepia = $("#sepia").val();
var grayscale = $("#grayscale").val();
var brightness = $("#brightness").val() ;
//var brightnessv = parseInt($("#brightness").val()) -1;
var filters = "blur(" + blur+"px)" + " saturate("+ saturate+ ")" + " contrast(" + contrast + ")" + " invert(" + invert+ ")" + " sepia(" + sepia+ ")" + " grayscale(" + grayscale+ ")" + " brightness(" + brightness + ")" + " hue-rotate("+hue+ "deg)" ;
$("#imagem").css("-webkit-filter", filters);
//$("#imagem").css("-filter", filtersvendor);
$("#blur-val").text(blur);
$("#saturate-val").text(saturate);
$("#hue-val").text(hue);
$("#contrast-val").text(contrast);
$("#brightness-val").text(brightness);
$("#invert-val").text(invert);
$("#sepia-val").text(sepia);
$("#grayscale-val").text(grayscale);
$("#codigo pre code ").html('.myclass{<br> -webkit-filter:'+ filters + ';'+' <br> }');
$('pre code').each(function(i, e) {hljs.highlightBlock(e)});
}).eq(0).change();
$("#zoom").on('input change', function() {
var zoom = $("#zoom").val() ;
$("#zoom-val").text(zoom);
$("#imgout").css("transform", "scale(" + zoom+")");
});
$(function() {
$( "#imgout" ).draggable();
});
/* ======================================================================
FIM aside
======================================================================
http://www.darkershadesofbrown.com/blog/wp-content/uploads/2013/05/Scranton-PA-Wedding-Photographers-Marisa-TJ-by-Darkershadesofbrown-Photography012.jpg
*/
Also see: Tab Triggers