I have a parent container div with two child divs. I would like div child1 to be horizontally centered and div child2 to appear inline with child1, but off to the side of the page.
When I use the code below, the two child divs inevitably "push" against each other and child 1 gets moved out of the center. I feel like this should be easy but I'm clearly missing something.
.container {
display: flex;
align-items: center;
text-align: center;
justify-content: center;
position: relative;
}
.child1 {
display: inline-block;
align-items: center;
text-align: center;
justify-content: center;
position: absolute;
margin: 0 auto;
}
.child2 {
display: inline;
position: absolute;
right: 10px;
width: 20%;
}
<div class="container">
<div class="child1">Kid</div>
<div class="child2">Kiddo</div>
</div>