1

Как выровнять текст по центру (по вертикали и по горизонтали) внутри контейнера без изменения шрифта?

.box{	
  display: flex;
  align-content: center;
  align-items: center;
  height: 50px;
  width: 50px;
  background-color: #f3a500;
  text-align: center;
  font: caption;	
  font-size: 28px;
  color: white;
}
<div class="box">+</div>

1 ответ 1

2

.box{	
  display: flex;
  justify-content: center;
  align-items: center;
  height: 50px;
  width: 50px;
  background-color: #f3a500;
  text-align: center;
  font: caption;	
  font-size: 28px;
  color: white;
}
<div class="box">+</div>

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge you have read our privacy policy.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.