Reputation: 21
I'm creating a simple nav bar with a <ul>
and am trying to make the <li>
items stack horizontal instead of vertical. I placed the display:inline
code in my css, but the list items still remain vertical. Any help would be appreciated!
<div id="nav">
<ul>
<li> Home </li>
<li> Farm Park </li>
<li> Cafe </li>
<li> Goods </li>
<li> Gallery </li>
<li> Contact </li>
</ul>
</div>
and my CSS is just
#li {
display: inline;
}
Upvotes: 2
Views: 997
Reputation: 1544
change
#li {
display: inline;
}
to
#nav li {
display: inline;
}
or
li {
display: inline;
}
Upvotes: 0
Reputation: 8216
the selector is li
, not #li
. the #li
selector applies for the element with id ="li"
. the li
selector applies to the <li>
elements
li {
display: inline-block;
}
<div id="nav">
<ul>
<li> Home </li>
<li> Farm Park </li>
<li> Cafe </li>
<li> Goods </li>
<li> Gallery </li>
<li> Contact </li>
</ul>
</div>
Upvotes: 6