На главную

CSS и вёрстка

Кнопки на CSS

Шесть видов кнопки, размеры, скругление, эффекты наведения и нажатия. На выходе — CSS со всеми состояниями, готовый HTML и та же кнопка классами Tailwind.

Загрузить пример

Заготовки

Настройки

Основное действие: сплошной фон, контрастный текст.

Превью

Вторая кнопка — выключенная. Нажмите Tab, чтобы увидеть кольцо фокуса.

CSS

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  border: none;
  border-radius: 10px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 160ms cubic-bezier(0.4, 0, 0.2, 1), color 160ms cubic-bezier(0.4, 0, 0.2, 1), box-shadow 160ms cubic-bezier(0.4, 0, 0.2, 1), transform 160ms cubic-bezier(0.4, 0, 0.2, 1), border-color 160ms cubic-bezier(0.4, 0, 0.2, 1);
  background: #2563eb;
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.35);
}

.btn:hover:not(:disabled) {
  background-color: #2055ca;
}

.btn:active:not(:disabled) {
  transform: translateY(1px);
}

.btn:focus-visible {
  outline: 3px solid #2563eb;
  outline-offset: 2px;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

HTML

<button class="btn" type="button">Отправить заявку</button>

Классы Tailwind

inline-flex items-center justify-center gap-2 px-5 py-3 text-[15px] rounded-[10px] font-semibold transition-colors bg-[#2563eb] text-[#ffffff] hover:bg-[#2055ca] active:translate-y-px focus-visible:outline focus-visible:outline-[3px] focus-visible:outline-offset-2 focus-visible:outline-[#2563eb] disabled:opacity-50 disabled:cursor-not-allowed