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

  • Home
  • SEARCH
  • 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 3848804
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T16:45:25+00:00 2026-05-19T16:45:25+00:00

i have a div which covers the whole screen now i want to dynamically

  • 0

i have a div which covers the whole screen now i want to dynamically generate square shaped Divs within this div just like a maths notebook along with giving alternate color to each square blocks

  • 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-19T16:45:26+00:00Added an answer on May 19, 2026 at 4:45 pm

    I can’t give you too much because I don’t know what you’ve tried and what specific problems you’ve encountered, but this’d be the basic idea:

    for(var i = 0; i < 1000; i++) {
        var block = $('<div class="block" />');
        block.addClass('block-' + ((i%2)+1));
    
        $('body').append(block);
    }
    

    Have your .block div’s float left, and set to the size you want them to be, and they’ll automatically wrap to the next row. They’ll also have either the class .block-1 or .block-2, which you can use to set the alternating colors.

    Of course, if a background image, as has been suggested in comments, would meet your needs, than that would perform heaps better 🙂

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

Sidebar

Related Questions

I have a div (main div) which contains several div elements(sub divs). I want
I have a div which I have attached an onclick event to. in this
I have a div which is defined via a this. Imagine it is the
I have a div which has some text, but according to different situations this
So I have a div which will contain 3 buttons and I want these
I have a form which is built dynamically using this jQuery plugin http://code.google.com/p/jquery-dynamic-form/ When
Take a look at this fiddle - I've got three divs which all have
I have this div which acts a lens in zooming of the image. But
I have a div which position is fixed, within that i have a div
I have a simple div which I don't want to load if the visitor

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.