Display a centered divider with a horizontal line, customizable line color and margin.

by adamovic

HTML

<div class="divider">
  <span>Or</span>
</div>

CSS

.divider {
  display: flex;
  align-items: center;
  text-align: center;
  color: #666; /* Adjust for your theme */
  margin: 16px 0; /* Space above/below */
  font-size: 14px;
}

.divider::before,
.divider::after {
  content: "";
  flex: 1;
  border-bottom: 1px solid #ccc; /* Line color */
}

.divider:not(:empty)::before {
  margin-right: 0.75em;
}

.divider:not(:empty)::after {
  margin-left: 0.75em;
}