Join the Webstudio community

Updated 6 months ago

How to Center a Div lol

At a glance

The community members are discussing the easiest way to center a box in Webstudio, compared to the centering functionality in Webflow. They note that in Webflow, there is a grid system that allows you to easily align elements left, right, or center, and it automatically sets the margin to auto. The community members suggest that in Webstudio, you can also set the margin to auto to center a box, but you may need to have a parent element that is a grid or flex container. Some community members find the Webflow centering functionality more intuitive, while others suggest that adding "auto" to the units dropdown in Webstudio could help make the centering process more user-friendly.

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