How TO - Labels


Learn how to style labels with CSS.


Success Info Warning Danger Other

How To Style Labels

Step 1) Add HTML:

Example

<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>

Step 2) Add CSS:

Example

.label {
  color: white;
  padding: 8px;
}

.success {background-color: #04AA6D;} /* Green */
.info {background-color: #2196F3;} /* Blue */
.warning {background-color: #ff9800;} /* Orange */
.danger {background-color: #f44336;} /* Red */
.other {background-color: #e7e7e7; color: black;} /* Gray */
Try it Yourself »

Copyright 1999-2023 by Refsnes Data. All Rights Reserved.