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

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.

HTML

              
                <html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">

</head>
<body>

<h2>下拉式選單(點擊版)</h2>
<p>嘗試點擊以下按鈕,你將會看到幾個可愛的超連結</p>

<div class="dropdown">
  <button onclick="showTheList()" class="dropdown-button">我是按鈕~請點擊我</button>
  <div id="iris-dropdown" class="dropdown-list">
    <a href="https://www.facebook.com/groups/936052100195289/">小白社群</a>
    <a href="https://blog.happycoding.today/category/codingwithnewbie/">小白部落格</a>
    <a href="https://open.firstory.me/user/superjunior">小白Podcast頻道</a>
  </div>

</body>
</html>

              
            
!

CSS

              
                
.dropdown-button {
  background-color: #f0a8d0;
  color: white;
  padding: 16px;
  font-size: 16px;
  border: none;
  cursor: pointer;
}

.dropdown-button:hover, .dropdown-button:focus {
  background-color: #ed2874;
}

.dropdown-list {
  display: none;
  position: absolute;
  background-color: #fae8f1;
  min-width: 175px;
  box-shadow: 0px 8px 8px 0px rgba(0,0,0,0.4);
}

.dropdown-list a {
  color: black;
  padding: 12px 16px;
  text-decoration: none;
  display: block;
}

.dropdown a:hover {background-color: #ed91b1;}

.showPlease {display: block;}

              
            
!

JS

              
                function showTheList() {
  document.getElementById("iris-dropdown").classList.toggle("showPlease");
}


window.onclick = function(event) {
  if (!event.target.matches('.dropdown-button')) {
    var Dropdown = document.getElementsByClassName("dropdown-list");
    var i;
    for (i = 0; i < Dropdown.length; i++) {
      var openTheList = Dropdown[i];
      if (openTheList.classList.contains('showPlease')) {
        openTheList.classList.remove('showPlease');
      }
    }
  }
}

              
            
!
999px

Console