How to center this div?
I am using tailwind css.
The "Sign in" text has "text-center" property I want the above component in centre too. How to do that?
![](https://cdn.answeroverflow.com/1123561652856557660/Screenshot_from_2023-06-28_15-55-52.png)
5 Replies
Just below blogs.
Share some code, without it's going to be very hard to help. Preferably codepen or tailwinds playground
as @jochemm says, without code it is almost impossible to give you a concise solution as it rather depends on how you have styled your top component.
For example, if you have used grid you could use
grid-cols-[1fr_2fr_1fr]
(which would translate to grid-template-columns: 1fr 2fr 1fr;
) to make the "logo" and "sign in" button take up an equal amount of space either side and then just ensure that your nav is centered in the middle column.Flex, flex is always the answer 🙏
Learn grid, Azyrum 😛 There's so many things that are much easier with grid than with flex