css Audio - Active file-generic CSS - Active Generic - Active HTML - Active JS - Active SVG - Active Text - Active file-generic Video - Active header Love html icon-new-collection icon-person icon-team numbered-list123 pop-out spinner split-screen star tv

Pen Settings

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

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              <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>
            
          
!
            
              /* 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;
}
            
          
!
            
              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
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................

Console