cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

Code Indentation

     

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.

            
              <div class="jumbotron">
  <h1><img src="https://upload.wikimedia.org/wikipedia/commons/thumb/2/2f/Google_2015_logo.svg/2000px-Google_2015_logo.svg.png" width="133">  SERP Snippet</h1>
  <p>Use this tool when crafting your Title and Meta descriptions, you can see a preview of your site's snippet on Search Engine Results Page (SERPs).
  </p>

  <div>URL: <input type="url" name="url" placeholder="http://www.site.com/slug-less-than-5-words" style="width: 315px;" placeholder="Add comments:" onkeyup="document.getElementById('urlSlug').innerHTML = this.value"></div>
  <div>SEO Title: <input type="text" id="title" name="title" style="width: 315px;" placeholder="Titles truncated after approx. 70 characters" onkeyup="titleCheckPreview()">
  </div>
  <div>Meta Description: <input type="text" id="description" name="description" style="width: 315px;" placeholder="Descriptions truncated after approx. 150 characters" onkeyup="metaCheckPreview()"></div>
  </br>
  <div><strong><mark>SERP Preview:
    </mark></strong>
    <div id="seoTitle"></div>
    <div id="urlDomain"></div>
    <div id="urlSlug"></div>
    <div id="metaDescription"></div>      </div>
            
          
!
            
              // On keyUp, check & preview Title
function titleCheckPreview(){
       checkTitleLength();
       previewTitle();
}

// Title character count more than 70
function checkTitleLength() {
 var strTextTitle = title.value;
 strTextTitle = strTextTitle.replace(/^\s+|\s+$/g,"");

 if(strTextTitle.length > 70) {
  title.style.backgroundColor = "#F88379";
 } else {
  title.style.backgroundColor = "#ffffff";
 }
}

// Title SERP Preview
function previewTitle(){
  var inputBox = document.getElementById('title');
  document.getElementById('seoTitle').innerHTML = inputBox.value;
}

// On keyUp, check & preview Meta Description
function metaCheckPreview(){
       checkMetaLength();
       previewMeta();
}

// Meta Description count more than 150
function checkMetaLength() {
 var strTextMeta = description.value;
 strTextMeta = strTextMeta.replace(/^\s+|\s+$/g,"");

 if(strTextMeta.length > 150) {
  description.style.backgroundColor = "#F88379";
 } else {
  description.style.backgroundColor = "#ffffff";
 }
}

// Meta Description SERP Preview
function previewMeta(){
  var inputBox = document.getElementById('description');
  document.getElementById('metaDescription').innerHTML = inputBox.value;
};

            
          
!
999px
Close

Asset uploading is a PRO feature.

As a PRO member, you can drag-and-drop upload files here to use as resources. Images, Libraries, JSON data... anything you want. You can even edit them anytime, like any other code on CodePen.

Go PRO

Loading ..................

Console