Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource


Babel includes JSX processing.

Add External Scripts/Pens

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.

+ add another resource


Add Packages

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.


Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.


                <h1>Social Media Sharing: Meta Tag Generator</h1>

<div class="notes">
  <p>Refer to the article "<a href="" target="_blank">The Essential Meta Tags for Social Media</a>" that I wrote for CSS-Tricks. There you will find a detailed discussion of which <code>META</code> tags are necessary to optimize a page for sharing on social media.</p>

<h2>Web Page Information</h2>

<table class="meta-table">
    <td><label for="mt-title">Page Title:</label></td>
    <td><input type="text" id="mt-title">(Essential)</td>
    <td><label for="mt-description">Page Description:</label></td>
    <td><input type="text" id="mt-description">(Essential)</td>
    <td><label for="mt-pageurl">Page URL:</label></td>
    <td><input type="text" id="mt-pageurl">(Essential)</td>
  <tr class="padding">
    <td><label for="mt-imageurl">Image URL:</label></td>
    <td><input type="text" id="mt-imageurl">(Essential)</td>
    <td><label for="mt-site">Site Name:</label></td>
    <td><input type="text" id="mt-site">(Recommended)</td>
  <tr class="padding">
    <td><label for="mt-alt">Alt Image Text:</label></td>
    <td><input type="text" id="mt-alt">(Recommended)</td>
    <td><label for="mt-appid">Facebook App ID:</label></td>
    <td><input type="text" id="mt-appid">(Only for Analytics)</td>
    <td><label for="mt-username">Twitter Username:</label></td>
    <td><input type="text" id="mt-username">(Only for Analytics)</td>

<h2>Generated Meta Tags</h2>
<textarea id="meta-tags"></textarea>
<button>Copy to Clipboard</button>


                body {
  width: 95%;
  max-width: 800px;
  font-family: tahoma, sans-serif;
  font-size: 14px;
  line-height: 1.4;
  padding: 0 10px 20px 10px;
  margin: 0 auto 0 auto;

h1 {
  text-align: center;

.notes {
  width: 50%;
  text-align: center;
  margin: 0 auto 40px auto;

code {
  background-color: #eee;
  padding: 0 3px 0 3px;

table {
  margin: 0 0 30px 0;

label {
  font-weight: bold;

input {
  width: 500px;
  padding: 2px;
  margin: 0 10px 0 0;

td:first-child {
  text-align: right;
  padding: 0 5px 0 0;

tr.padding td {
  padding-bottom: 30px;

textarea {
  display: block;
  width: 100%;
  height: 200px;
  font-family: monospace;
  white-space: pre;
  margin: 0 0 10px 0;


                jQuery('table').on('input', function() {
  title = jQuery("#mt-title").val();
  description = jQuery("#mt-description").val();
  pageURL = jQuery("#mt-pageurl").val();
  imageURL = jQuery("#mt-imageurl").val();
  site = jQuery("#mt-site").val();
  alt = jQuery("#mt-alt").val();
  appID = jQuery("#mt-appid").val();
  username = jQuery("#mt-username").val();
  part0 = '<title>' + title + '</title>\n';
  part1 = '<meta name="description" content="' + description + '">\n';
  part2 = '<meta property="og:title" content="' + title + '">\n';
  part3 = '<meta property="og:description" content="' + description + '">\n';
  part4 = '<meta property="og:url" content="' + pageURL + '">\n';
  part5 = '<meta property="og:image" content="' + imageURL + '">\n';
  part6 = '<meta property="og:site_name" content="' + site + '">\n';
  part7 = '<meta property="fb:app_id" content="' + appID + '">\n';
  part8 = '<meta name="twitter:card" content="summary_large_image">\n';
  part9 = '<meta name="twitter:image:alt" content="' + alt + '">\n';
  part10 = '<meta name="twitter:site" content="' + username + '">\n';
  if (site == "") { part6 = "" };
  if (appID == "") { part7 = "" };
  if (alt == "") { part9 = "" };
  if (username == "") { part10 = "" };

  jQuery("textarea").html(part0 + part1 + part2 + part3 + part4 + part5 + part6 + part7 + part8 + part9 + part10);

jQuery('button').on('click', function() {