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>Media & Multimedia Bookmarklets</h2>
<p class="red"><i>Just drag & Drop the red bookmarklet(s) of your choice to your bookmarks bar.</i></p>
<table class="center">
<tr><th colspan="2">Media & Multimedia Bookmarklets</th></tr>
<tr><td>
<a class="button" href='javascript:
if(window.location.href.indexOf(%22ft.com%22) > -1) {
(function () {
var cookies = document.cookie.split(%22; %22);
for (var c = 0;
c < cookies.length; c++) {
var d = window.location.hostname.split(%22.%22);
while (d.length > 0) {
var cookieBase = encodeURIComponent(cookies[c].split(%22;%22)[0].split(%22=%22)[0]) + %22=;
expires=Thu, 01-Jan-1970 00:00:01 GMT;
domain=%22 + d.join(%22.%22) + %22 ;
path=%22;
var p = location.pathname.split(%22/%22);
document.cookie = cookieBase + %22/%22;
while (p.length > 0) { document.cookie = cookieBase + p.join(%22/%22);
p.pop();
};
d.shift();
}}})();
window.location.href=%22https://m.facebook.com/l.php?u=%22+encodeURIComponent(window.location.href)+%22?ClearCache=true%22;
alert(%22To read FT.com, we must redirect you through FaceBook!%22);
} else if (window.location.href.indexOf(%22wsj.com%22) > -1 || window.location.href.indexOf(%22technologyreview.com%22) > -1 || window.location.href.indexOf(%22investors.com%22) > -1 || window.location.href.indexOf(%22businessinsider.com%22) > -1) {
(function()%7Bwindow.location.href %3D %22https%3A%2F%2Foutline.com%2F%22 %2B window.location.href%7D)();
} else {
(function () { var cookies = document.cookie.split(%22; %22);
for (var c = 0; c < cookies.length; c++) {
var d = window.location.hostname.split(%22.%22);
while (d.length > 0) {
var cookieBase = encodeURIComponent(cookies[c].split(%22;%22)[0].split(%22=%22)[0]) + %22=; expires=Thu, 01-Jan-1970 00:00:01 GMT; domain=%22 + d.join(%22.%22) + %22 ;
path=%22;
var p = location.pathname.split(%22/%22);
document.cookie = cookieBase + %22/%22;
while (p.length > 0) {
document.cookie = cookieBase + p.join(%22/%22);
p.pop();
};
d.shift();}}})();window.localStorage.clear();
window.open(document.location + %22?ClearCache=true%22, %22_self%22);}
' title="Paywall Killer - get around many paywalls">💀 Paywall Killer</a>
</td><td>Get around most if not all paywalls.<br><i class="gray">Read your favorite online magazines and newspapers for free.</td></tr>
<tr><td>
<a class="button" href="javascript: var song=window.prompt('Find Music:', 'Enter song or artist name');
var song2=song.split(' ').join('_');
var song3=song.split(' ').join('');
var url='https://www.google.com/search?q=%22parent+directory%22+mp3+OR+wma+OR+ogg+OR+wav+%22' + song +'%22 OR %22' + song2 + '%22 OR %22' + song3 + '%22+-html+-htm+-shtml+-phtml+-php+-buy+-aspx+-jsp+-asp+-cgi+-pdf+-ftp+-unknownsecret&num=100&filter=0';
window.open(url,'_self')" title="Find Music Online">🔎♪Music♬</a>
</td><td>Find music on the internet with this bookmarklet.<br /><i class="gray">Search for directories of music online from any page.</i></td></tr>
<tr><td>
<a class="button" href="javascript: var song=window.prompt('Find Movies:', 'Enter movie or film title');
var song2=song.split(' ').join('_');
var song3=song.split(' ').join('');
var url='https://www.google.com/search?q=%22parent+directory%22+mp4+OR+AVI+OR+WMV+OR+MOV+OR+FLV+%22' + song +'%22 OR %22' + song2 + '%22 OR %22' + song3 + '%22+-html+-htm+-shtml+-phtml+-php+-buy+-aspx+-jsp+-asp+-cgi+-pdf+-ftp+-unknownsecret&num=100&filter=0';window.open(url,'_self');" title="Find Movies Online">🎥 Movie Search</a>
</td><td>Find movies online<br /><i class="gray">Search for directories of movies online from any page.</i></td></tr>
<tr><td><a class="button" href="javascript:
if (document.URL.indexOf('imdb.com/title/') > -1) {
var film = document.getElementsByTagName('H1')[0].innerText;
var film2=film.split(' ').join('_');var film3=film.split(' ').join('');var url='https://www.google.com/search?q=%22parent+directory%22+mp4+OR+AVI+OR+WMV+OR+MOV+OR+FLV+%22' + film +'%22 OR %22' + film2 + '%22 OR %22' + film3 + '%22+-html+-htm+-shtml+-phtml+-php+-buy+-aspx+-jsp+-asp+-cgi+-pdf+-ftp+-unknownsecret&num=100&filter=0';window.open(url,'_self');
} else {
alert('You must be on an IMDB page for this tool!\nRedirecting you now... try again!');
open('https://www.imdb.com/title/tt0031381/?ref_=nv_sr_1');
}" title="Find an IMDB Movie">🎥 Find IMDB Movie</a></td><td>Find a movie on the IMDB.com site<br />
<i class="gray">Then click this bookmarklet to find it on the web!</td></tr>
<tr><td><a class="button" href='javascript:if(window.location.href.indexOf("youtube.com") > -1 || window.location.href.indexOf("youtu.be") > -1) { (function(){window.location.href = "https://ymp4.download/en2/?url=" + window.location.href})(); } else if (window.location.href.indexOf("reddit.com") > -1) { (function(){window.location.href = "https://viddit.red/?url=" + window.location.href})(); } else if (window.location.href.indexOf("twitter.com") > -1 ){(function(){window.location.href = "https://www.savetweetvid.com/downloader?url=" + window.location.href})(); }else if (window.location.href.indexOf("vidmax.com") > -1 ){(function(){window.location.href = "https://9xbuddy.org/process?url=" + window.location.href})(); }else if (window.location.href.indexOf("liveleak.com") > -1 ){(function(){window.location.href = "https://www.tubeoffline.com/downloadFrom.php?host=LiveLeak&video=https%3A%2F%2F" + window.location.href})(); }else if (window.location.href.indexOf("dailymotion.com") > -1 ){(function(){window.location.href = "https://dmvideo.download/?url=" + window.location.href})(); }else if (window.location.href.indexOf("metacafe.com") > -1 ){(function(){window.location.href = "https://keepv.id/?url=" + window.location.href})(); }else {(function(){window.location.href = "https://keepv.id/?url=" + window.location.href})(); }' title="Video Downloader">GetVideo</a></td><td>Download videos from popular sites<br /><i class="gray">Will download videos from YouTube, Facebook, Twitter, Reddit, MetaCafe, DailyMotion, Liveleak, etc.</i></td></tr>
<tr><td><a class="button" href='javascript:window.location=document.URL.replace("https://www.youtube.com/watch?v=","https://y2mate.com/youtube/");' title="YouTube Download">YouTubeDownLoad</a></td><td>Download YouTube Video<br /><i class="gray">Download videos from YouTube with this bookmarklet.</i></td></tr>
<tr><td>
<a class="button" href='javascript:window.location=document.URL.replace("https://www.youtube.com/watch?v=","https://ytmp3.com/download/");' title="Download MP3 from YouTube Video">▽ YouTube2MP3</a></td><td>Grab an MP3 music file from a YouTube video.</td></tr>
<tr>
<td>
<a class="button" href="javascript: var song=window.prompt('Find Books:', 'Enter book or author name');
var song2=song.split(' ').join('_');
var song3=song.split(' ').join('');
var url='https://www.google.com/search?q=%22parent+directory%22+pdf+OR+epub+OR+DjVU+OR+xps+%22' + song +'%22 OR %22' + song2 + '%22 OR %22' + song3 + '%22+-html+-htm+-shtml+-phtml+-php+-buy+-aspx+-jsp+-asp+-cgi+-pdf+-ftp+-unknownsecret&num=100&filter=0';
window.open(url,'_self')" title="Find books Online">🔎 📖eBook Search</a>
</td><td>This will search for books across the Internet via a Google script.<br /><i class="gray">Generic book search using Google.</i></td></tr>
<tr><td>
<a class="button" href='javascript:
var ebookcheck = document.getElementById(%22ebooksProductTitle%22);
var bookcheck = document.getElementById(%22productTitle%22);
if(ebookcheck !=null){
var book= document.getElementById(%22ebooksProductTitle%22).innerText;
(open(%22https://archive.org/search.php?query=%22+book));
}else if(bookcheck !=null){
var book= document.getElementById(%22productTitle%22).innerText;
(open(%22https://archive.org/search.php?query=%22+book));
} else {
var book=window.prompt(%22Find Free Books:%22, %22Enter the book title%22);
if(book == "Enter the book title" || book == null){
alert("Enter a book title or find one on Amazon");
} else {
(open(%22https://archive.org/search.php?query=%22+book));
}}' title="Finds books & eBooks on Amazon elsewhere">📖 Amazon Book Finder</a></td><td>This bookmarklet will find a book you selected on Amazon.com online for free!<br /><i class="gray">Go to the page of any book on Amazon, then click this bookmarklet!</i></td></tr>
<tr><td><a class="button" href='javascript:if(window.location.href.indexOf("tunein.com/radio") > -1) { var muzyk = document.getElementById("jp_audio_0").src; (open(muzyk)); var title = document.getElementById("jp_audio_0").title; alert(title+"Was opened in a new window"); } else { alert("You need to be streaming Music on the TuneIn.com page for this to work!") }' title="Open TuneIn URL">🔗 Open TuneIn URL</a></td><td>Grab the URL from any TuneIn station and open it in a new window.</td></tr>
<tr><td>
<a class="button" href='javascript:(function()%7Bwindow.open( "http%3A%2F%2Fweb.archive.org%2Fweb%2F*%2F" %2B document.domain)%7D)()' add_date="1461250448">🗄 WaybackMachine</a></td><td>Find an archived version of the page you are on. (Pre paywall?)<br />
<i class="gray">Can't find that page? Did they put up a paywall? Try the Wayback Machine...</i></td></tr>
<tr><td><a class="button" href="javascript:window.location%20=%20'https://webcache.googleusercontent.com/search?q=cache:'+window.location;" title="Find page in Google Cache">📂 Google Cache</a></td><td>Find a cached version of the current page.<br />
<i class="gray">Looking for a cached version of a page? Try this.</i></td></tr><tr><td><a class="button" href="javascript:void(open('https://archive.today/?run=1&url='+encodeURIComponent(document.location)))" title="Archive the current page">Archive Page</a></td><td>Creates an archive of the current page.<br /><i class="gray">Often, this may get you around a paywall.</i></td></tr>
<tr><td><a class="button" href="javascript:(function()%7Bwindow.location.href %3D 'https%3A%2F%2Foutline.com%2F' %2B window.location.href%7D)()" title="Outline Page">Outline Page</a></td><td>Outlines the page by removing all ads and decoration.<br />
<i class="gray">Another way around paywalls</i></td></tr>
<tr><td><a class="button" href="javascript: if(window.location.href.indexOf('ft.com') > -1) { var pageTitle=document.getElementsByClassName('barrier__heading-serif')[0].innerHTML; } else { var pageTitle=document.getElementsByTagName('title')[0].innerText; } var host=(window.location.hostname); var host=host.replace('www.',''); var pageTitle = pageTitle.toString(); var twit= 'https://twitter.com/search?q=' + host + ' '+ pageTitle + '&src=typd'; window.open(twit, '_self');" title="Go to the page via Twitter Referrer">TwitterRefer</a></td><td>Twitter Referrer<br />
<i class="gray">Enter a site via Twitter. (Paywall avoidance tactic)</i></td></tr>
<tr><td><a class="button" href='javascript:(function () { var cookies = document.cookie.split("; "); for (var c = 0; c < cookies.length; c++) { var d = window.location.hostname.split("."); while (d.length > 0) { var cookieBase = encodeURIComponent(cookies[c].split(";")[0].split("=")[0]) + "=; expires=Thu, 01-Jan-1970 00:00:01 GMT; domain=" + d.join(".") + " ;path="; var p = location.pathname.split("/"); document.cookie = cookieBase + "/"; while (p.length > 0) { document.cookie = cookieBase + p.join("/"); p.pop(); }; d.shift(); } } })(); window.location.href="https://m.facebook.com/l.php?u="+encodeURIComponent(window.location.href)+"?ClearCache=true";
' title="Use FaceBook Referrer">FB→</a></td><td>Reload the page via a Facebook referrer.<br />
<i class="gray">This enters the page via Facebook; which may circumvent a paywall</i></td></tr>
<tr><td><a href='javascript:(function () { var cookies = document.cookie.split("; ");
for (var c = 0; c < cookies.length; c++) {
var d = window.location.hostname.split(".");
while (d.length > 0) {
var cookieBase = encodeURIComponent(cookies[c].split(";")[0].split("=")[0]) + "=; expires=Thu, 01-Jan-1970 00:00:01 GMT; domain=" + d.join(".") + " ;path="; var p = location.pathname.split("/");
document.cookie = cookieBase + "/";
while (p.length > 0) {
document.cookie = cookieBase + p.join("/");
p.pop(); }; d.shift(); } } })();
window.localStorage.clear();
window.open(document.location + "?ClearCache=true", "_self");' title="CookieKiller" class="button">💣CookieBomb</a></td><td>Kills all site, domain and path cookies.<br /><i class="gray">Then it clears the cache and reloads the page! Magic!</i></td></tr>
<tr><td><a class="button" href="javascript:
if(window.location.href.indexOf('wsj.com') > -1) {
(function () { var cookies = document.cookie.split('; '); for (var c = 0; c < cookies.length; c++) { var d = window.location.hostname.split('.'); while (d.length > 0) { var cookieBase = encodeURIComponent(cookies[c].split(';')[0].split('=')[0]) + '=; expires=Thu, 01-Jan-1970 00:00:01 GMT; domain=' + d.join('.') + ' ;path='; var p = location.pathname.split('/'); document.cookie = cookieBase + '/'; while (p.length > 0) { document.cookie = cookieBase + p.join('/'); p.pop(); }; d.shift(); } } })();
window.localStorage.clear();
var block_to_insert ;
var container_block ;
var outline= '<a href=https://outline.com/' + window.location.href + '> Outline WSJ Article</a>';
var pageTitle=document.getElementsByTagName('title')[0].innerText;
var pageTitle = pageTitle.toString();
var pageTitle = pageTitle.replace(/ /g, ' ');
var pageTitle = pageTitle.replace(/WSJ/g, '');
var gogoog= 'https://www.google.com/search?q=site:wsj.com/articles/ ' + pageTitle;
var go2='<a href=' + gogoog + '> Via Google referrer</a>';
var twit= 'https://twitter.com/search?q=' + pageTitle + '&src=typd';
var gotwit='<a href=' + twit + '> Via Twitter referrer</a>';
block_to_insert = document.createElement('div');
block_to_insert.id = 'mymenu';
block_to_insert.innerHTML = '<center>Three Ways to Open The WSJ:<br /><table><tr><td>O</td><td> 1.) </td><td>'+ outline + '</td></tr><tr><td><img src=http://google.com/favicon.ico height=20></td><td> 2.) </td><td>' + go2 + '</td></tr><tr><td><img src=http://twitter.com/favicon.ico></td><td> 3.) </td><td>' + gotwit + '</td></tr></table>';
container_block = document.getElementsByTagName('body')[0];
container_block.appendChild(block_to_insert);
mymenu.setAttribute('style', 'margin-left:auto; margin-right:auto; height:80px; width:50%; background-color:#FFFF00; color:black; float:left; font-family:arial,sans,verdana; font-size:20px; z-index:10000; display: inline-block;line-height:unset!important; line-height:1!important; overflow:visible; position:fixed; top: 0; padding:2px 5px;');
} else {
alert('This script is meant to be used on Wall Street Journal Articles!');
window.open('http://wsj.com', '_self');
}" title="Open the WSJ">WSJ</a></td><td>3 Ways to open the WSJ<br /><i class="gray">Choose how to circumvent the paywall at the WSJ</i></td></tr>
<tr class="red"><td> <a class="button" href='javascript:(function()%7Bvar url %3D ""%3Bvar r %3D false%3Btry%7Burl %3D TuneIn.payload.Program.broadcast.StreamUrl%3Br %3D confirm("Station JSON URL successfully retrieved. Opening now.")%3Bif(r) %7Bwindow.open(url)%3B%7D%7Dcatch(e) %7Btry %7Burl %3D TuneIn.payload.Program.broadcast.StreamUrl%3Br %3D confirm("Station JSON URL successfully retrieved. Opening now.")%3Bif(r) %7Bwindow.open(url)%3B%7D%7Dcatch(ee) %7Balert("No TuneIn Station Detected")%3B%7D%7D%7D)()' title="Use this first to get the JSON page, then the second button!">👋 TuneInJSON Grab</a> <br />
<a class="button" href='javascript:(function()%7Btry %7Bvar data %3D JSON.parse(document.getElementsByTagName("PRE")%5B0%5D.innerHTML)%3Bdata.Streams.forEach(function(element) %7Bprompt(element.Badwidth %2B "kbps%3A "%2C element.Url)%3B%7D)%3B%7Dcatch(err) %7Balert %3D "This is not a valid TuneIn metadata page."%7D%7D)()' title="Grab the MP3 from a TuneIn Station">⇓ TuneIn MP3 Stream</a></td><td>
<h3>THIS ONE NEEDS WORK - QUIRKY!</h3> Use the first button to get the JSON page, <br />the second button grabs the MP3 stream.<br /><i class="gray">Grab an MP3 stream from any TuneIn station.</i></td></tr>
</table>
body {background-color:#000; text-align:center; padding-top:1px; color:#fff; font-family:arial, sans, verdana;}
.button {
display: inline-block;
text-align: center;
vertical-align: middle;
padding: 4px 18px;
border: 3px solid #982727;
border-radius: 37px;
background: #ff4a4a;
background: -webkit-gradient(linear, left top, left bottom, from(#ff4a4a), to(#982727));
background: -moz-linear-gradient(top, #ff4a4a, #982727);
background: linear-gradient(to bottom, #ff4a4a, #982727);
-webkit-box-shadow: #ff5959 0px 0px 8px 0px;
-moz-box-shadow: #ff5959 0px 0px 8px 0px;
box-shadow: #ff5959 0px 0px 8px 0px;
text-shadow: #5a1717 1px 1px 1px;
font: normal normal bold 20px arial;
color: #ffffff;
text-decoration: none;
}
.button:hover,
.button:focus {
border: 3px solid #b32e2e;
background: #ff5959;
background: -webkit-gradient(linear, left top, left bottom, from(#ff5959), to(#b62f2f));
background: -moz-linear-gradient(top, #ff5959, #b62f2f);
background: linear-gradient(to bottom, #ff5959, #b62f2f);
color: #ffffff;
text-decoration: none;
}
.button:active {
background: #982727;
background: -webkit-gradient(linear, left top, left bottom, from(#982727), to(#982727));
background: -moz-linear-gradient(top, #982727, #982727);
background: linear-gradient(to bottom, #982727, #982727);
}
table.center {
margin-left:auto;
margin-right:auto;
text-align:left;
table-border:0px #fff;
border-collapse: collapse;
}
table, th, td {
border: 1px solid #b32e2e;
padding: 6px 10px;
}
tr.red {background-color:#660000; color:#ff0}
.gray {color:#888}
.green {color:#0f0}
.blue {color:#66ffff}
.red {color:#b32e2e}
Also see: Tab Triggers