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">
<article class="main">
<aside class="post-meta">
<div class="author-avatar"></div>
<div class="post-info">
<p><a href="#" class="author-name">John Doe</a></p>
<p class="text-muted">Created on <strong>1st of January 2090</strong>.</p>
</div>
</aside>
<h1>Embed content in article or blog post sample using embedo</h1>
<p>In this article, I will show that it <i>is</i> possible to create a Medium-style article with beautiful typography and <b>not</b> have it take up over a megabyte on the wire. I will include fonts and other CSS bells and whistles, but <a href="#">not a smidgen of JS</a> outside of embedded content. Because when you run something like Medium, you should be able to get all the analytics you need from your goddamned server logs.</p>
<p>Something to add another paragraph here.</p>
<h2>Why do I bother</h2>
<p>I bother because for some reason Medium, the "publishing platform", is slow to load even for really simple, text-only documents. I believe the issue is that it loads unnecessary scripts that don't add to much. And they also strongly recommend using an app on mobile devices - why is this even necessary to view text files with an occasional image?</p>
<div id="embedo-twitter"></div>
<ul>
<li>This is a normal, unordered list. It's rendered by your browser.</li>
<li>It means that the bullets might look a bit different in different browsers, or the margins might not <i>quite</i> match up.</li>
<li>But this is fine, because at least I am not wasting CSS on doing my own list bullets.</li>
</ul>
<h2>Some other heading</h2>
<blockquote>Someone important said this. <cite>Simone Importe-Ante</cite></blockquote>
<h3>Recipe for total panic:</h3>
<div id="embedo-instagram"></div>
<ol>
<li>Cats</li>
<li>Dogs</li>
<li>Living together</li>
</ol>
<h2>Some code</h2>
<div id="embedo-vimeo"></div>
<pre>#include <stdio.h>
int main(int argc, char* argv[]) {
puts(<strong>"Hello, world!"</strong>);
return 0;
}</pre>
<p>I'm fine with this code rendering with different fonts on different systems.</p>
<h2>Laboris nisi</h2>
<p>Lorem ipsum dolor sit amet, consectetur nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipor. Diam maecenas ultricies mi eget mauris pharetra et ultrices neque. Sed nisi lacus sed viverra tellus in hac habitasse. Eros in cursus turpis massa. Quis imperdiet massa tincidunt nunc pulvinar sapien et ligula ullamcorper.
Quis lectus nulla at volutpat diam ut. Sed viverra tellus in hac. Blandit aliquam etiam erat velit scelerisque in. Amet massa vitae tortor condimentum lacinia quis vel eros. Tincidunt arcu non sodales neque sodales ut etiam sit. Orci ac auctor augue mauris augue neque gravida in. Sit amet dictum sit amet justo donec enim diam. Tempus egestas sed sed risus pretium quam vulputate dignissim suspendisse. Massa id neque aliquam vestibulum morbi blandit cursus risus. Tristique senectus eisl suscipit adipiscing bibendum est ultricies integer. Ullamcorper eget nulla facilisi etiam dignissim diam quis.
</p><div id="embedo-pinterest-pin"></div><p>
Ornare arcu odio ut sem nulla pharetra diam. Morbi leo urna molestie at elementum. Eget egestas purus viverra accumsan. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor. Sit amet nisl purus in mollis nunc. Consectetur purus ut faucibus pulvinar elementum integer enim neque. Pellentesque massa placerat duis ultricies. Ac odio tempor orci dapibus ultrices. </p><p>Fermentum odio eu feugiat pretium nibh ipsum consequat. Sit amet venenatis urna cursus eget nunc scelerisque viverra. Iaculis nunc sed augue lacus viverra vitae congue eu consequat. Sem et tortor consequat id porta nibh venenatis cras. Turpis massa sed elementum tempus egestas. Amet consectetur adipiscing elit ut aliquam purus sit amet luctus. Sit amet tellus cras adipiscing enim eu turpis egestas.
</p><p>Placerat duis ultricies lacus sed turpis tincidunt. Velit ut tortor pretium viverra suspendisse potenti nullam. Adipiscing vitae proin sagittis nisl rhoncus. Ullamcorper malesuada proin libero nunc. Malesuada fames ac turpis egestas sed tempus urna et. Elementum curabitur vitae nunc sed velit. Pellentesque eu tincidunt tortor aliquam nulla facilisi. Tortor condimentum lacinia quis vel eros donec ac odio tempor. Amet commodo nulla facilisi nullam vehicula ipsum. Felis imperdiet proin fermentum leo vel orci porta non pulvinar. In dictum non consectetur a erat nam. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus.
</p><p>Quis lectus nulla at volutpat diam ut. Sed viverra tellus in hac. Blandit aliquam etiam erat velit scelerisque in. Amet massa vitae tortor condimentum lacinia quis vel eros. Tincidunt arcu non sodales neque sodales ut etiam sit. Orci ac auctor augue mauris augue neque gravida in. Sit amet dictum sit amet justo donec enim diam. Tempus egestas sed sed risus pretium quam vulputate dignissim suspendisse. Massa id neque aliquam vestibulum morbi blandit cursus risus. Tristique senectus et netus et malesuada fames ac.
</p><p>Volutpat diam ut venenatis tellus in metus vulputate eu. Lobortis mattis aliquam faucibus purus in massa tempor. Et tortor consequat id porta nibh venenatis cras. Blandit aliquam etiam erat velit scelerisque in dictum. Pretium fusce id velit ut tortor pretium viverra suspendisse. Platea dictumst quisque sagittis purus sit. Ut tellus elementum sagittis vitae et. Nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Nisl suscipit adipiscing bibendum est ultricies integer. Ullamcorper eget nulla facilisi etiam dignissim diam quis.
</p><div id="embedo-youtube-embed"></div><p>
Ornare arcu odio ut sem nulla pharetra diam. Morbi leo urna molestie at elementum. Eget egestas purus viverra accumsan. Accumsan in nisl nisi scelerisque eu ultrices vitae auctor. Sit amet nisl purus in mollis nunc. Consectetur purus ut faucibus pulvinar elementum integer enim neque. Pellentesque massa placerat duis ultricies. Ac odio tempor orci dapibus ultrices.
</p><p>Fermentum odio eu feugiat pretium nibh ipsum consequat. Sit amet venenatis urna cursus eget nunc scelerisque viverra. Iaculis nunc sed augue lacus viverra vitae congue eu consequat. Sem et tortor consequat id porta nibh venenatis cras. Turpis massa sed elementum tempus egestas. Amet consectetur adipiscing elit ut aliquam purus sit amet luctus. Sit amet tellus cras adipiscing enim eu turpis egestas.
</p><p>Elementum curabitur vitae nunc sed velit. Pellentesque eu tincidunt tortor aliquam nulla facilisi. Tortor condimentum lacinia quis vel eros donec ac odio tempor. Amet commodo nulla facilisi nullam vehicula ipsum. Felis imperdiet proin fermentum leo vel orci porta non pulvinar. In dictum non consectetur a erat nam. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus.</p>
</article>
</div>
@import url('https://fonts.googleapis.com/css?family=Hind:400,700');
@color_1: #222;
@color_2: #5b5b5b;
@color_3: #00ab6b;
@color_4: #1c9963;
@color_5: #ababab;
@color_6: #000;
@color_7: #444;
@color_8: #a0a0a0;
@font_family_1: Hind, sans-serif;
@background_color_1: #ebebeb;
html {
margin: 0;
padding: 2%;
}
body {
margin: 0;
font: normal 16px/150% @font_family_1;
color: @color_1;
line-height: 1.4;
}
* {
box-sizing: border-box;
}
h1 {
font-family: @font_family_1;
font-weight: 300;
margin: 1.5em 0 0.25em;
color: @color_2;
color: @color_1;
font-weight: 700;
font-size: 2.5em;
margin: 1em 0 0.125em;
&+p {
margin-top: 1.75em;
}
}
h2 {
font-family: @font_family_1;
font-weight: 300;
margin: 1.5em 0 0.25em;
color: @color_2;
}
h3 {
font-family: @font_family_1;
font-weight: 300;
margin: 1.5em 0 0.25em;
color: @color_2;
}
h4 {
font-family: @font_family_1;
font-weight: 300;
margin: 1.5em 0 0.25em;
color: @color_2;
}
h5 {
font-family: @font_family_1;
font-weight: 300;
margin: 1.5em 0 0.25em;
color: @color_2;
}
h6 {
font-family: @font_family_1;
font-weight: 300;
margin: 1.5em 0 0.25em;
color: @color_2;
}
div {
margin-top: 10px;
margin-bottom: 10px;
}
.container {
max-width: 700px;
margin: 0 auto;
}
article.main {
margin: 1em 0;
}
.post-meta {
display: flex;
font: 14px/125% @font_family_1;
margin-bottom: 20px;
}
.post-info {
>p {
margin: 5px 0;
}
}
.author-avatar {
width: 50px;
height: 50px;
background: rgb(127, 127, 127);
border-radius: 100%;
margin-right: 1em;
}
.author-name {
font-weight: 700;
color: @color_3;
text-decoration: none;
&:link {
font-weight: 700;
color: @color_3;
text-decoration: none;
}
&:visited {
font-weight: 700;
color: @color_3;
text-decoration: none;
}
&:hover {
color: @color_4;
}
&:active {
color: @color_4;
}
}
p {
margin: 0 0 0.75em;
}
ul {
>li {
margin: 0 0 0.75em;
}
}
ol {
>li {
margin: 0 0 0.75em;
}
}
blockquote {
margin-left: -1em;
margin-right: -1em;
border-left: 4px solid #ababab;
padding: 0.25em 0.75em;
font-size: 150%;
>cite {
display: block;
margin-top: 1.5em;
font-variant: italics;
font-size: 16px;
color: @color_5;
}
}
pre {
display: block;
padding: 0.5em;
background-color: @background_color_1;
}
.image-p {
>img {
display: block;
max-width: 100%;
}
>.caption {
display: block;
width: 100%;
font-size: 80%;
border-bottom: 1px solid #ababab;
color: @color_2;
}
}
article {
a {
color: @color_6;
&:link {
color: @color_6;
}
&:visited {
color: @color_7;
}
&:hover {
color: @color_8;
}
&:active {
color: @color_8;
}
}
}
window.onload = function() {
var embedo=new Embedo({facebook:{version:"v8.0",appId:"180015362652616",access_token:"180015362652616|fb4b1e9203a607f5e9d9d49c666ee200",xfbml:!0},twitter:!0,instagram:{access_token:"180015362652616|fb4b1e9203a607f5e9d9d49c666ee200"},pinterest:!0});
embedo
.load(
document.getElementById("embedo-twitter"),
"https://twitter.com/Sh0bhit/status/797584590214926340"
)
.done(function() {
console.log("Tweet Loaded. [hide loader if/any]");
});
embedo.load(
document.getElementById("embedo-instagram"),
"https://www.instagram.com/p/BJA9BB-B46A",
{
hidecaption: false
}
);
embedo.load(
document.getElementById("embedo-pinterest-pin"),
"https://www.pinterest.com/pin/99360735500167749"
);
embedo.load(
document.getElementById("embedo-youtube-embed"),
"https://www.youtube.com/embed/vn2qXpcon-s",
{
width: '100%',
height: 480
}
);
};
Also see: Tab Triggers