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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T00:18:19+00:00 2026-06-16T00:18:19+00:00

Okay so I have been trying to get a div system to work as

  • 0

Okay so I have been trying to get a div system to work as a grid and also margins to work with that as well. I need the last div in the grid to NOT have a margin. As you can see in my jsfiddle here: http://jsfiddle.net/kyFBr/, the last div has a margin to the right.

I can’t simply use a different class for the last div that says “Picture four” because eventually this data will be pulled out of a database and I need the formatting to when that div changes position and another one appears in its place.

For the grid squares, I can only use the class “grid1”.

The div that all the grid squares are contained in use this as the css:

div.events {
    width: 970px;
    margin-left: auto;
    margin-right: auto; 
    text-align: left;   
}

And the grid’s css is:

div.grid1 {
width: 219.5px;
    margin-right: 3px;
    float: left;
    padding:10px;
    background-image: url('debut_dark.png'); /*Image From SubtlePatterns.com*/
    margin-bottom: 3px;
}

Anyone have a solution? Thanks.

  • 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-06-16T00:18:20+00:00Added an answer on June 16, 2026 at 12:18 am

    The problem you are experiencing is a result of CSS’s inability to count until the more recent CSS level 3 properties. The one you need is :nth-child and specifically :nth-child(4n) (the n represents every 4th and not just the 4th)

    div.grid1:nth-child(4n) {
        margin-right:0px;
    }
    

    Demo: http://jsfiddle.net/tvx7m/2/show
    Source: http://jsfiddle.net/tvx7m/2

    This solution, of course, only works on modern browsers that support CSS level 3.

    Real credit goes to @Frederik (make an answer and I’ll delete mine)

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

Sidebar

Related Questions

Okay I have been trying to get this to work for some time now.
Okay, guys i have been trying to define a Stack , each node also
Okay I been trying to work this out but unable too. I have a
Okay so I have been trying to get into IoC lately. However, I keep
okay i have been trying to understand this for hours i am learning VB
I've been trying to get this complex MYSQL query to work exactly right over
I have been trying to authenticate my CGI application through 2 drivers, one that
Okay so I have been trying to style my users Gravatar image. The problem
Okay I have been racking my brain trying to build a JSON array from
I have been trying to get a list to display for quite a while

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.