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

              
                <a href="#" class="link-5">STEAM 教育學習網</a> ( hover + 漸層色偽裝底線 + 轉場 )</body>
<br>
<a href="#" class="link-6">STEAM 教育學習網</a> ( hover + 漸層色背景動畫 )</body>

              
            
!

CSS

              
                body {line-height: 2;}
a[class] {color: blue;}        /* 有 class 的超連結文字為藍色 */
a[class]:hover {color: red;}  /* 有 class 的超連結 hover 時文字為紅色 */

/* 建立自訂屬性 --c,類型為顏色 */
@property --c {
  syntax: "<color>";
  inherits: true;
  initial-value: blue;
}
/* 建立自訂屬性 --y,類型為長度 */
@property --y {
  syntax: "<length>";
  inherits: true;
  initial-value: 2px;
}

.link-5 {
  line-height: 1.3;
  display:inline-block;                   /* 改成 inline-block 顯示類型,才能控制尺寸 */
  text-decoration: none;                  /* 隱藏底線 */
  transition: all .5s, --c .5s, --y .5s;  /* 將自訂屬性套用轉場效果 */
  /* 背景漸層色中使用自訂屬性 */
  background: linear-gradient(0deg, 
    var(--c) 0, 
    var(--c) 2px, 
    #0000 var(--y), 
    #0000 100%);
}
/* hover 時改變自訂屬性 */
.link-5:hover {
  --c: red;
  --y: 15px;
}

/* 建立自訂屬性 --dx,類型為長度 */
@property --dx {
  syntax: "<length>";
  inherits: true;
  initial-value: 0;
}
.link-6 {
  line-height: 1.3;
  display: inline-block;   /* 改成 inline-block 顯示類型,才能控制尺寸 */
}
.link-6:hover {
  text-decoration: none;   /* 隱藏底線 */
  /* 漸層色中使用自訂屬性 */
  background: repeating-linear-gradient(
      to right,
      pink calc(var(--dx)),  pink calc(10px + var(--dx)),
      #0000 calc(10px + var(--dx)), #0000 calc(20px + var(--dx)));
  /* 執行動畫 */
  animation: oxxo 1s linear infinite;
}
/* 動畫中改變自訂屬性 */
@keyframes oxxo {
  0% {--dx: 0;}
  100% {--dx: 20px;}
}
              
            
!

JS

              
                
              
            
!
999px

Console