I have these two components and i cannot align them horizontally.
<div style="float: left;">
<div>
<app-sidebar></app-sidebar>
</div>
<div style="margin-left: 8.4rem;">
<app-title></app-title>
</div>
</div>
I tried to align them with:
display:flex;
float:left;
However, every time I try the sidebar covers title.
2
Answers
`
`
you can use
display: flex
andjustify-content: center
.If you want to left or right, also you can use
justify-content: start;
orjustify-content: end;
Hope it will help you.
Don’t use float, you used flexbox, and flex: 1 to make both children div equally take up the space
Also check this out https://flexboxfroggy.com/ it helps me a lot to understand flex when I was starting to learn it