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! While you're at it, check out some resources Treehouse students have shared here.
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 trialabcd efgh
824 PointsHow do I get horizontal lists using list tag?
<li> generates vertical lists, but how can one get horizontal lists?
abcd efgh
824 PointsThanks mate
1 Answer
Gonzalo Blasco
11,927 PointsYou 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)... :)
Jo-wayne Josephs
19,748 PointsJo-wayne Josephs
19,748 PointsAll 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