Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

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.

+ 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.


Auto Save

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>Giphy Search</h1>
  <form action="" method="post" autocomplete="off">
    <label for="" style="display: none;">Search</label>
    <input class="search" type="text" name="search" placeholder="Search" required>
    <input class="btn" type="submit" value="OK">
    <input class="btn clear" value="Clear" readonly>

  <div class="giphy">
    <a href="" target="_blank">
      <img src="" alt="giphy">

  <p>Created by <a href="" target="_blank">Rémy Beumier</a> with <a href="" target="_blank">Giphy API</a></p>


* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;

body {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  font-family: Arial;
  text-align: center;
  min-height: 100vh;
  min-width: 370px;
  background-image: linear-gradient(135deg,#00ccff,#9933ff 31%,#e646b6 52%,#fff9aa 77%,#00ff99,#00ccff);
  background-size: 200%;

header h1 {
  padding: 20px 10px;
  letter-spacing: 0.2em;
  color: white;

form * {
  background: rgba(256,256,256, 0.3);
  color: white;

form .search, form .btn {
  padding: 10px;
  border-radius: 2px;
  font-size: 16px;
  border: 1px solid white;

::placeholder {
  color: #f5f5f5;

form .search {
  width: 40%;
  min-width: 200px;
  max-width: 600px; 
form .search:focus {
  outline: 0;
  color: #333;
  background: white;
  box-shadow: 0 0 1px 1px rgba(0,0,0,0.3);

form .btn {
  cursor: pointer;
  width: 60px;
form .btn[type="submit"] {
  -webkit-appearance: button;
form .btn:hover {
  color: #333;
  background: white;
form .clear:hover {
  background: ;

.giphy {
  padding: 20px 0 15px 0;

.giphy img {
  width: 200px;
  max-width: 800px;
  margin: auto;
  display: block;

.giphy img.gif {
  width: 50%;
  max-width: 600px;
  box-shadow: 0 0 2px 2px rgba(256,256,256,0.3);

footer {
  padding: 5px;
  font-size: 14px;
  color: white;

footer a {
  color: #333;
  text-decoration: none;
footer a:hover {
  color: white;
  text-decoration: underline;



// check other info returned by the API ???

var $form = $("form");
var $search = $(".search");
var $clear = $(".clear");
var $giphy = $(".giphy img");
var $giphyLink = $(".giphy a");

// launch function on form submit
$form.on("submit", function(e) {

// clear input on click
$clear.on("click", function() {

function goGiphy() {
  var input = $search.val();
  // Ajax call to giphy API  
  $.getJSON("" + input, function(json) {
    data = JSON.parse(JSON.stringify(json));
    imgSrc =;
    setTimeout( function() {
      $giphy.attr("src", imgSrc);
      $giphyLink.attr("href", imgSrc);
      setTimeout( function() {
      }, 800);
    }, 800);