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 3874596
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T22:10:12+00:00 2026-05-19T22:10:12+00:00

I have a 12 box in html. i want to make three block and

  • 0

I have a 12 box in html.

i want to make three block and every block have 4 box then i can show them in the design i have.

first thing is that

in every block not first but 2nd , third or fourth block have class ‘box2’ [not apply to first of all three block].

all 3 box code goes something like

<div class="block>
<div class="box"></div>
<div class="box box2"></div>
<div class="box box2"></div>
<div class="box box2"></div>
</div>

i have the same iteration beause code render by c# and they render 12 box who not have box2 class on 2nd , third and on 4 box.

i need to do that:

wrap in block div all 4 elements because it is 12 then it’s make three block and every block have 4 element.

  • 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-19T22:10:13+00:00Added an answer on May 19, 2026 at 10:10 pm

    You can achieve this is CSS using the nth-child selectors.

    For example, use the following:

    CSS:

    .clear{
        clear:both;
        padding:0;
        margin:0;
    }
    
    .block{
            background-color:#999;
            width:500px;
            padding:10px 10px 0 10px;
        }
    
        .box{
            width:100px;
            height:100px;
            margin:0 10px 10px 0;
            background-color:#ccc;
            float:left;
            border:2px solid #000;
        }
    
        .box:nth-child(4n+1){
            border:2px solid #900;
        }
    

    HTML

    <div class="block">
        <div class="box"></div>
        <div class="box"></div>
        <div class="box"></div>
        <div class="box"></div>
        <div class="box"></div>
        <div class="box"></div>
        <div class="box"></div>
        <div class="box"></div>
        <div class="clear"></div>
    </div>
    

    enter image description here

    The nth-child selector is only applying the style to every forth box starting from the first one. So basically, you would assign the style of box2 and box (combined into one class) to all DIV’s and then using the nth-child selector, apply the style of your choice for the boxes 1, 5 , and 9.

    I hope this helps,
    Dan

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

Sidebar

Related Questions

I have a box built via html borders. I want to connect the bottom
I have the following multi-select box in a HTML form, where user can select
How can I have this other box display at the bottom of the first
Is there a way I can make an HTML multiple select box read-only? I
Html text box should have same font size for both upper and lower case
I have an HTML input box <input type=text id=foo value=bar> I've attached a handler
I have a dialog box, created with the code javascript and HTML generated below.
http://blog.helpcurenow.org/test/mockups/mar2010/lp.html In the above landing page, I have an offers box that has four
I have a html element (like select box input field) in a table. Now
I have a html form which have a select list box from which you

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.