Kevin Powell - CommunityKP-C
Kevin Powell - Communityβ€’2y agoβ€’
10 replies
Ruta

Center flex child on the page, while ignoring other children

The fiddle below explains it best, but basically I have a two-child flexbox and would like to center the entire container horizontally based on the second child ONLY. Position of the first child should be directly to the left.

Is this possible? Should I use something other than flexbox? I can get close with absolute positioning but the first child moves too far/close to the second.

Fiddle - https://jsfiddle.net/cms07dL3/1/
Test your JavaScript, CSS, HTML or CoffeeScript online with JSFiddle code editor.
Was this page helpful?