How to center header while maintaining responsiveness?

I am working to try and make my mockups as responsive as possible, and I have run into the problem of trying to maintain centered position in a header. See example here:

I would like for the header to remain in the center of the header, regardless of the width of the header or what content there is to the right and left of it. As you can see in the example, since I am using “Space between”, the header will only be centered if the two side buttons are the same size (not to mention that there are even two in the first place, which I would also like to have freedom to decide).

How do I keep “Header” centered in the frame while also having one or two secondary buttons aligned to the edges (maintaining 20px padding around all three)?


Set the header element to Absolute position and center it manually, set its constrains to center horizontally and center vertically (unless you have more plans for your header)
That way regardless of the other elements, it will mantain it’s position

Hope that helps

1 Like

Thanks so much for the response - that does seem to have fixed the issue! I am wondering if there is a better practice for left and right aligning the icons once the header is centered?

As you can see here it ends up being a little messy - just want to make sure there isn’t a more elegant execution that I am missing.

For a more elegant solution, get rid of the autolayout for the icons, and set their constrains to their corresponding sides.

1 Like

Perfect, thanks so much!

1 Like