Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

HTML Introduction to HTML and CSS HTML: The Structural Foundation of Web Pages and Applications HTML Lists

How do I get horizontal lists using list tag?

<li> generates vertical lists, but how can one get horizontal lists?

All lists will be vertical in HTML as you have to add CSS in order to get the horizontal lists, like the type we see in navs and footers. For example: <li>apple</li> <li>pear</li> <li>banana</li> The Html above will give you the typical vertical list. -apple -pear -banana The CSS below will translate it into a horizontal list. For this example I used the inline-flex method: li { display:inline-flex; } apple pear banana As you progress through the various courses on Treehouse you will find there are other ways to do this. A quick google search will also give you more info. Hope this helps. -Jo

Thanks mate

1 Answer

Gonzalo Blasco
Gonzalo Blasco
11,927 Points

You can use a display: inline-flex as @Jo-wayne said, or you can use a display: inline-block (I don't really like using flexbox)... :)