Как изменить положение текста h3

#css

#css

Вопрос:

У меня есть этот HTML и CSS:

 @media(max-width: 1920) and (min-width: 769) {
  cfa-text {
    margin-left: 20px! Important;
  }
}

@media (max-width: 1920) and (min-width: 769) {
  .cfa- text {
    margin-left: 20px! Important;
  }
}

@media (max-width: 1920) and (min-width: 769) {
  body.cfa-text {
    margin-left: 20px! Important;
  }
}

@media (max-width: 1920) and (min-width: 769) {
  .col-v. sm-9 {
    margin-left: 20px! Important;
  }
}

@media (max-width: 1920) and (min-width: 769) {
  .h3 {
    margin-left: 200px! Important;
  }
}  
 <div class="col-sm-9">
  <h3 class="cfa-text"> "Professional, thorough, diligent<br /><br /> Excellent, my flat looked brand new after they had finished. Still can't get over those sparkling taps. Thanks to Nico and the team for a job well done."
  </h3>
</div>  

Я бы хотел, чтобы текст был в центре страницы. На данный момент находится немного левее в режиме просмотра на рабочем столе.

Комментарии:

1. можете ли вы объяснить, чего именно вы хотите?

2. В данный момент текст находится слева от центра в режиме просмотра на рабочем столе, и я хочу, чтобы он был в центре страницы.

Ответ №1:

добавьте text-sm-left text-md-center классы начальной загрузки в h3 . надеюсь, это то, что вы ищете. Спасибо

 (max-width: 1920) and (min-width: 769) {
  cfa-text {
    margin-left: 20px! Important;
  }
}

(max-width: 1920) and (min-width: 769) {
  .cfa-text {
    margin-left: 20px! Important;
  }
}

(max-width: 1920) and (min-width: 769) {
  body.cfa-text {
    margin-left: 20px! Important;
  }
}

(max-width: 1920) and (min-width: 769) {
  .col-sm-9 {
    margin-left: 20px! Important;
  }
}

(max-width: 1920) and (min-width: 769) {
  .h3 {
    margin-left: 200px! Important;
  }
}  
 <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
<div class="col-sm-9">
  <h3 class="cfa-text text-sm-left text-md-center"> "Professional, thorough, diligent<br /><br /> Excellent, my flat looked brand new after they had finished. Still can't get over those sparkling taps. Thanks to Nico and the team for a job well done."
  </h3>
</div>  

Комментарии:

1. Спасибо. Я проверю это. Однако чистого css-исправления нет?

2. но вы использовали классы начальной загрузки, поэтому я использовал классы начальной загрузки.. вы не хотите использовать bootstrap?

3. Я этого не писал. Это wordpress

4. Не возражайте. Если css лучше, но я уверен, что ваше решение работает.