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="layout">
  <h2>CSS1 Color 关键字</h2>
  <ul>
    <li>
      black(黑)#000000
      <div></div>
    </li>
    <li>
      silver(银)#c0c0c0
      <div></div>
    </li>
    <li>
      gray(灰)#808080
      <div></div>
    </li>
    <li>
      white(白)#ffffff
      <div></div>
    </li>
    <li>
      maroon(褐)#800000
      <div></div>
    </li>
    <li>
      red(红)#ff0000
      <div></div>
    </li>
    <li>
      purple(紫)#800080
      <div></div>
    </li>
    <li>
      fuchsia(紫红)#ff00ff
      <div></div>
    </li>
    <li>
      green(绿)#008000
      <div></div>
    </li>
    <li>
      lime(绿黄)#00ff00
      <div></div>
    </li>
    <li>
      olive(橄榄绿)#808000
      <div></div>
    </li>
    <li>
      yellow(黄)#ffff00
      <div></div>
    </li>
    <li>
      navy(藏青)#000080
      <div></div>
    </li>
    <li>
      blue(蓝)#0000ff
      <div></div>
    </li>
    <li>
      teal(青)#008080
      <div></div>
    </li>
    <li>
      aqua(水绿)#00ffff
      <div></div>
    </li>
  </ul>
  <h2>CSS2 Color 关键字</h2>
  <ul>
    <li>
      orange(橙)#ffa500
      <div></div>
    </li>
  </ul>
  <h2>CSS3 Color 关键字</h2>
  <ul>
    <li>
      aliceblue(浅灰蓝)#f0f8ff
      <div></div>
    </li>
    <li>
      antiquewhite(古董白)#faebd7
      <div></div>
    </li>
    <li>
      aquamarine(海蓝)#7fffd4
      <div></div>
    </li>
    <li>
      azure(蔚蓝)#f0ffff
      <div></div>
    </li>
    <li>
      beige(浅褐)#f5f5dc
      <div></div>
    </li>
    <li>
      bisque(橘黄)#ffe4c4
      <div></div>
    </li>
    <li>
      blanchedalmond(杏仁白)#ffe4c4
      <div></div>
    </li>
    <li>
      blueviolet(蓝紫)#8a2be2
      <div></div>
    </li>
    <li>
      brown(褐)#a52a2a
      <div></div>
    </li>
    <li>
      burlywood(原木色)#deb887
      <div></div>
    </li>
    <li>
      cadetblue(灰蓝)#5f9ea0
      <div></div>
    </li>
    <li>
      chartreuse(黄绿)#7fff00
      <div></div>
    </li>
    <li>
      chocolate(巧克力色)#d2691e
      <div></div>
    </li>
    <li>
      coral(珊瑚红)#ff7f50
      <div></div>
    </li>
    <li>
      cornflowerblue(矢车菊蓝)#6495ed
      <div></div>
    </li>
    <li>
      cornsilk(玉米穗黄)#fff8dc
      <div></div>
    </li>
    <li>
      crimson(深红)#dc143c
      <div></div>
    </li>
    <li>
      darkblue(深蓝)#00008b
      <div></div>
    </li>
    <li>
      darkcyan(深青)#008b8b
      <div></div>
    </li>
    <li>
      darkgoldenrod(暗金)#b8860b
      <div></div>
    </li>
    <li>
      darkgray(深灰)#a9a9a9
      <div></div>
    </li>
    <li>
      darkgreen(深绿)#006400
      <div></div>
    </li>
    <li>
      darkgrey(深灰)#a9a9a9
      <div></div>
    </li>
    <li>
      darkkhaki(暗黄褐)#bdb76b
      <div></div>
    </li>
    <li>
      darkmagenta(深紫)#8b008b
      <div></div>
    </li>
    <li>
      darkolivegreen(深橄榄绿)#556b2f
      <div></div>
    </li>
    <li>
      darkorange(深橙)#ff8c00
      <div></div>
    </li>
    <li>
      darkorchid(深兰花紫)#9932cc
      <div></div>
    </li>
    <li>
      darkred(深红)#8b0000
      <div></div>
    </li>
    <li>
      darksalmon(深橙红)#e9967a
      <div></div>
    </li>
    <li>
      darkseagreen(深海绿)#8fbc8f
      <div></div>
    </li>
    <li>
      darkslateblue(暗灰蓝)#483d8b
      <div></div>
    </li>
    <li>
      darkslategray(墨绿)#2f4f4f
      <div></div>
    </li>
    <li>
      darkslategrey(墨绿)#2f4f4f
      <div></div>
    </li>
    <li>
      darkturquoise(暗宝石绿)#00ced1
      <div></div>
    </li>
    <li>
      darkviolet(深紫罗兰)#9400d3
      <div></div>
    </li>
    <li>
      deeppink(深粉红)#ff1493
      <div></div>
    </li>
    <li>
      deepskyblue(深天蓝)#00bfff
      <div></div>
    </li>
    <li>
      dimgray(暗灰)#696969
      <div></div>
    </li>
    <li>
      dimgrey(暗灰)#696969
      <div></div>
    </li>
    <li>
      dodgerblue(遮板蓝)#1e90ff
      <div></div>
    </li>
    <li>
      firebrick(砖红)#b22222
      <div></div>
    </li>
    <li>
      floralwhite(花白)#fffaf0
      <div></div>
    </li>
    <li>
      forestgreen(丛林绿)#228b22
      <div></div>
    </li>
    <li>
      gainsboro(浅灰)#dcdcdc
      <div></div>
    </li>
    <li>
      ghostwhite(幽灵白)#f8f8ff
      <div></div>
    </li>
    <li>
      gold(金)#ffd700
      <div></div>
    </li>
    <li>
      goldenrod(橘黄)#daa520
      <div></div>
    </li>
    <li>
      greenyellow(黄绿)#adff2f
      <div></div>
    </li>
    <li>
      grey(灰)#808080
      <div></div>
    </li>
    <li>
      honeydew(蜜瓜色)#f0fff0
      <div></div>
    </li>
    <li>
      hotpink(亮粉)#ff69b4
      <div></div>
    </li>
    <li>
      indianred(印第安红)#cd5c5c
      <div></div>
    </li>
    <li>
      indigo(靛蓝)#4b0082
      <div></div>
    </li>
    <li>
      ivory(象牙白)#fffff0
      <div></div>
    </li>
    <li>
      khaki(卡其色)#f0e68c
      <div></div>
    </li>
    <li>
      lavender(淡紫)#e6e6fa
      <div></div>
    </li>
    <li>
      lavenderblush(淡紫红)#fff0f5
      <div></div>
    </li>
    <li>
      lawngreen(草绿)#7cfc00
      <div></div>
    </li>
    <li>
      lemonchiffon(粉黄)#fffacd
      <div></div>
    </li>
    <li>
      lightblue(淡蓝)#add8e6
      <div></div>
    </li>
    <li>
      lightcoral(浅珊瑚色)#f08080
      <div></div>
    </li>
    <li>
      lightcyan(淡青)#e0ffff
      <div></div>
    </li>
    <li>
      lightgoldenrodyellow(浅金黄)#fafad2
      <div></div>
    </li>
    <li>
      lightgray(浅灰)#d3d3d3
      <div></div>
    </li>
    <li>
      lightgreen(浅绿)#90ee90
      <div></div>
    </li>
    <li>
      lightgrey(浅灰)#d3d3d3
      <div></div>
    </li>
    <li>
      lightpink(淡粉)#ffb6c1
      <div></div>
    </li>
    <li>
      lightsalmon(浅肉色)#ffa07a
      <div></div>
    </li>
    <li>
      lightseagreen(浅海绿)#20b2aa
      <div></div>
    </li>
    <li>
      lightskyblue(浅天蓝)#87cefa
      <div></div>
    </li>
    <li>
      lightslategray(浅青灰)#778899
      <div></div>
    </li>
    <li>
      lightslategrey(浅青灰)#778899
      <div></div>
    </li>
    <li>
      lightsteelblue(浅钢蓝)#b0c4de
      <div></div>
    </li>
    <li>
      lightyellow(浅黄)#ffffe0
      <div></div>
    </li>
    <li>
      limegreen(酸橙绿)#32cd32
      <div></div>
    </li>
    <li>
      linen(亚麻色)#faf0e6
      <div></div>
    </li>
    <li>
      mediumaquamarine(中绿)#66cdaa
      <div></div>
    </li>
    <li>
      mediumblue(中蓝)#0000cd
      <div></div>
    </li>
    <li>
      mediumorchid(间兰花紫)#ba55d3
      <div></div>
    </li>
    <li>
      mediumpurple(中紫)#9370db
      <div></div>
    </li>
    <li>
      mediumseagreen(间海绿)#3cb371
      <div></div>
    </li>
    <li>
      mediumslateblue(中暗蓝)#7b68ee
      <div></div>
    </li>
    <li>
      mediumspringgreen(中春绿)#00fa9a
      <div></div>
    </li>
    <li>
      mediumturquoise(中海湖蓝)#48d1cc
      <div></div>
    </li>
    <li>
      mediumvioletred(中紫罗兰)#c71585
      <div></div>
    </li>
    <li>
      midnightblue(午夜蓝)#191970
      <div></div>
    </li>
    <li>
      mintcream(薄荷乳白)#f5fffa
      <div></div>
    </li>
    <li>
      mistyrose(粉玫瑰红)#ffe4e1
      <div></div>
    </li>
    <li>
      moccasin(鹿皮色)#ffe4b5
      <div></div>
    </li>
    <li>
      navajowhite(纳瓦白)#ffdead
      <div></div>
    </li>
    <li>
      oldlace(浅米色)#fdf5e6
      <div></div>
    </li>
    <li>
      olivedrab(橄榄褐)#6b8e23
      <div></div>
    </li>
    <li>
      orangered(橙红)#ff4500
      <div></div>
    </li>
    <li>
      orchid(兰花紫)#da70d6
      <div></div>
    </li>
    <li>
      palegoldenrod(灰菊黄)#eee8aa
      <div></div>
    </li>
    <li>
      palegreen(苍绿)#98fb98
      <div></div>
    </li>
    <li>
      paleturquoise(苍宝石绿)#afeeee
      <div></div>
    </li>
    <li>
      palevioletred(苍紫罗兰)#db7093
      <div></div>
    </li>
    <li>
      papayawhip(木瓜色)#ffefd5
      <div></div>
    </li>
    <li>
      peachpuff(桃色)#ffdab9
      <div></div>
    </li>
    <li>
      peru(秘鲁色)#cd853f
      <div></div>
    </li>
    <li>
      pink(粉)#ffc0cb
      <div></div>
    </li>
    <li>
      plum(李子色)#dda0dd
      <div></div>
    </li>
    <li>
      powderblue(粉蓝)#b0e0e6
      <div></div>
    </li>
    <li>
      rosybrown(玫瑰粽)#bc8f8f
      <div></div>
    </li>
    <li>
      royalblue(宝蓝)#4169e1
      <div></div>
    </li>
    <li>
      saddlebrown(马鞍棕)#8b4513
      <div></div>
    </li>
    <li>
      salmon(鲑肉色)#fa8072
      <div></div>
    </li>
    <li>
      sandybrown(沙褐色)#f4a460
      <div></div>
    </li>
    <li>
      seagreen(海绿)#2e8b57
      <div></div>
    </li>
    <li>
      seashell(贝壳白)#fff5ee
      <div></div>
    </li>
    <li>
      sienna(赭)#a0522d
      <div></div>
    </li>
    <li>
      skyblue(天蓝)#87ceeb
      <div></div>
    </li>
    <li>
      slateblue(青蓝)#6a5acd
      <div></div>
    </li>
    <li>
      slategray(青灰)#708090
      <div></div>
    </li>
    <li>
      slategrey(青灰)#708090
      <div></div>
    </li>
    <li>
      snow(雪白)#fffafa
      <div></div>
    </li>
    <li>
      springgreen(春绿)#00ff7f
      <div></div>
    </li>
    <li>
      steelblue(铁青)#4682b4
      <div></div>
    </li>
    <li>
      tan(棕褐)#d2b48c
      <div></div>
    </li>
    <li>
      thistle(苍紫)#d8bfd8
      <div></div>
    </li>
    <li>
      tomato(番茄红)#ff6347
      <div></div>
    </li>
    <li>
      turquoise(蓝绿)#40e0d0
      <div></div>
    </li>
    <li>
      violet(紫罗兰色)#ee82ee
      <div></div>
    </li>
    <li>
      wheat(麦色)#f5deb3
      <div></div>
    </li>
    <li>
      whitesmoke(烟白)#f5f5f5
      <div></div>
    </li>
    <li>
      yellowgreen(黄绿)#9acd32
      <div></div>
    </li>
  </ul>
  <h2>CSS4 Color 关键字</h2>
  <ul>
    <li>
      rebeccapurple(利百加紫)#663399
      <div></div>
    </li>
  </ul>
</div>

              
            
!

CSS

              
                .layout {
  
}
ul {
  display: flex;
  flex-wrap: wrap;
  padding: 0;
}
ul li {
  width: 30%;
  list-style-type: none;
  border: 1px solid #e3e3e3;
  margin: 0 1% 20px;
  color: #666;
  text-align: center;
  font-size: 14px;
  line-height: 20px;
}
li div {
  height: 50px;
}
              
            
!

JS

              
                (function(){
	var list = document.querySelectorAll('li')
	var index = 0

	while (index < list.length ) {
		let curr = list[index]
		console.log(curr)
		let color = curr.innerText.split('#')[1]
		let child = curr.querySelector('div')
		child.style.backgroundColor = `#${color}`
		index++
	}
})()
              
            
!
999px

Console