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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T06:56:28+00:00 2026-06-13T06:56:28+00:00

(See the actual question below the line, read the upper description if you need

  • 0

(See the actual question below the line, read the upper description if you need more explanation).

In CSS, :last-child and :first-child give me good options to work with. Tables come with , strong text and more tags that i can target using CSS selectors, so with these tools it is easy to put a proper border around all the cells of the table, without having double borders appearing on any sides.

Applying this to a list of DIVs with each appearing below the other, it is a simple thing as well, as all i need to do will be to remove the bottom border on the last child.

But:


When i use a list of DIVs that float next to one another, say, for example 3 in a row (before their sum of widths exceeds the width of the target container and cause them to wrap), i always end up with some double borders on some sides.

Is there a neat and clean CSS solution to this?

  • 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-13T06:56:29+00:00Added an answer on June 13, 2026 at 6:56 am

    I think the kind of solution you’re looking for simply isn’t possible. When you’re using a table, the browser can understand that the td and th elements all belong to the same tr and come up with simple rules for determining how they look as a group.

    Divs on the other hand are highly variant (rightfully so) and don’t really have a way to create that sort of association using purely html and css. There is no way to semantic way to say something like the children of this div are going to be on the same row, so they should all share a border.

    The workaround is easy enough:

    http://jsfiddle.net/8uqae/

    Simply create a special class for a div at the end, and then give the rest of the divs a border on the right side.

    HTML:

    <div>
      <div class="left-end fl"></div>
      <div class="middle fl"></div>
      <div class="middle fl"></div>
      <div class="middle fl"></div>
      <div class="middle fl"></div>
      <div class="middle fl"></div>
      <div class="clr"></div>
    </div>​
    

    CSS:

    .fl {
      float: left;
    }
    .clr {
      clear: both;
    }
    .left-end, .middle {
        width: 30px;
        height: 20px;
        margin: 0;
        padding: 0;
        border-top: solid 1px black;
        border-right: solid 1px black;
        border-bottom: solid 1px black;
    }
    
    .left-end {
      border-left: solid 1px black;
    }
    

    As srini pointed out, there are frameworks out there which assist in this and are worth looking into. Cross-browser responsive div layout on screens of various sizes can be tricky so considering a framework like Twitter Bootstrap, among others, is worth the thought.

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

Sidebar

Related Questions

Note: I already checked msdn, it doesn't address my actual question, see below. I'm
I want to see the actual commands sent to g++ during a Code::Blocks build.
Is there an easy way to see the actual SQL generated by a rails
When I put <a href=#>Click</a> into slickgrid, I see the actual code <a href=#>Click</a>
I see that apple has implemented a max size for the actual application but
See Deepa answer for the solution :) I read all of the solution given
See the picture below. It's a flash game from a well known website :)
I have 4 Tables (listed bellow) and need: get last 10 Chats from Room
I'll first explain my overall goal and then the question itself. Overall Goal: To
Author post-edit: Chosen solution (Original question remains below this box) SUMMARY: You SHOULD NOT

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.