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

              
                <h2>當只有一篇文章時</h2>
<div class="article-list">
  <div class="article">
    <h3>如何成為前端工程師</h3>
    <p>成為前端工程師需要具備多方面的技能,並且隨著技術發展持續學習</p>
  </div>
</div>

<hr>

<h2>當有多篇文章時</h2>
<div class="article-list">
  <div class="article">
    <h3>HTML5 新特性介紹</h3>
    <p>這篇文章將介紹 HTML5 的新特性,以及如何應用這些特性來提升網站的互動性。</p>
  </div>
  <div class="article">
    <h3>CSS Flexbox 完整指南</h3>
    <p>本指南將深入解說 Flexbox 布局模型,幫助你打造更靈活的網頁排版。</p>
  </div>
  <div class="article">
    <h3>JavaScript ES6 語法更新</h3>
    <p>這篇文章詳細講解了 ES6 版本中的 JavaScript 語法更新,並展示了常見的使用範例。</p>
  </div>
</div>
              
            
!

CSS

              
                .article-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.article {
  padding: 15px;
  border: 1px solid #bbb;
  font-size: 16px;
  background-color: #f2f2f2;
}

/* 只有一篇文章時,調整邊框和字體大小 */
.article:only-child {
  border: 2px solid #4caf50;
  font-size: 20px;
  background-color: #e8f5e9;
}

              
            
!

JS

              
                
              
            
!
999px

Console