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 trial

CSS How to Make a Website Styling Web Pages and Navigation Build Navigation with Unordered Lists

sagnikchakraborti
sagnikchakraborti
929 Points

Why doesn't display:inline-block work for image gallery li instead of float:left?

When we built the image gallery we put float:left for #gallery li and display:inline-block for nav li. Why won't display:inline-block work for the gallery li? Need some expanation. Since both the things are list items, it should work.

Sara Hardy
Sara Hardy
8,650 Points

I haven't watched the course so I can't speak specifically to your case, but display: inline-block should work in general to display your list items as a grid. Have you tried it? What happens? Can you show your code?

gregory gordon
seal-mask
.a{fill-rule:evenodd;}techdegree
gregory gordon
Full Stack JavaScript Techdegree Student 14,652 Points

They are both li but in different areas(class,id,nav so on....) and with different styles im sure inline-block and float will make the appearance different.

1 Answer

Jason DeValadares
Jason DeValadares
7,190 Points

I think the reason he's done this is because as a block it would put all the images into a blocked area (all lined up without breaks). Because he wants everything to flow and move around depending on the size of the screen, he's left it with defaults and just told it to float what it can beside each other.