Selecting element within id, is it possible?

Hi,
this seems like a silly elemetary problem, but I am stuck here and I need help.
I have multiples nav elements in my html. And now I just want to make my navbar have a ul displaying as flex. Is there any way that I can select the ul or li element?
I did try:

#navbar ul{
display: flex;
}

but of course, it did not work.
Here is my code:

<body>
    <nav id="navbar">
        <!-- should include to navigate through the page -->
      <ul>
        <li><a href="#welcome-section">About</a></li>
        <li><a href="#project">Work</a></li>
        <li><a href="#contact">Contact</a></li>
      </ul>
    </nav>

Thank you so much for trying to help people like me :smiley:

It will work as you are targeting the ul through an id. Can you elaborate your issue or give a codepen link?

Hi, thangible. Maybe you should check that your CSS is being called to your document HTML. The way you did it should work perfectly.

Ooops,
stupid me.
I just tried again and it works.

It’s not necessary, CSS is smart and you will know that you want to apply the styles to the ‘ul’ that is in the ‘nav’ with the “navbar” id.

but he said that there are multiple nav elements in is doc

Oh, it’s true. I skipped that part, hahaha.

1 Like