Wie man erstellt: Konturbuttons

Lerne, wie man den Stil der Konturbuttons mit CSS einstellt.

亲自试一试

Wie man den Stil der Konturbuttons gestaltet

Schritt 1 - HTML hinzufügen:

<button class="btn success">Erfolg</button>
<button class="btn info">Info</button>
<button class="btn warning">Warnung</button>
<button class="btn danger">Gefahr</button>
<button class="btn default">Standard</button>

Schritt 2 - CSS hinzufügen:

.btn {
  border: 2px solid schwarz;
  background-color: weiß;
  color: schwarz;
  padding: 14px 28px;
  font-size: 16px;
  cursor: pointer;
}
/* Grün */
.success {
  border-color: #04AA6D;
  color: grün;
}
.success:hover {
  background-color: #04AA6D;
  color: weiß;
}
/* Blau */
.info {
  border-color: #2196F3;
  color: dodgerblue
}
.info:hover {
  background: #2196F3;
  color: weiß;
}
/* Orange */
.warning {
  border-color: #ff9800;
  color: orange;
}
.warning:hover {
  background: #ff9800;
  color: weiß;
}
/* Rot */
.danger {
  border-color: #f44336;
  color: rot
}
.danger:hover {
  background: #f44336;
  color: weiß;
}
/* Grau */
.default {
  border-color: #e7e7e7;
  color: schwarz;
}
.default:hover {
  background: #e7e7e7;
}

亲自试一试

hinzufügen border-radius Eigenschaften, um runde Kanten Buttons zu erstellen:

.btn {
  Eckenradius: 5 px;
}

亲自试一试

相关页面

教程:CSS 按钮