Skip to content

Align items on the same line in mobile view #3261

Answered by simonswiss
arjunrao87 asked this question in Help
Discussion options

You must be logged in to vote

Hey!

The problem is that on mobile view, you have both the logo and the button as flex containers, instead of sitting within the same flex parent.

I copied your CodePen code over to a Tailwind Play example, and here's what I modified in the mobile view:

  1. removed flex justify-start and flex justify-end utilities on the logo / button elements
  2. wrap both the logo and button elements in a div with flex justify-between classes instead
  3. add flex-1 to the logo element to make it take all the available space outside of the button, so both elements are left and right aligned.

Here's the code where you can see your layout working properly:

https://play.tailwindcss.com/jR7mLtn93t

Hope it helps 👍

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@arjunrao87
Comment options

Answer selected by arjunrao87
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants