Community forum for knowledge and support

Updated 9 months ago

Aligning an element in the center

At a glance

A community member is having trouble centering an element and asks for suggestions. Other community members respond with various ideas, such as using text-align: center on the parent, setting margin-left and margin-right to auto on a max-width div, and using a combo class called align-center on the max-width-large div. The final solution is to add the align-center class to the max-width-large div and set margin-left and margin-right to auto.

Stupid question, but for the life of me I can't get this element to align in the center! Any suggestions?

M
Q
11 comments

Text align center on the parent?

Thanks for responding so quickly . So I've applied the text align center to each on of the parents (or what I would think is the partents) and still noting. Would you point out which one I would need to apply that class to?

Ah I think I see now. Try left and right margin as auto

On the max-width div

Aha! You're the best!

I'm trying my hardest to strictly use Relume's classes and not use all my own funky ones.

Thanks for your help!

haha on the max-width-*name* divs there's usually a combo class for align-center.

I noticed that when I had that div selected. Didn't realize those show up there. Thanks again for your help.

Follow up question if I may. How would you recommend cetnering this max width div?

same again really. Add a combo class to max-width-large called align-center and set left/right to auto

Perfecto. Thanks again for your help.

Add a reply
Sign up and join the conversation on Slack