Center elemement without centering all chidren recursively?

I wish to center all children within an element without centering all of their chilren.

<Col style={{ textAlign: "center" }}>
  <Space>...</Space>
  <div>...</div>
</Col>

In this example, I am using antd. The library should not matter though. I wish to add center the Space and div element but not any of Space’s or div’s elements. Using textAlign will center every element contained within its scope, which is not what I want.

27 thoughts on “Center elemement without centering all chidren recursively?”

Leave a Comment