Horizontal Menu - CSS

Asked

Viewed 163 times

-1

I’m trying to learn how to work with horizontal CSS menus. I am starting and therefore I am with a silly doubt and I did not find anything on the internet similar to my question (Maybe I do not know the correct terms for the problem).

My problem is that all my sub-menus are lining up under the first element of the main menu. I put here in the JSFIDDLE the HTML and CSS I made.

I hope someone can help me.

1 answer

0


I did not understand correctly why (I also did not look), but need to float the menus "parents":

.menu > ul > li {
    float:left;        /* <- Adicione essa propriedade */
    list-style: none;
    text-align: center;
    margin: 0;
    padding: 0;
}

Jsfiddler

  • I don’t understand why either. It didn’t make much sense to me, but I’m glad you helped me solve it. Maybe someone here from the OS can understand the

Browser other questions tagged

You are not signed in. Login or sign up in order to post.