Pen Settings

HTML

CSS

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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ 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

              
                <html>

<head>

  <!--Import Google Icon Font-->
     <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">

  <!--Import materialize.css-->
     <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.2/css/materialize.min.css">

<!--Import jQuery before materialize.js-->
     <script type="text/javascript" src="https://code.jquery.com/jquery-2.1.1.min.js"></script>

 <!-- Compiled and minified JavaScript -->
     <script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.2/js/materialize.min.js"></script>

</head>

<body>
<header class="top-nav">
    <nav class="nav-extended">
      <div class="nav-wrapper">
        <a href="#" class="brand-logo">Custom Theme</a>
        <a href="#" data-activates="mobile-demo" class="button-collapse"><i class="material-icons">menu</i></a>
        <ul id="nav-mobile" class="right hide-on-med-and-down">
          <li><a href="sass.html">Sass</a></li>
          <li><a href="badges.html">Components</a></li>
          <li><a href="collapsible.html">JavaScript</a></li>
        </ul>
        <ul class="side-nav" id="mobile-demo">
          <li><a href="sass.html">Sass</a></li>
          <li><a href="badges.html">Components</a></li>
          <li><a href="collapsible.html">JavaScript</a></li>
        </ul>
      </div>

</header>
<main>
<div class="container">
  
   <blockquote>
     Click on <label>SET THEME COLOR</label> to change theme of this page. The Selected <label>'Theme Color'</label> will be stored in local storage, go on refresh this page.
    </blockquote>
  
  <ul class="collection  z-depth-1 ">
     <li class="collection-item avatar">
       <img src="https://images.pexels.com/photos/58020/pexels-photo-58020.jpeg?w=940&h=650&auto=compress&cs=tinysrgb"
       style="width:70px; height:70px"alt="" class="circle">
       <span class="title"  style="margin-left:30px;">Title</span>
       <p style="margin-left:30px;">First Line <br>
          Second Line
       </p>
       <a href="#!" class="secondary-content"><i class="material-icons">grade</i></a>
     </li>
   </ul>
  
   <div class="row">
    <form class="col s12">
      <div class="row">
        <div class="input-field col s6">
          <i class="material-icons prefix">account_circle</i>
          <input id="icon_prefix" type="text" value="Alvin" class="validate">
          <label for="icon_prefix">First Name</label>
        </div>
        <div class="input-field col s6">
          <i class="material-icons prefix">phone</i>
          <input id="icon_telephone" type="tel" class="validate">
          <label for="icon_telephone">Telephone</label>
        </div>
      </div>
    </form>
  </div>


        <button  class="btn waves-effect waves-light" type="submit" name="action">Set Theme Color
           <i class="material-icons right">send</i>
         </button>
  
   <!-- Dropdown Trigger -->
  <a class='dropdown-button btn' href='#' data-activates='dropdown1'>Drop Me!</a>

  <!-- Dropdown Structure -->
  <ul id='dropdown1' class='dropdown-content'>
    <li><a href="#!">one</a></li>
    <li><a href="#!">two</a></li>
    <li class="divider"></li>
    <li><a href="#!">three</a></li>
    <li><a href="#!"><i class="material-icons">view_module</i>four</a></li>
    <li><a href="#!"><i class="material-icons">cloud</i>five</a></li>
  </ul>
        
  
</main>

</div>

<footer class="page-footer">
       <div class="container">
         
           
<ul id='dropdown1' class='dropdown-content'>
    <li><a href="#!">one</a></li>
    <li><a href="#!">two</a></li>
    <li class="divider"></li>
    <li><a href="#!">three</a></li>
    <li><a href="#!"><i class="material-icons">view_module</i>four</a></li>
    <li><a href="#!"><i class="material-icons">cloud</i>five</a></li>
  </ul>
         <div class="row">
           <div class="col l6 s12">
             <h5 class="white-text">Footer Content</h5>
             <p class="grey-text text-lighten-4">You can use rows and columns here to organize your footer content.</p>
           </div>
           <div class="col l4 offset-l2 s12">
             <h5 class="white-text">Links</h5>
             <ul>
               <li><a class="grey-text text-lighten-3" href="#!">Link 1</a></li>
               <li><a class="grey-text text-lighten-3" href="#!">Link 2</a></li>
               <li><a class="grey-text text-lighten-3" href="#!">Link 3</a></li>
               <li><a class="grey-text text-lighten-3" href="#!">Link 4</a></li>
             </ul>
           </div>
         </div>
       </div>
       <div class="footer-copyright">
         <div class="container">
         © 2014 Copyright Text
         <a class="grey-text text-lighten-4 right" href="#!">More Links</a>
         </div>
       </div>
</footer>

</body>

<script>
  
  var themeColor ;

// Check browser support
if (typeof(Storage) !== "undefined") {
    // Store
    themeColor = localStorage.getItem("themeColor");
   if(themeColor == undefined)
   {localStorage.setItem("themeColor", "blue");
    themeColor = 'blue';
    } 
  
} else {
  Materialize.toast("Sorry, your browser does not support Web Storage...", 4000) 
}

      $(".nav-wrapper").css("background-color", themeColor);
      $(".secondary-content>.material-icons").css("color", themeColor);
      $(".btn").css("background-color", themeColor);
      $(".page-footer").css("background-color",themeColor);
      $(".input-field").css("color", themeColor);
      $(".input-field>.material-icons").css("color", themeColor);
      $(".input-field>label").css("color",themeColor);
      $(".dropdown-content>li>a").css("color", themeColor);
function getRandomColor() {
   var letters = '0123456789ABCDEF'.split('');
   var color = '#';
   for (var i = 0; i < 6; i++ ) {
       color += letters[Math.floor(Math.random() * 16)];
   }
   return color;
}

$(document).ready(function(){
  
  
  $('.dropdown-button').dropdown({
      inDuration: 300,
      outDuration: 225,
      constrainWidth: false, // Does not change width of dropdown to that of the activator
      hover: true, // Activate on hover
      gutter: 0, // Spacing from edge
      belowOrigin: false, // Displays dropdown below the button
      alignment: 'left', // Displays dropdown with edge aligned to the left of button
      stopPropagation: false // Stops event propagation
    }
  );

    $("button").click(function(){
      var themeColor = getRandomColor();
      $(".nav-wrapper").css("background-color", themeColor);
      $(".secondary-content>.material-icons").css("color", themeColor);
      $(".btn").css("background-color", themeColor);
      $(".page-footer").css("background-color", themeColor);
      $(".input-field").css("color", themeColor);
      $(".input-field>.material-icons").css("color", themeColor);
      $(".input-field>label").css("color", themeColor);
      $(".btn-floating").css("background-color", themeColor);
      $(".dropdown-content>li>a").css("color", themeColor);
      
      // Update Theme Color
       if (typeof(Storage) !== "undefined") {
        // Store
        localStorage.setItem("themeColor", themeColor);

       } else {
      Materialize.toast("Sorry, your browser does not support Web Storage...", 4000) 
       }

    });
});
</script>
</script>
</html>

              
            
!

CSS

              
                body {
   display: flex;
   min-height: 100vh;
   flex-direction: column;
 }

 main {
   flex: 1 0 auto;
 }
}
              
            
!

JS

              
                
              
            
!
999px

Console