Я новичок в CSS. Я пробовал использовать блок отображения, но это не сработало. Это не только для центра, здесь также отображается много контейнеров. Я пробовал использовать margin-bottom и right, но это тоже не сработало и стало похоже на крест, почти на параллель.
Я пытаюсь выровнять четвертый и пять div. Черно-красный. Буду признателен, если вы попытаетесь увидеть мой код, заранее спасибо.
div#first {
background-color: #FF0000;
height: 180px;
width: 180px;
float: left;
position: relative;
}
div#third {
background-color: blue;
height: 180px;
width: 190px;
float: left;
margin-left: 190px;
position: relative;
}
div#fourth {
display: block;
background-color: black;
height: 100px;
width: 100px;
margin-left: 5px;
float: left;
}
div#five {
background-color: red;
height: 100px;
width: 100px;
float: left;
}
div#six {
background-color: navy;
height: 100px;
width: 100px;
float: left;
margin-left: 400px;
}
div#hello1 {
background-color: navy;
width: 80px;
height: 100px;
position: absolute;
bottom: 90px;
}
div#hello2 {
background-color: orange;
width: 200px;
height: 100px;
bottom: 90px;
margin-left: 85px;
position: absolute;
}
div#hello3 {
background-color: red;
width: 130px;
height: 100px;
position: absolute;
bottom: 90px;
margin-left: 290px;
}
div#hello4 {
background-color: navy;
width: 150px;
height: 100px;
position: absolute;
bottom: 90px;
margin-left: 425px;
}<div class = "content" id = "first"> </div>
<div class = "content" id = "third"> </div>
<div class = "content" id = "fourth"> </div>
<div class = "content" id = "five"> </div>
<div class = "content" id = "six"> </div>
<div class = "content" id = "hello1"> </div>
<div class = "content" id = "hello2"> </div>
<div class = "content" id = "hello3"> </div>
<div class = "content" id = "hello4"> </div>





Вы можете поместить div вокруг четвертого и пятого div и установить отображение flexbox. Затем используйте justify-content и align-items, чтобы разместить свой div там, где вы хотите.
Не думаю, что я полностью понимаю, что вы имеете в виду, но посмотрите на этот фрагмент и скажите мне, если это то, что вы ищете (откройте
div#first{
background-color: #FF0000;
height: 180px;
width: 180px;
float: left;
}
div#third{
background-color: blue;
height: 180px;
width: 190px;
float: left;
}
div#fourth{
background-color: black;
height: 100px;
width: 100px;
float: left;
}
div#five{
background-color: red;
height: 100px;
width: 100px;
float: left;
}
div#six{
background-color: navy;
height: 100px;
width: 100px;
float: left;
}
div#hello1{
background-color: navy;
width: 80px;
height: 100px;
position: absolute;
bottom:90px;
}
div#hello2{
background-color: orange;
width: 200px;
height: 100px;
bottom:90px;
margin-left: 85px;
position: absolute;
}
div#hello3{
background-color: red;
width: 130px;
height: 100px;
position: absolute;
bottom:90px;
margin-left: 290px;
}
div#hello4{
background-color: navy;
width: 150px;
height: 100px;
position: absolute;
bottom:90px;
margin-left: 425px;
}
#aligned {
display : flex;
flex-direction: column;
}<body>
<div class = "content" id = "first"> </div>
<div class = "content" id = "third"> </div>
<div id = "aligned">
<div class = "content" id = "fourth"> </div>
<div class = "content" id = "five"> </div>
</div>
<div class = "content" id = "six"> </div>
</body>
Проверьте это.