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
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
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.
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:
Have your
.blockdiv’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-1or.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 🙂