If you want everything centered in your xy panel and the width is dynamic, you can add the following to your theme.css
Add the role and put the role on the XY panel itself.
.anvil-role-centerXY > div > .anvil-component {
left: 50% !important;
transform: translate(-50%, 0);
}
If you only want some of the components in the XYPanel to be centered - you can add this role to any of the nested components
.anvil-role-center {
left: 50% !important;
transform: translate(-50%, 0);
}
On the internet your search term would be something like -
how to center align an absolute positioned element