cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - Activehtmlicon-personicon-teamoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

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.

  Native CSS Variables Introduce DEMO I<br />
  <a href="http://muki.tw/tech/native-css-variables" target="_blank">(http://muki.tw/tech/native-css-variables)</a>

  <p>我的背景顏色是藍色,繼承的是 root 元素的設定</p>
  <h3>我的背景顏色是紅色,繼承的是 h1 的設定</h3>
  <div id="main">我的背景顏色是綠色,繼承的是 #main 的設定</div>
              @import "compass/css3";

Native CSS Variables Introduce DEMO I
Autohr: Muki Wu
Article: http://muki.tw/tech/native-css-variables

/* basic layout start (you can skip it) */
body {
  background: #333;
  font-size: 16px;
  color: #f0f0f0;
  line-height: 1.1em;
a {
  text-decoration: none;
  color: #313131;
  &:hover {
    color: #000;
section {
  width: 500px;
  margin: 0 auto;
  background: #555;
  padding: 1em;
  div {
    margin: 0 0 2em 0;
header {
  background: #d9444a;
  text-align: center;
  color: #fff;
  padding: .7em 0;
  a {
    color: rgba(255,255,255,.6);
    @include text-shadow(1px 1px 1px #973735);
  &:after {
    content: " ";
    position: absolute;
    width: 0;
    height: 0;
    border-width: 10px;
    border-style: solid;
    border-color: #d9444a transparent transparent transparent;
    top: 53px;
    left: 50%;

h2 {
  font-size: 1em;
  margin: 0 0 .5em 0;
  background: #444;
  display: inline-block;
  padding: .5em 1.2em;
  position: relative;
  left: -1em;

/* demo code start */

/* 變數命名 */
:root { --bg-color: #369;}
h3    { --bg-color: #d9444a;}
#main { --bg-color: #94a437;}

/* 呼叫變數 */
* {
  background: var(--bg-color);

              /* JS */
var styles = getComputedStyle(document.documentElement);
var value = String(styles.getPropertyValue('--primary-color')).trim();

document.documentElement.style.setProperty('--primary-color', 'var(--secondary-color)');ㄍ

Asset uploading is a PRO feature.

As a PRO member, you can drag-and-drop upload files here to use as resources. Images, Libraries, JSON data... anything you want. You can even edit them anytime, like any other code on CodePen.


Loading ..................