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="table-wrapper">
  <table class="table">
    <thead>
      <tr>
        <th>水果</th>
        <th>餅乾</th>
        <th>飲料</th>
        <th>伴手禮</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td data-title="水果">
          <ul>
            <li>蘋果</li>
            <li>水蜜桃</li>
            <li>香蕉</li>
          </ul>
        </td>
        <td data-title="餅乾">
          <ul>
            <li>品客</li>
            <li>波卡</li>
            <li>孔雀餅乾</li>
            <li>浪味仙</li>
          </ul>
        </td>
        <td data-title="飲料">
          <ul>
            <li>珍珠奶茶</li>
            <li>烏龍拿鐵</li>
            <li>拿鐵咖啡</li>
            <li>奶蓋青茶</li>
          </ul>
        </td>
        <td data-title="伴手禮">
          <ul>
            <li>鳳梨酥</li>
            <li>乳酪蛋糕</li>
            <li>杏仁餅</li>
          </ul>
        </td>
      </tr>
    </tbody>
  </table>
</div>
              
            
!

CSS

              
                /* ---------------------------- */
/*  Table Styles
------------------------------- */

.table-wrapper {
  margin: 50px;
  box-shadow: 0px 35px 50px rgba(27, 31, 49, 0.1);
}

.table {
  border-collapse: collapse;
  width: 100%;
  background-color: white;
}

.table td,
.table th {
  text-align: center;
  padding: 10px;
}

.table td {
  border-right: 1px solid #f8f8f8;
}

/*  thead th color
------------------------------- */

.table thead th {
  color: #ffffff;
  background: #ffb4a2; /* 指定第一個和預設的標題顏色 */
}

.table thead th:nth-child(2) {
  background: #e5989b; /* 指定第二個標題顏色 */
}

.table thead th:nth-child(3) {
  background: #b5838d; /* 指定第三個標題顏色 */
}

.table thead th:nth-child(4) {
  background: #6d6875; /* 指定第四個標題顏色 */
}

/*  table ul
------------------------------- */

.table ul {
  padding: 20px;
  margin: 0;
  text-align: left;
}
.table ul li {
  border-bottom: 1px solid #e7e7e7;
  padding: 5px;
  position: relative;
  list-style-type: none;
}

/*  Responsive
------------------------------- */

@media (max-width: 767px) {
  .table-wrapper {
    margin: 30px 15px;
  }

  .table thead {
    display: none;
  }

  .table td {
    display: block; /* 一定要下! */
    padding: 0;
  }

  .table td:before {
    content: attr(data-title); /* 顯示 data-title */
    display: inline-block;
    width: 100%;
    font-weight: 500;
    padding: 6px 0;
    color: #ffffff;
    background: #ffb4a2; /* 指定第一個和預設的標題顏色 */
  }

  .table td:nth-child(2):before {
    background: #e5989b; /* 指定第二個標題顏色 */
  }

  .table td:nth-child(3):before {
    background: #b5838d; /* 指定第三個標題顏色 */
  }

  .table td:nth-child(4):before {
    background: #6d6875; /* 指定第四個標題顏色 */
  }
}

              
            
!

JS

              
                
              
            
!
999px

Console