Pen Settings

HTML

CSS

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

JavaScript

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

Packages

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.

Behavior

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.

HTML

              
                div#container 

  div#header
    h2 My Favorite Links
    small save your best links

  div#content
    ul#favorite-links  
      li
        a href="http://artslab.info" Artslab
        button.removebtn x
      li
        a href="https://codepen.io" Codepen
        button.removebtn x
      li
        a href="http://thenews.im/" The News
        button.removebtn x



    div#new-link-button
        button Add New Link

  div#add-link-form
    label Title
    br
    input#title placeholder="Title here"
    br
    label URL
    br
    input#url value="http://"
    br
    button#add Save Link

              
            
!

CSS

              
                body {
  font-family: HelveticaNeue-UltraLight;
  letter-spacing: 0.03em;
  background: #eee;
}

#container {
  margin:20px 0;
  width:300px;
  position:relative;
  left:50%;
  margin-left:-150px;
  background: #fff;
}

#header{
  background: #ccc;
  padding:20px;
}

#content {
   padding: 5px 20px 10px 20px;
}

h2 {
  padding:0;
  margin:0;
  font-weight:100;
  color: #333;
}

ul {
  padding: 0;
  margin: 0px;
}

.removebtn { 
  border:none;
  background: none;
  color: #999;
  float:right;
}

.removebtn:hover {
  opacity: 0.7;
}

ul li {
  margin: 0;
  list-style:none;
}

#favorite-links li {
  padding:10px;
  border-bottom: 1px solid #ccc;
 
}

#favorite-links li:last-child {
  border:none;
}

#favorite-links a {
  color: #333;
  text-decoration:none;
}

#favorite-links li:hover {
  background: #ccc;
}

#add-link-form {
  display:none;
  background: #444;
  padding:20px;
  color: #ccc;
}

#add-link-form input {
  margin: 5px 0;
  width:250px;
  color: #333;
  padding:5px;
  outline:none;
  border:none;
}


#new-link-button button, #add-link-form button {
  margin:10px 0;
  background: #e74c3c;
  border: none;
  color: #fff;
  padding:5px 15px;
  width:100%;
  height:35px;
}

              
            
!

JS

              
                $(document).ready(function() {
  var $ul = $('#favorite-links');
  var $title = $('#title');
  var $url = $('#url');
  
  //get items from local storage
  if(localStorage.getItem('vk-links')){
   $ul.html(localStorage.getItem('vk-links'));
  }
  
  // add nwe item
  $('#add').click(function () {

    //add new item
    $('#favorite-links').append('<li><a href="'+$url.val()+'">'+$title.val()+'</a><button class="removebtn">x</button></li>');

    //save changes to localstorage
    localStorage.setItem('vk-links', $ul.html());

    //reset form
    $title.val("");
    $url.val("http://");
    $("#add-link-form").slideToggle("100");
    
  });
  
  //remove item
  $("#favorite-links").on('click','.removebtn',function() {
    $(this).parent().remove();
    //save changes to localstorage
    localStorage.setItem('vk-links', $ul.html());
  });

  //form toggle
  $("#new-link-button").click(function() {
    $("#add-link-form").slideToggle("100");
  });
  
});



              
            
!
999px

Console