Answer the question
In order to leave comments, you need to log in
Flex: how to align a block to the center of the parent, regardless of neighbors?
I read about flex, found out that float does not work in it.
How, then, to make the alignment of the first element in the center, and the rest "throw" to the right?
<div class="parent">
<div class="one">One</div>
<div class="two">Two</div>
<div class="three">Three</div>
</div>
.parent {
display: flex;
border: 1px solid black;
justify-content: center;
}
.one, .two, .three {
display: flex;
margin: 0 3em;
}
Answer the question
In order to leave comments, you need to log in
Set the central block:
position: absolute;
right: 50%;
transform: translateX(50%);
And the rest aligned to the right.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question