Welcome to the Treehouse Community
Looking to learn something new?
Two columns layout scheme
I want to imitate the two columns layout scheme shown in the Nick Pettit personal portfolio, but although I try I cannot make it happen...What would be the basic coding in order to make a responsive two columns image gallery with divs instead of li elements? I'm a little bit lost here, please help!
Zack LeeCourses Plus Student 17,650 Points
You can use floats. Create your divs then float them all left. Make sure theyre small enough that you can display 2 side by side.
Then use the nth-child selector to select every 2nd div starting from the 3rd div and set it to clear left. This will cause the 2 divs to float side by side while the 3rd will break to the next line 4th will sit next to 3rd then 5th will break to new line etc.
Make sure you use a clearfix to keep the divs from collapsing.
Terms to look up: Float Clear Nth-child selector Clearfix