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="app">
<div id="tool" class="container">
<div class="inner">
<div id="export-image">
<div id="title">
<h1>{{ title }}</h1>
<h2>{{ date }}</h2>
</div>
<div id="logo" :class="{ show: logo }">
<img src="data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAYEBQYFBAYGBQYHBwYIChAKCgkJChQODwwQFxQYGBcUFhYaHSUfGhsjHBYWICwgIyYnKSopGR8tMC0oMCUoKSj/2wBDAQcHBwoIChMKChMoGhYaKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCj/wgARCABuAG4DASIAAhEBAxEB/8QAHAAAAgMBAQEBAAAAAAAAAAAABgcABAUDAggB/8QAGAEBAQEBAQAAAAAAAAAAAAAAAAIBAwT/2gAMAwEAAhADEAAAAcLzzcQknciXMJvvsl5BjQFCxTdyEHIFmQQEtOzSBRxJ1xCKcyZcwuy8QN+e4AoXYk618HdXl4VhBuEXhFSu0gUcQEN899Egmx41daDpl4pPHca5Vfz2sQYW3O0E3jBpijW6YM4RysOVPf3ka/oiJ1xJTyWC8pPXDaaC2ZPluZ+gIeqFk2FM6/Pelj7E6yj9Ju4HPellPTnR97BPyNcY+s9fpNDoYD95ksfC79ZYMkpJIIZxJ1xGotGckY0mwSZd3jUVrSBSgxhzXD+SEkghnErxs+i/nphB4Xrb6NUIViZCuA/6gbiP/8QAJhAAAgICAgEEAgMBAAAAAAAABAUDBgECADU0EBIUFRMgESEzFv/aAAgBAQABBQK1yyauIUzSaEU0xYwaEZEXj/YNCTQWS+OpnSmCWxjPg6FM1mhX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-.4-.3-.3-.4-.8-.4-1.7V27.6c0-.9.1-1.4.4-1.7.3-.3.9-.4 1.7-.4h4c.9 0 1.4.1 1.7.4.3.3.4.8.4 1.7v11.1h6.6v-12c.1-4.2-2.2-6.3-6.7-6.3zM127.6 59.2V20.4H121v37.7c0 .9-.1 1.4-.4 1.7-.3.3-.9.4-1.8.4h-4.1c-.9 0-1.4-.1-1.7-.4-.3-.3-.4-.8-.4-1.7V20.4H106v38.7c0 4.2 2.3 6.3 6.8 6.3h8c4.5.1 6.8-2 6.8-6.2zM61.1 124.3h10.7v5.3H54.3V84.5h6.8v39.8z"/>
</g>
<g id="eye-base">
<path d="M75 51.1c-28.8 0-52.2 20.5-52.2 23.9 0 3.4 23.4 23.9 52.2 23.9s52.2-20.6 52.2-23.9c0-3.3-23.4-23.9-52.2-23.9z" stroke="#fed82f" stroke-width="4"/>
<path fill="#fff" d="M75 51.1c-28.8 0-52.2 20.5-52.2 23.9 0 3.4 23.4 23.9 52.2 23.9s52.2-20.6 52.2-23.9c0-3.3-23.4-23.9-52.2-23.9z"/>
</g>
<g id="pupil">
<path d="M80.8 59.4s-1.4-.2-5.6-.2c-4.3 0-5.6.2-5.6.2-6.3 0-9.5 3-9.5 8.9 0 0-.2 3.7-.2 5.9s.2 5.9.2 5.9c0 5.9 3.2 8.9 9.5 8.9 0 0 2.7.2 5.6.2 2.8 0 5.6-.2 5.6-.2 6.2 0 9.4-3 9.4-8.9 0 0 .1-3.4.1-5.9 0-2.5-.1-5.9-.1-5.9 0-5.9-3.1-8.9-9.4-8.9z" fill="#fed82f"/>
<path d="M79.7 62.4s-1.1-.1-4.5-.1-4.4.1-4.4.1c-5.1 0-7.6 2.4-7.6 7.1 0 0-.1 2.9-.1 4.7 0 1.8.1 4.7.1 4.7 0 4.7 2.5 7.1 7.6 7.1 0 0 2.2.1 4.4.1s4.5-.1 4.5-.1c5 0 7.5-2.4 7.5-7.1 0 0 .1-2.7.1-4.7s-.1-4.7-.1-4.7c0-4.8-2.5-7.1-7.5-7.1z"/>
<path fill="#fff" d="M67.5 59.3h-3.7c-2.1 0-3.1 1.1-3.1 3.3V66c0 2.2 1 3.3 3.1 3.3h3.7c2.1 0 3.1-1.1 3.1-3.3v-3.4c0-2.2-1-3.3-3.1-3.3z"/>
</g>
<g id="eye">
<path d="M75 56.1c22.2 0 40.3 13.5 45.6 18.9-5.4 5.4-23.4 18.9-45.6 18.9-22.5 0-40.4-13.5-45.7-18.9 5.3-5.4 23.2-18.9 45.7-18.9m0-5c-28.8 0-52.2 20.5-52.2 23.9 0 3.4 23.4 23.9 52.2 23.9s52.2-20.6 52.2-23.9c0-3.3-23.4-23.9-52.2-23.9z"/>
</g>
</svg> -->
</div>
<div id="background">
<img :src="image" alt="">
</div>
</div>
</div>
</div>
<!-- <div id="side-nav">
</div> -->
<div id="controls">
<div class="inner">
<div class="col">
<h1>Customizer controls</h1>
<div class="input-field">
<label for="input-title">Edit Title</label>
<!-- <p>Edit the event title</p> -->
<input type="text" v-model="title" id="input-title">
</div>
<div class="input-field">
<label for="input-sub-title">Edit Sub title</label>
<!-- <p>Set this to something like the date and time of hte event</p> -->
<input type="text" v-model="date" id="input-sub-title">
</div>
<div class="input-field input-field--checkbox">
<input type="checkbox" v-model="logo" id="input-logo">
<label for="input-logo">Show Logo</label>
<p>Hide or show the logo</p>
</div>
<div class="input-field ">
<label for="input-background">Upload Background image 🌅</label>
<p>Upload and frame your image. If you dont have a image yet, check out <a href="https://unsplash.com" target="_blank">Unsplash</a> for royalty free images.</p>
<input type="file" @change="onFileChange" id="input-background">
</div>
</div>
<div class="col">
<button id="download" :disabled="image == ''">Download <span>⬇️</span></button>
<h1>Generate facebook share/event image</h1>
<p>With this tool you can generate a social share image at the correct size (1200x630px). Just upload your background image, frame it and style the rest.</p>
<p>The input fields in this container are used to configure and edit your content, just start typing and you will directly see the changes your are making.</p>
<p>When you're done styling your image, click the <strong>Download <span>⬇️</span> </strong> button to generate the image which will than be completly ready for you to share it on any social media!</p>
<p>Tool build by <a href="https://mvaneijgen.nl">@mvaneijgen</a>, if your are looking for any customisation, just shoot me a message.</p>
</div>
</div>
</div>
</div>
//------------------------------------------------------//
// The real Bootstrap way to load in media queries.
// And here is an example
// @include media-breakpoint-up(md) {
// // YOUR MQ CODE
// }
//------------------------------------------------------//
$grid-breakpoints: (
xs: 0,
sm: 576px,
md: 768px,
lg: 992px,
xl: 1200px
)
!default; // Breakpoint viewport sizes and media queries.
//
// Breakpoints are defined as a map of (name: minimum width), order from small to large:
//
// (xs: 0, sm: 576px, md: 768px, lg: 992px, xl: 1200px)
//
// The map defined in the `$grid-breakpoints` global variable is used as the `$breakpoints` argument by default.
// Name of the next breakpoint, or null for the last breakpoint.
//
// >> breakpoint-next(sm)
// md
// >> breakpoint-next(sm, (xs: 0, sm: 576px, md: 768px, lg: 992px, xl: 1200px))
// md
// >> breakpoint-next(sm, $breakpoint-names: (xs sm md lg xl))
// md
@function breakpoint-next($name, $breakpoints: $grid-breakpoints, $breakpoint-names: map-keys($breakpoints)) {
$n: index($breakpoint-names, $name);
@return if($n < length($breakpoint-names), nth($breakpoint-names, $n + 1), null);
}
// Minimum breakpoint width. Null for the smallest (first) breakpoint.
//
// >> breakpoint-min(sm, (xs: 0, sm: 576px, md: 768px, lg: 992px, xl: 1200px))
// 576px
@function breakpoint-min($name, $breakpoints: $grid-breakpoints) {
$min: map-get($breakpoints, $name);
@return if($min != 0, $min, null);
}
// Maximum breakpoint width. Null for the largest (last) breakpoint.
// The maximum value is calculated as the minimum of the next one less 0.1.
//
// >> breakpoint-max(sm, (xs: 0, sm: 576px, md: 768px, lg: 992px, xl: 1200px))
// 767px
@function breakpoint-max($name, $breakpoints: $grid-breakpoints) {
$next: breakpoint-next($name, $breakpoints);
@return if($next, breakpoint-min($next, $breakpoints) - 1px, null);
}
// Returns a blank string if smallest breakpoint, otherwise returns the name with a dash infront.
// Useful for making responsive utilities.
//
// >> breakpoint-infix(xs, (xs: 0, sm: 576px, md: 768px, lg: 992px, xl: 1200px))
// "" (Returns a blank string)
// >> breakpoint-infix(sm, (xs: 0, sm: 576px, md: 768px, lg: 992px, xl: 1200px))
// "-sm"
@function breakpoint-infix($name, $breakpoints: $grid-breakpoints) {
@return if(breakpoint-min($name, $breakpoints) == null, '', '-#{$name}');
}
// Media of at least the minimum breakpoint width. No query for the smallest breakpoint.
// Makes the @content apply to the given breakpoint and wider.
@mixin media-breakpoint-up($name, $breakpoints: $grid-breakpoints) {
$min: breakpoint-min($name, $breakpoints);
@if $min {
@media (min-width: $min) {
@content;
}
} @else {
@content;
}
}
// Media of at most the maximum breakpoint width. No query for the largest breakpoint.
// Makes the @content apply to the given breakpoint and narrower.
@mixin media-breakpoint-down($name, $breakpoints: $grid-breakpoints) {
$max: breakpoint-max($name, $breakpoints);
@if $max {
@media (max-width: $max) {
@content;
}
} @else {
@content;
}
}
// Media that spans multiple breakpoint widths.
// Makes the @content apply between the min and max breakpoints
@mixin media-breakpoint-between($lower, $upper, $breakpoints: $grid-breakpoints) {
$min: breakpoint-min($lower, $breakpoints);
$max: breakpoint-max($upper, $breakpoints);
@if $min != null and $max != null {
@media (min-width: $min) and (max-width: $max) {
@content;
}
} @else
if $max == null {
@include media-breakpoint-up($lower) {
@content;
}
} @else
if $min == null {
@include media-breakpoint-down($upper) {
@content;
}
}
}
// Media between the breakpoint's minimum and maximum widths.
// No minimum for the smallest breakpoint, and no maximum for the largest one.
// Makes the @content apply only to the given breakpoint, not viewports any wider or narrower.
@mixin media-breakpoint-only($name, $breakpoints: $grid-breakpoints) {
$min: breakpoint-min($name, $breakpoints);
$max: breakpoint-max($name, $breakpoints);
@if $min != null and $max != null {
@media (min-width: $min) and (max-width: $max) {
@content;
}
} @else
if $max == null {
@include media-breakpoint-up($name) {
@content;
}
} @else
if $min == null {
@include media-breakpoint-down($name) {
@content;
}
}
}
//------------------------------------------------------//
// END The real Bootstrap way to load in media queries.
//------------------------------------------------------//
@import url("https://fonts.googleapis.com/css?family=Teko:400,700");
//------------------------------------------------------//
// Styling
//------------------------------------------------------//
$brand-one: #fed82f;
$brand-two: #e64;
$brand-three: #f5f5b8;
$brand-four: #172713;
$brand-light: #fff;
$brand-dark: #000;
$brand-grey: #ccc;
$base-one: #344;
$base-two: #0ba;
$base-margin: 15px;
#export-image {
h1,
h2,
h3,
h4,
h5,
h6 {
font-weight: 400;
text-transform: uppercase;
background-color: $brand-one;
padding: 15px;
line-height: 0.8em;
display: inline-block;
padding: 23px 30px 15px 23px;
margin: 0;
font-size: 50px;
// font-size: 5vw;
}
h2,
h3,
h4,
h5,
h6 {
background-color: #000;
color: #fff;
font-size: 50px;
// font-size: 3.5vw;
}
#title {
font-family: "Teko", sans-serif;
font-weight: 400;
> * {
display: block;
pointer-events: none;
&:last-child {
display: inline-block;
}
}
}
#logo {
width: 60px;
height: 60px;
background-color: $brand-light;
padding: 5px;
opacity: 0;
&.show {
opacity: 1;
}
}
}
//------------------------------------------------------//
// END Styling
//------------------------------------------------------//
//------------------------------------------------------//
// User interface
//------------------------------------------------------//
#side-nav,
#controls {
background-color: $base-one;
padding: $base-margin*2;
h1,
h2,
h3,
h5,
h6,
p,
label,
a {
color: $brand-light;
}
}
#controls {
position: relative;
width: 100%;
.inner {
max-width: 1110px;
margin-left: auto;
margin-right: auto;
@include media-breakpoint-up(md) {
display: flex;
justify-content: center;
align-items: flex-start;
.col {
position: relative;
flex: 1;
padding: $base-margin*2;
}
}
}
}
.input-field {
margin-bottom: $base-margin *2;
label {
font-weight: bold;
// margin-bottom: $base-margin/2;
display: block;
}
p {
font-size: 0.8rem;
margin-bottom: $base-margin/2;
}
input {
width: 100%;
}
}
input {
padding: $base-margin / 2 $base-margin - 5;
font-size: 1rem;
border: none;
border-bottom: 2px solid $brand-light;;
&:focus {
outline: none;
border-color: $brand-dark;
}
}
.input-field--checkbox {
label {
display: inline-block !important;
}
}
input[type="checkbox"] {
display: inline-block;
width: auto;
transform: translatey(-3px);
}
input[type="file"] {
background-color: rgba($brand-dark, .1);
padding: $base-margin *2;
color: $brand-light;
}
button,
.btn {
font-size: 32px;
background-color: $base-two;
// color: $brand-light;
font-weight: bold;
padding: $base-margin/2 $base-margin;
border: 2px solid $base-two;
// border-radius: 50px;
transition: background-color, color, opacity;
transition-duration: 300ms;
transition-timing-function: ease;
&:hover {
background-color: $brand-light;
color: $brand-dark;
}
&:disabled {
// opacity: .4;
cursor:not-allowed;
background-color: $brand-grey;
border-color: $brand-grey;
&:hover {
background-color: $brand-grey;
border-color: $brand-grey;
}
}
}
#download {
// position: absolute;
// top: -$base-margin*4;
// right: 0;
font-size: 34px;
width: 100%;
margin-bottom: $base-margin*2;
span {
margin-left: $base-margin;
transform: translateY(3px);
display: inline-block;
}
}
//------------------------------------------------------//
// END User interface
//------------------------------------------------------//
//------------------------------------------------------//
// App logic
//------------------------------------------------------//
canvas,
#export-image {
width: 1200px;
height: 630px;
}
#export-image {
position: relative;
overflow: hidden;
background-color: pink;
#background {
position: relative;
width: 120%;
height: 1500vmax;
img {
display: block;
position: absolute;
max-width: 100%;
z-index: 1;
}
}
#background,
#logo {
svg,
img {
pointer-events: none;
}
}
}
// #background,
#pletterij,
#logo,
#title {
cursor: move;
position: absolute;
z-index: 99999999;
}
#title {
top: $base-margin * 5;
left: $base-margin * 5;
}
#logo {
right: $base-margin * 5;
bottom: $base-margin * 5;
img {
max-width: 100%;
}
}
//------------------------------------------------------//
// END App logic
//------------------------------------------------------//
//------------------------------------------------------//
// Extra
//------------------------------------------------------//
.container {
width: 100%;
padding: $base-margin * 2 0;
}
#export-image {
margin: 0 auto;
}
iframe#cp_embed_zwXPjX {
transform: translateY(-50px);
height: calc(100vh + 50px);
border: 0;
}
#tool * {
-webkit-touch-callout: none; /* iOS Safari */
-webkit-user-select: none; /* Safari */
-khtml-user-select: none; /* Konqueror HTML */
-moz-user-select: none; /* Firefox */
-ms-user-select: none; /* Internet Explorer/Edge */
user-select: none; /* Non-prefixed version, currently
supported by Chrome and Opera */
}
* {
box-sizing: border-box;
}
body {
margin: 0;
font-size: 18px;
line-height: 1.4em;
font-family: sans-serif;
}
h1 {
font-size: 24px;
font-weight: bold;
margin-bottom: $base-margin;
}
strong {
font-weight: bold;
}
p {
margin-bottom: $base-margin;
}
a {
color: $brand-dark;
}
//------------------------------------------------------//
// END Extra
//------------------------------------------------------//
//Add a description to the data object with the value "A pair of warm, fuzzy socks". Then display the description using an expression in an p element, underneath the h1.
var app = new Vue({
el: "#app",
data: {
title: "Docu Lab | Event title ",
date: "22 jun 2019 | 20:00 ",
image: "",
logo: true
},
methods: {
//------------------------------------------------------//
// File upload
//------------------------------------------------------//
onFileChange(e) {
var files = e.target.files || e.dataTransfer.files;
if (!files.length) return;
this.createImage(files[0]);
},
createImage(file) {
var image = new Image();
var reader = new FileReader();
var vm = this;
reader.onload = e => {
vm.image = e.target.result;
};
reader.readAsDataURL(file);
},
removeImage: function(e) {
this.image = "";
}
//------------------------------------------------------//
// END File upload
//------------------------------------------------------//
},
mounted() {
//------------------------------------------------------//
// Drag & drop
//------------------------------------------------------//
// var contextmenu = document.querySelector('.draggable');
// var initX, initY, mousePressX, mousePressY;
// contextmenu.addEventListener('mousedown', function(event) {
// initX = this.offsetLeft;
// initY = this.offsetTop;
// mousePressX = event.clientX;
// mousePressY = event.clientY;
// this.addEventListener('mousemove', repositionElement, false);
// window.addEventListener('mouseup', function() {
// contextmenu.removeEventListener('mousemove', repositionElement, false);
// }, false);
// }, false);
// function repositionElement(event) {
// // this.style.left = initX + event.clientX - mousePressX + 'px';
// this.style.top = initY + event.clientY - mousePressY + 'px';
// }
// Learnt and adapted from: http://tech.pro/tutorial/650/javascript-draggable-elements from a user comments post/code (@TheDesigner in 2009-ish).
// Global variables without any specified type (type will be determined when used in the functions below).
var obj, x, y, prev_x, prev_y;
function drag(e) {
// Yep, use the object I just clicked on.
obj = e.target;
// Set current X coordinate minus distance left from offsetParent node.
prev_x = x - obj.offsetLeft;
// Set current Y coordinate minus distance top from offsetParent node.
prev_y = y - obj.offsetTop;
// Change the object's color so it looks like it's usable/moveable.
// obj.style.background = '#00ff00';
}
function move(e) {
// Always track and record the mouse's current position.
if (e.pageX) {
x = e.pageX; // X coordinate based on page, not viewport.
y = e.pageY; // Y coordinate based on page, not viewport.
}
// else if (e.clientX) {
// x=clientX; // X coordinate based on viewport.
// y=clientY; // Y coordinate based on viewport.
// }
// If the object specifically is selected, then move it to the X/Y coordinates that are always being tracked.
if (obj) {
obj.style.left = x - prev_x + "px";
obj.style.top = y - prev_y + "px";
}
}
function drop() {
// Revert to the default css style.
obj.style.background = "";
// Remove the attached event from the element so it doesn't keep following your mouse. :)
obj = false;
}
// Make a specific element movable
document.querySelector("#background").onmousedown = drag;
document.querySelector("#title").onmousedown = drag;
document.querySelector("#logo").onmousedown = drag;
document.onmousemove = move;
document.onmouseup = drop;
//------------------------------------------------------//
// END Drag & drop
//------------------------------------------------------//
//------------------------------------------------------//
// Generate image
//------------------------------------------------------//
const capture = document.querySelector("#export-image");
const button = document.querySelector("#download");
// Function on click
function downloadImage() {
html2canvas(capture, {
allowTaint: true,
onrendered: function(canvas) {
canvas.toBlob(function(blob) {
saveAs(blob, "social.jpg");
}, "image/jpeg");
}
});
}
// Event Listener
button.addEventListener("click", downloadImage);
//------------------------------------------------------//
// END Generate image
//------------------------------------------------------//
}
});
Also see: Tab Triggers