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 trialHanxiao Jiang
8,526 PointsWhat if an item needed to be set at nth position
Placing item 6 to the 2nd position is doable by setting item 1 and item 6. But what if we have many items and I need place a certain item to nth position. Say, 1000 items, and the Item 500 need to be placed to the 455th position. We do need a more efficient code to achieve that rather than setting up every item.
1 Answer
Jeremy Castanza
12,081 PointsAs @David Bath mentioned, you'd like define a separate index in the database table or utilize a query to display your data on a web page. Typically, you wouldn't load that many items to a web page anyways due to performance and would utilize a database query.
David Bath
25,940 PointsDavid Bath
25,940 PointsWith something that depends on that kind of specificity, I think that would be something handled on the data end and not something you'd expect to arrange in CSS, which would be a horribly imprecise way to arrange 1000 items on a page.