Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 715531
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T05:11:51+00:00 2026-05-14T05:11:51+00:00

how do I create a list of li’s (they look like simple boxes by

  • 0

how do I create a list of li’s (they look like simple boxes by using css and float left) with the certain specifications:

  • 7 li’s in a row
  • the row is a closed ul-tag
  • at the end there should be 8 rows of ul’s
  • the last li (the 7th) should have the class=”last”.

this is what i got so far, to create li’s through an array (i need an array, because i need the values):

<script type="text/javascript">
    $(function () {
     $.each([39, 6, 1, 3, 5, 1, 1, 1, 1, 1, 1], function(index, value) { 
       $("#heatmap ul").append("<li class='box' value="+value+">"+index+"</li>"); 
     });
    });
</script>

I appreciate your help and your time,
Nicole

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T05:11:52+00:00Added an answer on May 14, 2026 at 5:11 am

    I’d cache your selector and use the :nth-child(7n) selector (every 7th child) afterwards, like this:

    $(function () {
      var ul = $("#heatmap ul");
      $.each([39, 6, 1, 3, 5, 1, 1, 1, 1, 1, 1], function(index, value) { 
        ul.append("<li class='box' value="+value+">"+index+"</li>"); 
      });
      ul.children(":nth-child(7n)").addClass("last");
    });
    

    This prevents it finding that <ul> for every loop in the function.

    If you float your <li> elements, and give them a width, and the <ul> 7x that width, they will float in rows of 7, like this:

    li { float: left; width: 100px; }
    ul { width: 700px }
    

    Best to show a demonstration of the floating approach: here’s a quick demo of what I mean, this uses 1 <ul> instead of n <ul> elements, much simpler 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using the following css to create list items with a chckerboard background
I'm attempting to create a linked list of length n using Python. I have
In my List, I want to ignore certain entries(create list filter), by ignore I
I would like to create list of child objects from list of parent object.
I want to create list view just like this: http://dl.maximumpc.com/galleries/androidpower/Alarm_full.jpg I need to create
I create something like a list of functors (functions pointers). Then I write them
I want to programatically create list on Sharepoint using Web Services. I tried Lists.AddList
I have a set of values and would like to create list of all
Let say I have Customers table in a database. I'd like to create List
I want to create a list of columns in SQL Server 2005 that have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.