skip to Main Content

I have applied flex to this nav, still not able to align the items in a row, tried changing the flex-direction to row as well. Still the elements in the nav bar come up in a column format, this is not what I want, Can someone please help how to get it resolved?

[enter image description here](https://phpout.com/wp-content/uploads/2023/04/zyewu-jpg.webp)

Getting this outputoutput

2

Answers


  1. instead of:

    nav {
        display: flex;
    }
    

    try:

    nav ul {
        display: flex;
    }
    
    Login or Signup to reply.
  2. The "flex" property should be put on the parent element of all the child elements to activate. In your code, it seems you put flex on nav which has only one element, "ul" so it doesn’t show out put that you wanted.

    For displaying the list item in flex you should put flex on the "ul"

    so your code will be –

    ul{
        display: flex;
    }
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search