如何創建:標簽

學習如何使用 CSS 設置標簽樣式。

成功 信息 警告 危險 其他

親自試一試

如何設置標簽樣式

第一步 - 添加 HTML:

<span class="label success">Success</span>
<span class="label info">Info</span>
<span class="label warning">Warning</span>
<span class="label danger">Danger</span>
<span class="label other">Other</span>

第二步 - 添加 CSS:

.label {
  color: white;
  padding: 8px;
}
.success {background-color: #04AA6D;} /* 綠色 */
.info {background-color: #2196F3;} /* 藍色 */
.warning {background-color: #ff9800;} /* 橙色 */
.danger {background-color: #f44336;} /* 紅色 */
.other {background-color: #e7e7e7; color: black;} /* 灰色 */

親自試一試