Simple question about html/css

html
css

#1

Hi. I’m a novice in writing html/css. I wanted to create a horizontal nav bar, but it wasn’t possible. I did the following:

From the class “navlist” the list-style-type works, but not the “display: inline”. Can anybody help to explain?

Thank you in advance.


#2

I believe the following should work:

.navlist {
    list-style-type: none;
    margin: 1.5em;
}
.navlist li {
    display: inline;
}

Simply put, display: inline affects the element it’s assigned to, not it’s children. By selecting .navlist li, all the children will be inline.


#3

@dannytech Thanks for your help, works!