Your question is described a bit vague, I will try to answer it anyway. Please comment if I got you wrong.
As I understood, you try to horizontally align a sibling container of an router-outlet
-tag.
Why it is not working?
The router outlet has no defined display
property. Therefore it's width and height is 0px
and you are not able to center another container according to a 0px
width element.
Solution
router-outlet {
display: block;
}
This enables you to do the follwing:
<div> <!-- some outer element -->
<router-outlet>
<div #center-me>CENTER ME</div>
</div>
router-outlet ~ #center-me {
margin: auto; /* example if center-me is a block-level element */
}
It is possible, even I wouldn't recomend you to do so.Styling according to an wrapper elemnt would possibly be the better aproach.