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

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 class="demo-layout-transparent mdl-layout mdl-js-layout">
  <header class="mdl-layout__header mdl-layout__header--transparent">
    <div class="mdl-layout__header-row">
      <!-- Title -->
      <span class="mdl-layout-title">Remembrance poppy</span>
      <!-- Add spacer, to align navigation to the right -->
      <div class="mdl-layout-spacer"></div>
      <!-- Navigation -->
      <nav class="mdl-navigation">
        <a class="mdl-navigation__link" href="#">Origins</a>
        <a class="mdl-navigation__link" href="#">Usage</a>
        <a class="mdl-navigation__link" href="#">Other designs</a>
        <a class="mdl-navigation__link" href="#">Protests</a>
      </nav>
    </div>
  </header>
  <div class="mdl-layout__drawer">
    <span class="mdl-layout-title">Title</span>
    <nav class="mdl-navigation">
      <a class="mdl-navigation__link" href="#">Origins</a>
      <a class="mdl-navigation__link" href="#">Usage</a>
      <a class="mdl-navigation__link" href="#">Other designs</a>
      <a class="mdl-navigation__link" href="#">Protests</a>
    </nav>
  </div>
  <main class="mdl-layout__content">
    <p>The remembrance poppy is an artificial flower, which has been used since 1921 to commemorate military personnel who have died in war, and represents a common or field poppy, Papaver rhoeas. Inspired by the World War I poem "In Flanders Fields", and
      promoted by Moina Michael, they were first adopted by the American Legion to commemorate American soldiers killed in that war (1914–1918). They were then adopted by military veterans' groups in parts of the former British Empire: the United Kingdom,
      Canada, Australia and New Zealand. Today, they are most common in the UK and Canada, and are used to commemorate their servicemen and women killed in all conflicts since 1914. There, small artificial poppies are often worn on clothing leading up
      to Remembrance Day/Armistice Day (11 November).[2] Poppy wreaths are also often laid at war memorials.
    </p>
    <p>The remembrance poppy is especially prominent in the UK. In the weeks leading up to Remembrance Sunday, they are distributed by The Royal British Legion in return for donations to their "Poppy Appeal", which supports all current and former British
      military personnel. During this time, all public figures and people appearing on television are expected to wear them, and those who do not have been criticized. Some have berated this as "poppy fascism" and argued that the Appeal is being used
      to justify and glorify current wars. In Northern Ireland the poppy is especially controversial and politicized; most Irish nationalists and Irish Catholics refuse to wear one, mainly due to actions of the British Army during the Troubles, while
      Ulster Protestants and Unionists usually wear them.</p>
  </main>
  <!-- Flat button with ripple -->
  <button type="button" class="mdl-button mdl-js-button mdl-button--accent" onclick="removeBackground()">
            Change UI
        </button>
</div>
              
            
!

CSS

              
                /* Uses a transparent header that draws on top of the layout's background*/

.demo-layout-transparent {
  background: url('http://wallpapercave.com/wp/w9yJH4s.jpg') center / cover;
}

.demo-layout-transparent .mdl-layout__header,
.demo-layout-transparent .mdl-layout__drawer-button {
  /* This background is dark, so we set text to white. Use 87% black instead if
     your background is light. */
  color: gray;
}

.mdl-layout__content p {
  width: 70%;
  padding: 25px;
  color: white;
}
              
            
!

JS

              
                function removeBackground() {
  "use strict";

  var newColor = document.getElementsByTagName('p');
    var url1 = 'url("http://saunders1865.com/wp-content/uploads/2014/10/poppy.jpg")';
    var url2 = 'url("http://wallpapercave.com/wp/w9yJH4s.jpg")';

  function changeImage() {
    var temp = document.getElementsByClassName('demo-layout-transparent')[0];
    var newImage = temp.style.backgroundImage;
    if (newImage == url1) {
      newImage = url2;

    } else {

      newImage = url1;      
    }

    temp.style.backgroundImage = newImage;
  }
  changeImage();

  for (let i = 0; i < newColor.length; i += 1) {
    newColor[i].style.color = "blue";
  }

}
              
            
!
999px

Console