Join the Webstudio community

Updated 3 months ago

How to Center a Div lol

At a glance
What's the easiest way to center a box? In webflow it has that grid that you select to alight left, right and center and it sets the margin to auto for you or something. What's the equivalent in webstudio?
B
L
O
16 comments
do this only parent
Attachment
image.png
Thanks. Would be nice if I didn't have to create a parent though. I don't think webflow required it
You can set margin to auto here too. It is not unique to webflow
Though you still need a parent to be grid or flex
Otherwise it will center only horizontally
In webflow as well
Hmm ok. That makes sense. It just seems like it was easier in webflow. Let me check webflow to see if I am remembering correctly
Here's what I'm talking about. It's probably working the same under the hood, but you don't have to add a parent or anything. Just click the center button and it does it's thing.
Really I should put this in #︳suggestions at this point lol
So you need to center only horizontally? Just set margin left and right to auto. Shortcut is nice but it really just sets 2 values.
I guess the center shortcut isn't exactly necessary, but typing in "auto" isn't very intuitive.
Perhaps "auto" should be added to the units dropdown? That might be confusing too though...
thats just margin left and right auto
it should actually be like with the width
Attachment
image.png
@TrySound seems like a bug that we don't have auto and othersin the autocomplete in spacing
Add a reply
Sign up and join the conversation on Discord