Почему не выравнивается текст:center; переместить мой класс = "текст 5" в центр?CSS

Разбираемся в CSS
Ответить Пред. темаСлед. тема
Anonymous
 Почему не выравнивается текст:center; переместить мой класс = "текст 5" в центр?

Сообщение Anonymous »

Код: Выделить всё





Homepage
[*]



Header Logo

[list]
[url=index.html]header link one[/url]
[*][url=index.html]header link two[/url]
[*][url=index.html]header link three[/url]
[/list]

This website is awesome
This website has some subtext that goes here under the main title.It's a smaller font and the color is lower contrast

Sign up



this is  a placeholder for an image




Some random information.



Copyright © The Odin Project 2023




* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
.container {
width: 100%;
height: 45vh;
background-color: #1f2937;
position: static;
display: flex;
}

.footer {
position: absolute;
bottom: 0px;
width: 100%;
height: 10vh;
background-color: #1f2937;
color: white;
text-align: center;
display: flex;
justify-content: center;
align-items: center;
}

.logo {
font-size: 24px;
font-family: 'Times New Roman', Times, serif;
color: white;
justify-content: space-between;
padding-top: 15px;
font-family: 'Gill Sans', 'Gill Sans MT', Calibri, 'Trebuchet MS', sans-serif;
padding-left: 200px;
position: absolute;
top: 0;
}

.navbar {
color:white;
font-size: 18px;
position: fixed;
width: 85%;
top: 0;
right: 0;
margin: auto;
display: flex;
align-items: center;
justify-content: flex-end;
flex-direction: row;
padding-top: 15px;
padding-right: 330px;
}

.navbar ul li {
list-style: none;
display: inline-block;
margin: 0 20px;
text-decoration: none;
}

.text1 {
position: relative;
color: white;
padding-left: 200px;
font-size: 48px;
font-weight: bold;
width: 720px;
top: 100px;
}

.text2 {
position: relative;
color: white;
font-size: 18px;
width: 400px;
height: 200px;
top: 300px;
right: 520px;
}

.placeholder{
position: relative;
width: 500px;
height:250px;
background-color: grey;
border: 2px solid grey;
display:flex;
top: 100px;
right: 120px;
align-items: center;
justify-content: center;
color: white;
}

.button1{
border-radius: 5px;
position: relative;
display: flex;
font-weight: bold;
border: 2px solid #3882F6;
background-color:#3882F6;
height:40px;
width: 120px;
justify-content: center;
align-items: center;
}

.container2{
height: 45vh;
background-color: white;
position: relative;
padding-top: 30px;
display: flex;
flex-direction: row;
justify-content: space-evenly;
}

#text5{
font-size: 36px;
font-weight:800;
text-align: center;
}

#box1, #box2, #box3, #box4{
position: relative;
border: 2px solid #3882F6;
height: 100px;
width: 100px;
bottom: -100px;
right: 250px;
border-radius: 25px;
flex: 0 0 100px;
}

Почему class="text5" не перемещает текст к центру? На данный момент текст находится слева.
Я пробовал text- align=center, но это ни к чему не привело. Это связано с каскадированием? Я также попытался указать ширину и поля: 0 auto; это переместило текст, но не в центр, и испортило расстояние между ящиками.

Подробнее здесь: https://stackoverflow.com/questions/781 ... the-center
Реклама
Ответить Пред. темаСлед. тема

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

  • Похожие темы
    Ответы
    Просмотры
    Последнее сообщение
  • Разница между «VerticalArrangement = Arrangement.Center» и «textAlign = TextAlign.Center» в студии Android
    Anonymous » » в форуме Android
    0 Ответы
    15 Просмотры
    Последнее сообщение Anonymous
  • Центр выравнивается с настольной клетками
    Anonymous » » в форуме Html
    0 Ответы
    16 Просмотры
    Последнее сообщение Anonymous
  • Центр выравнивается с настольной клетками
    Anonymous » » в форуме Html
    0 Ответы
    10 Просмотры
    Последнее сообщение Anonymous
  • Центр выравнивается с настольной клетками
    Anonymous » » в форуме CSS
    0 Ответы
    31 Просмотры
    Последнее сообщение Anonymous
  • Центр выравнивается с настольной клетками
    Anonymous » » в форуме Html
    0 Ответы
    9 Просмотры
    Последнее сообщение Anonymous

Вернуться в «CSS»