How to remove border from elements in the last row?Targeting flex items on the last rowHow to vertically wrap content with flexbox?Remove border from IFrameHow do you keep parents of floated elements from collapsing?CSS3's border-radius property and border-collapse:collapse don't mix. How can I use border-radius to create a collapsed table with rounded corners?Div width 100% minus fixed amount of pixelsHow can I select an element with multiple classes in jQuery?How to move an element into another element?How do I combine a background-image and CSS3 gradient on the same element?How to remove border (outline) around text/input boxes? (Chrome)How do I remove the space between inline-block elements?Flex-box: Align last row to grid

How can I deal with my CEO asking me to hire someone with a higher salary than me, a co-founder?

What's the meaning of "Sollensaussagen"?

What is required to make GPS signals available indoors?

What exactly is ineptocracy?

What do you call someone who asks many questions?

Why are UK visa biometrics appointments suspended at USCIS Application Support Centers?

How to install cross-compiler on Ubuntu 18.04?

Mathematica command that allows it to read my intentions

What reasons are there for a Capitalist to oppose a 100% inheritance tax?

Why was Sir Cadogan fired?

Am I breaking OOP practice with this architecture?

Notepad++ delete until colon for every line with replace all

How can a day be of 24 hours?

Standard deduction V. mortgage interest deduction - is it basically only for the rich?

Did 'Cinema Songs' exist during Hiranyakshipu's time?

Convert seconds to minutes

How does a dynamic QR code work?

Could the museum Saturn V's be refitted for one more flight?

What Exploit Are These User Agents Trying to Use?

What is the most common color to indicate the input-field is disabled?

Implication of namely

Machine learning testing data

how do we prove that a sum of two periods is still a period?

Do Iron Man suits sport waste management systems?



How to remove border from elements in the last row?


Targeting flex items on the last rowHow to vertically wrap content with flexbox?Remove border from IFrameHow do you keep parents of floated elements from collapsing?CSS3's border-radius property and border-collapse:collapse don't mix. How can I use border-radius to create a collapsed table with rounded corners?Div width 100% minus fixed amount of pixelsHow can I select an element with multiple classes in jQuery?How to move an element into another element?How do I combine a background-image and CSS3 gradient on the same element?How to remove border (outline) around text/input boxes? (Chrome)How do I remove the space between inline-block elements?Flex-box: Align last row to grid













7















My layout is something like this (I'm typing a simplified version with inline styles instead of classes)






.qa 
border-bottom: 1px solid #ccc;

<div style="display: flex; flex-wrap: wrap; flex-direction: row">
<div class="qa" style="width:50%;">
<div>Question</div>
<div>Answer</div>
</div>
<div class="qa" style="width:50%;">
<div>Question</div>
<div>Answer</div>
</div>
<div class="qa" style="width:50%;">
<div>Question</div>
<div>Answer</div>
</div>
<div class="qa" style="width:50%;">
<div>Question</div>
<div>Answer</div>
</div>
<div class="qa" style="width:50%;">
<div>Question</div>
<div>Answer</div>
</div>
<div class="qa" style="width:50%;">
<div>Question</div>
<div>Answer</div>
</div>
<div class="qa" style="width:50%;">
<div>Question</div>
<div>Answer</div>
</div>
<div class="qa" style="width:50%;">
<div>Question</div>
<div>Answer</div>
</div>
<div class="qa" style="width:50%;">
<div>Question</div>
<div>Answer</div>
</div>
<div class="qa" style="width:50%;">
<div>Question</div>
<div>Answer</div>
</div>
</div>





This basically renders something like this:



enter image description here



My questions is:



How do I get rid of the border in the last row?










share|improve this question
























  • I think nth-last-child would be able to help you css-tricks.com/almanac/selectors/n/nth-last-child

    – Funk Doc
    5 hours ago











  • Yes I was thinking along the same lines but that only targets the bottom right div. I need it to target both last row divs

    – supersan
    5 hours ago






  • 4





    Just add: .qa:nth-last-child(-n+2) border: 0;

    – bea
    4 hours ago






  • 2





    @bea: your's is the right answer! Put it as an answer and you'll get upvoted

    – enxaneta
    4 hours ago















7















My layout is something like this (I'm typing a simplified version with inline styles instead of classes)






.qa 
border-bottom: 1px solid #ccc;

<div style="display: flex; flex-wrap: wrap; flex-direction: row">
<div class="qa" style="width:50%;">
<div>Question</div>
<div>Answer</div>
</div>
<div class="qa" style="width:50%;">
<div>Question</div>
<div>Answer</div>
</div>
<div class="qa" style="width:50%;">
<div>Question</div>
<div>Answer</div>
</div>
<div class="qa" style="width:50%;">
<div>Question</div>
<div>Answer</div>
</div>
<div class="qa" style="width:50%;">
<div>Question</div>
<div>Answer</div>
</div>
<div class="qa" style="width:50%;">
<div>Question</div>
<div>Answer</div>
</div>
<div class="qa" style="width:50%;">
<div>Question</div>
<div>Answer</div>
</div>
<div class="qa" style="width:50%;">
<div>Question</div>
<div>Answer</div>
</div>
<div class="qa" style="width:50%;">
<div>Question</div>
<div>Answer</div>
</div>
<div class="qa" style="width:50%;">
<div>Question</div>
<div>Answer</div>
</div>
</div>





This basically renders something like this:



enter image description here



My questions is:



How do I get rid of the border in the last row?










share|improve this question
























  • I think nth-last-child would be able to help you css-tricks.com/almanac/selectors/n/nth-last-child

    – Funk Doc
    5 hours ago











  • Yes I was thinking along the same lines but that only targets the bottom right div. I need it to target both last row divs

    – supersan
    5 hours ago






  • 4





    Just add: .qa:nth-last-child(-n+2) border: 0;

    – bea
    4 hours ago






  • 2





    @bea: your's is the right answer! Put it as an answer and you'll get upvoted

    – enxaneta
    4 hours ago













7












7








7








My layout is something like this (I'm typing a simplified version with inline styles instead of classes)






.qa 
border-bottom: 1px solid #ccc;

<div style="display: flex; flex-wrap: wrap; flex-direction: row">
<div class="qa" style="width:50%;">
<div>Question</div>
<div>Answer</div>
</div>
<div class="qa" style="width:50%;">
<div>Question</div>
<div>Answer</div>
</div>
<div class="qa" style="width:50%;">
<div>Question</div>
<div>Answer</div>
</div>
<div class="qa" style="width:50%;">
<div>Question</div>
<div>Answer</div>
</div>
<div class="qa" style="width:50%;">
<div>Question</div>
<div>Answer</div>
</div>
<div class="qa" style="width:50%;">
<div>Question</div>
<div>Answer</div>
</div>
<div class="qa" style="width:50%;">
<div>Question</div>
<div>Answer</div>
</div>
<div class="qa" style="width:50%;">
<div>Question</div>
<div>Answer</div>
</div>
<div class="qa" style="width:50%;">
<div>Question</div>
<div>Answer</div>
</div>
<div class="qa" style="width:50%;">
<div>Question</div>
<div>Answer</div>
</div>
</div>





This basically renders something like this:



enter image description here



My questions is:



How do I get rid of the border in the last row?










share|improve this question
















My layout is something like this (I'm typing a simplified version with inline styles instead of classes)






.qa 
border-bottom: 1px solid #ccc;

<div style="display: flex; flex-wrap: wrap; flex-direction: row">
<div class="qa" style="width:50%;">
<div>Question</div>
<div>Answer</div>
</div>
<div class="qa" style="width:50%;">
<div>Question</div>
<div>Answer</div>
</div>
<div class="qa" style="width:50%;">
<div>Question</div>
<div>Answer</div>
</div>
<div class="qa" style="width:50%;">
<div>Question</div>
<div>Answer</div>
</div>
<div class="qa" style="width:50%;">
<div>Question</div>
<div>Answer</div>
</div>
<div class="qa" style="width:50%;">
<div>Question</div>
<div>Answer</div>
</div>
<div class="qa" style="width:50%;">
<div>Question</div>
<div>Answer</div>
</div>
<div class="qa" style="width:50%;">
<div>Question</div>
<div>Answer</div>
</div>
<div class="qa" style="width:50%;">
<div>Question</div>
<div>Answer</div>
</div>
<div class="qa" style="width:50%;">
<div>Question</div>
<div>Answer</div>
</div>
</div>





This basically renders something like this:



enter image description here



My questions is:



How do I get rid of the border in the last row?






.qa 
border-bottom: 1px solid #ccc;

<div style="display: flex; flex-wrap: wrap; flex-direction: row">
<div class="qa" style="width:50%;">
<div>Question</div>
<div>Answer</div>
</div>
<div class="qa" style="width:50%;">
<div>Question</div>
<div>Answer</div>
</div>
<div class="qa" style="width:50%;">
<div>Question</div>
<div>Answer</div>
</div>
<div class="qa" style="width:50%;">
<div>Question</div>
<div>Answer</div>
</div>
<div class="qa" style="width:50%;">
<div>Question</div>
<div>Answer</div>
</div>
<div class="qa" style="width:50%;">
<div>Question</div>
<div>Answer</div>
</div>
<div class="qa" style="width:50%;">
<div>Question</div>
<div>Answer</div>
</div>
<div class="qa" style="width:50%;">
<div>Question</div>
<div>Answer</div>
</div>
<div class="qa" style="width:50%;">
<div>Question</div>
<div>Answer</div>
</div>
<div class="qa" style="width:50%;">
<div>Question</div>
<div>Answer</div>
</div>
</div>





.qa 
border-bottom: 1px solid #ccc;

<div style="display: flex; flex-wrap: wrap; flex-direction: row">
<div class="qa" style="width:50%;">
<div>Question</div>
<div>Answer</div>
</div>
<div class="qa" style="width:50%;">
<div>Question</div>
<div>Answer</div>
</div>
<div class="qa" style="width:50%;">
<div>Question</div>
<div>Answer</div>
</div>
<div class="qa" style="width:50%;">
<div>Question</div>
<div>Answer</div>
</div>
<div class="qa" style="width:50%;">
<div>Question</div>
<div>Answer</div>
</div>
<div class="qa" style="width:50%;">
<div>Question</div>
<div>Answer</div>
</div>
<div class="qa" style="width:50%;">
<div>Question</div>
<div>Answer</div>
</div>
<div class="qa" style="width:50%;">
<div>Question</div>
<div>Answer</div>
</div>
<div class="qa" style="width:50%;">
<div>Question</div>
<div>Answer</div>
</div>
<div class="qa" style="width:50%;">
<div>Question</div>
<div>Answer</div>
</div>
</div>






html css css3 flexbox css-selectors






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 1 hour ago









Michael_B

157k50255363




157k50255363










asked 5 hours ago









supersansupersan

1,7871837




1,7871837












  • I think nth-last-child would be able to help you css-tricks.com/almanac/selectors/n/nth-last-child

    – Funk Doc
    5 hours ago











  • Yes I was thinking along the same lines but that only targets the bottom right div. I need it to target both last row divs

    – supersan
    5 hours ago






  • 4





    Just add: .qa:nth-last-child(-n+2) border: 0;

    – bea
    4 hours ago






  • 2





    @bea: your's is the right answer! Put it as an answer and you'll get upvoted

    – enxaneta
    4 hours ago

















  • I think nth-last-child would be able to help you css-tricks.com/almanac/selectors/n/nth-last-child

    – Funk Doc
    5 hours ago











  • Yes I was thinking along the same lines but that only targets the bottom right div. I need it to target both last row divs

    – supersan
    5 hours ago






  • 4





    Just add: .qa:nth-last-child(-n+2) border: 0;

    – bea
    4 hours ago






  • 2





    @bea: your's is the right answer! Put it as an answer and you'll get upvoted

    – enxaneta
    4 hours ago
















I think nth-last-child would be able to help you css-tricks.com/almanac/selectors/n/nth-last-child

– Funk Doc
5 hours ago





I think nth-last-child would be able to help you css-tricks.com/almanac/selectors/n/nth-last-child

– Funk Doc
5 hours ago













Yes I was thinking along the same lines but that only targets the bottom right div. I need it to target both last row divs

– supersan
5 hours ago





Yes I was thinking along the same lines but that only targets the bottom right div. I need it to target both last row divs

– supersan
5 hours ago




4




4





Just add: .qa:nth-last-child(-n+2) border: 0;

– bea
4 hours ago





Just add: .qa:nth-last-child(-n+2) border: 0;

– bea
4 hours ago




2




2





@bea: your's is the right answer! Put it as an answer and you'll get upvoted

– enxaneta
4 hours ago





@bea: your's is the right answer! Put it as an answer and you'll get upvoted

– enxaneta
4 hours ago












7 Answers
7






active

oldest

votes


















3














1: Use Another CSS class



We can create another CSS class which removes any styling form an existence element



.no-border 
border-bottom: none;



Then add this class to the html element e.g.



 <div class="qa no-border" style="width:50%;">
<div>Question</div>
<div>Answer</div>
</div>


2: Use CSS pseudo selector




.qa:last-child
border-bottom: none;


.qa:nth-last-child(2)
border-bottom: none;






share|improve this answer

























  • they are called pseudo classes (developer.mozilla.org/fr/docs/Web/CSS/Pseudo-classes)

    – Temani Afif
    3 hours ago











  • Yes, good catch Temani! Thanks

    – KhaledMohamedP
    3 hours ago











  • never realized it would always be the last and second last element. the layout makes it look like it's the 3rd element and 6th element. thanks

    – supersan
    3 hours ago


















3














judging by your layout, the items are numbered:



 [1] [2]
[3] [4]
[5] [6]


now, you can either:



  • remove border-bottom from 5th & 6th items

.qa 
border-bottom: 1px solid #ccc;


.qa:nth-of-type(5),
.qa:nth-of-type(6)
border-bottom: none;



  • add border-bottom to 1st-4th items:

.qa:nth-of-type(n+5) 
border-bottom: 1px solid #ccc;



  • do similar math but for adding border-top


you can also flip the flex direction to make it more "reasonable" but also requires a fixed height (needed for wrapping, see here):



.container 
display: flex;
flex-direction: column;
flex-wrap: wrap;



which numbers items in a different orientation:



 [1] [4]
[2] [5]
[3] [6]


now you reomove border-bottom on every 3rd item:



.qa 
border-bottom: 1px solid #ccc;


.qa:nth-of-type(3n)
border-bottom: none;




there are more complex fixes as well. for instance, you can group items in rows and apply border on row based selectors. This will be closest to what you really intended in the first place:



.row .qa 
border-bottom: 1px solid #ccc;


.row:last-of-type .qa
border-bottom: none;






share|improve this answer






























    1














    Don't think about it as border-bottom.



    Think about it as border-top and exclude the first two elements.



    So instead of this:



    .qa border-bottom: 1px solid #ccc; 


    Try this:



    .qa + .qa + .qa border-top: 1px solid #ccc; 





    .qa + .qa + .qa 
    border-top: 1px solid #ccc;

    <div style="display: flex; flex-wrap: wrap; flex-direction: row">
    <div class="qa" style="width:50%;">
    <div>Question</div>
    <div>Answer</div>
    </div>
    <div class="qa" style="width:50%;">
    <div>Question</div>
    <div>Answer</div>
    </div>
    <div class="qa" style="width:50%;">
    <div>Question</div>
    <div>Answer</div>
    </div>
    <div class="qa" style="width:50%;">
    <div>Question</div>
    <div>Answer</div>
    </div>
    <div class="qa" style="width:50%;">
    <div>Question</div>
    <div>Answer</div>
    </div>
    <div class="qa" style="width:50%;">
    <div>Question</div>
    <div>Answer</div>
    </div>
    <div class="qa" style="width:50%;">
    <div>Question</div>
    <div>Answer</div>
    </div>
    <div class="qa" style="width:50%;">
    <div>Question</div>
    <div>Answer</div>
    </div>
    <div class="qa" style="width:50%;">
    <div>Question</div>
    <div>Answer</div>
    </div>
    <div class="qa" style="width:50%;">
    <div>Question</div>
    <div>Answer</div>
    </div>
    </div>





    The next-sibling combinator (+) targets an element that is immediately preceded by another element, and both share the same parent.



    So .qa + .qa would target only .qa elements that are preceded by one .qa element.



    .qa + .qa + .qa targets only .qa elements that are preceded by two .qa elements.




    Alternatively, you can try this:



    .qa:nth-child(n + 3) border-top: 1px solid #ccc; 





    .qa:nth-child(n + 3) 
    border-top: 1px solid #ccc;

    <div style="display: flex; flex-wrap: wrap; flex-direction: row">
    <div class="qa" style="width:50%;">
    <div>Question</div>
    <div>Answer</div>
    </div>
    <div class="qa" style="width:50%;">
    <div>Question</div>
    <div>Answer</div>
    </div>
    <div class="qa" style="width:50%;">
    <div>Question</div>
    <div>Answer</div>
    </div>
    <div class="qa" style="width:50%;">
    <div>Question</div>
    <div>Answer</div>
    </div>
    <div class="qa" style="width:50%;">
    <div>Question</div>
    <div>Answer</div>
    </div>
    <div class="qa" style="width:50%;">
    <div>Question</div>
    <div>Answer</div>
    </div>
    <div class="qa" style="width:50%;">
    <div>Question</div>
    <div>Answer</div>
    </div>
    <div class="qa" style="width:50%;">
    <div>Question</div>
    <div>Answer</div>
    </div>


    </div>








    share|improve this answer

























    • Your first solution is absolutely unreadable. Your second option I like.

      – Raz0rwire
      4 hours ago











    • @Raz0rwire, what don't you understand?

      – Michael_B
      4 hours ago











    • @Micheal_B Understanding it now is not the problem, looking at the code 6 months from now could introduce some head scratching. Maybe I was being a little dramatic..

      – Raz0rwire
      4 hours ago


















    1














    You can add a negative bottom margin to your elements then hide the overflow. This will hide the unwanted borders.






    .qa 
    border-bottom: 1px solid #ccc;
    margin-bottom:-1px;
    margin-top:1px; /*to rectify the bottom margin, we can also consider padding-bottom*/

    /*irrelevant styles*/
    padding: 5px;
    margin-left:5px;
    margin-right:5px;
    box-sizing: border-box;
    flex:1 1 40%;


    .wrapper
    display: flex;
    flex-wrap: wrap;
    flex-direction: row;
    overflow:hidden;

    <div class="wrapper">
    <div class="qa">
    <div>Question</div>
    <div>Answer<br>Answer</div>
    </div>
    <div class="qa">
    <div>Question</div>
    <div>Answer</div>
    </div>
    <div class="qa">
    <div>Question</div>
    <div>Answer</div>
    </div>
    <div class="qa">
    <div>Question</div>
    <div>Answer<br>Answer</div>
    </div>
    <div class="qa">
    <div>Question</div>
    <div>Answer</div>
    </div>
    <div class="qa">
    <div>Question</div>
    <div>Answer</div>
    </div>
    <div class="qa">
    <div>Question</div>
    <div>Answer</div>
    </div>
    <div class="qa">
    <div>Question</div>
    <div>Answer</div>
    </div>
    <div class="qa">
    <div>Question</div>
    <div>Answer</div>
    </div>
    <div class="qa">
    <div>Question</div>
    <div>Answer<br>Answer</div>
    </div>
    </div>





    This trick should work even if the number of element in a row is different from 2:






    .qa 
    border-bottom: 1px solid #ccc;
    margin-bottom:-1px;
    margin-top:1px;


    /*irrelevant styles*/
    padding: 5px;
    margin-left:5px;
    margin-right:5px;
    box-sizing: border-box;
    flex:1 1 20%;


    .wrapper
    display: flex;
    flex-wrap: wrap;
    flex-direction: row;
    overflow:hidden;

    <div class="wrapper">
    <div class="qa" >
    <div>Question</div>
    <div>Answer</div>
    </div>
    <div class="qa" >
    <div>Question</div>
    <div>Answer</div>
    </div>
    <div class="qa" >
    <div>Question</div>
    <div>Answer</div>
    </div>
    <div class="qa" >
    <div>Question</div>
    <div>Answer</div>
    </div>
    <div class="qa" >
    <div>Question</div>
    <div>Answer</div>
    </div>
    <div class="qa" >
    <div>Question</div>
    <div>Answer<br> answer</div>
    </div>
    <div class="qa" >
    <div>Question</div>
    <div>Answer</div>
    </div>
    <div class="qa" >
    <div>Question</div>
    <div>Answer</div>
    </div>
    <div class="qa" >
    <div>Question</div>
    <div>Answer</div>
    </div>
    <div class="qa" >
    <div>Question</div>
    <div>Answer</div>
    </div>
    <div class="qa" >
    <div>Question</div>
    <div>Answer</div>
    </div>
    <div class="qa" >
    <div>Question</div>
    <div>Answer<br> answer</div>
    </div>
    </div>





    It will also work with a reponsive layout where the number of columns can change on small screens:






    .qa 
    border-bottom: 1px solid #ccc;
    margin-bottom:-1px;
    margin-top:1px;


    /*irrelevant styles*/
    padding: 5px;
    margin-left:5px;
    margin-right:5px;
    box-sizing: border-box;
    flex:1 1 20%;


    .wrapper
    display: flex;
    flex-wrap: wrap;
    flex-direction: row;
    overflow:hidden;


    @media all and (max-width:800px)
    .qa
    flex:1 1 30%;



    @media all and (max-width:400px)
    .qa
    flex:1 1 40%;


    <div class="wrapper">
    <div class="qa" >
    <div>Question</div>
    <div>Answer</div>
    </div>
    <div class="qa" >
    <div>Question</div>
    <div>Answer</div>
    </div>
    <div class="qa" >
    <div>Question</div>
    <div>Answer</div>
    </div>
    <div class="qa" >
    <div>Question</div>
    <div>Answer</div>
    </div>
    <div class="qa" >
    <div>Question</div>
    <div>Answer</div>
    </div>
    <div class="qa" >
    <div>Question</div>
    <div>Answer<br> answer</div>
    </div>
    <div class="qa" >
    <div>Question</div>
    <div>Answer</div>
    </div>
    <div class="qa" >
    <div>Question</div>
    <div>Answer</div>
    </div>
    <div class="qa" >
    <div>Question</div>
    <div>Answer</div>
    </div>
    <div class="qa" >
    <div>Question</div>
    <div>Answer</div>
    </div>
    <div class="qa" >
    <div>Question</div>
    <div>Answer</div>
    </div>
    <div class="qa" >
    <div>Question</div>
    <div>Answer<br> answer</div>
    </div>
    </div>








    share|improve this answer




















    • 1





      This is great out of the box thinking! and it covers both flex row and columns. That's why I love SO, you get to learn so much! thanks

      – supersan
      3 hours ago











    • @supersan yes exactly ;) it will cover all the different configuration and more important the responsive part as I am sure that your layout will change to one column for example on small screens.

      – Temani Afif
      2 hours ago


















    0














    If you can add a :after pseudo Element in parent container of .qa (make sure your parent container is set to position: relative; or position: absolute;)



    Css for .qa parent element




    content: "";
    position: relative;
    bottom: 0;
    left:0;
    right:0;
    height: /* set this to your (bottom padding of container + bottom margin of .qa box + border width) */
    background: #fff; /* match this with your parent element background colour*/






    share|improve this answer
































      0














      You could use border-top and remove the first two with the :nth-child CSS selector. Like this:






      .qa 
      border-top: 1px solid #ccc;


      .qa:nth-child(-n+2)
      border-top: none;

      <div style="display: flex; flex-wrap: wrap; flex-direction: row">
      <div class="qa" style="width:50%;">
      <div>Question</div>
      <div>Answer</div>
      </div>
      <div class="qa" style="width:50%;">
      <div>Question</div>
      <div>Answer</div>
      </div>
      <div class="qa" style="width:50%;">
      <div>Question</div>
      <div>Answer</div>
      </div>
      <div class="qa" style="width:50%;">
      <div>Question</div>
      <div>Answer</div>
      </div>
      <div class="qa" style="width:50%;">
      <div>Question</div>
      <div>Answer</div>
      </div>
      <div class="qa" style="width:50%;">
      <div>Question</div>
      <div>Answer</div>
      </div>
      <div class="qa" style="width:50%;">
      <div>Question</div>
      <div>Answer</div>
      </div>
      <div class="qa" style="width:50%;">
      <div>Question</div>
      <div>Answer</div>
      </div>
      <div class="qa" style="width:50%;">
      <div>Question</div>
      <div>Answer</div>
      </div>
      <div class="qa" style="width:50%;">
      <div>Question</div>
      <div>Answer</div>
      </div>
      </div>








      share|improve this answer






























        0














        I don't like adding a rule when you know you're immediately going to overwrite it, so here's a slightly different version of aridlehoover's answer with only one CSS rule.






        .qa:not(:nth-child(-n+2)) 
        border-top: 1px solid #ccc;

        <div style="display: flex; flex-wrap: wrap; flex-direction: row">
        <div class="qa" style="width:50%;">
        <div>Question</div>
        <div>Answer</div>
        </div>
        <div class="qa" style="width:50%;">
        <div>Question</div>
        <div>Answer</div>
        </div>
        <div class="qa" style="width:50%;">
        <div>Question</div>
        <div>Answer</div>
        </div>
        <div class="qa" style="width:50%;">
        <div>Question</div>
        <div>Answer</div>
        </div>
        <div class="qa" style="width:50%;">
        <div>Question</div>
        <div>Answer</div>
        </div>
        <div class="qa" style="width:50%;">
        <div>Question</div>
        <div>Answer</div>
        </div>
        <div class="qa" style="width:50%;">
        <div>Question</div>
        <div>Answer</div>
        </div>
        <div class="qa" style="width:50%;">
        <div>Question</div>
        <div>Answer</div>
        </div>
        <div class="qa" style="width:50%;">
        <div>Question</div>
        <div>Answer</div>
        </div>
        <div class="qa" style="width:50%;">
        <div>Question</div>
        <div>Answer</div>
        </div>
        </div>








        share|improve this answer























          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55480980%2fhow-to-remove-border-from-elements-in-the-last-row%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          7 Answers
          7






          active

          oldest

          votes








          7 Answers
          7






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          3














          1: Use Another CSS class



          We can create another CSS class which removes any styling form an existence element



          .no-border 
          border-bottom: none;



          Then add this class to the html element e.g.



           <div class="qa no-border" style="width:50%;">
          <div>Question</div>
          <div>Answer</div>
          </div>


          2: Use CSS pseudo selector




          .qa:last-child
          border-bottom: none;


          .qa:nth-last-child(2)
          border-bottom: none;






          share|improve this answer

























          • they are called pseudo classes (developer.mozilla.org/fr/docs/Web/CSS/Pseudo-classes)

            – Temani Afif
            3 hours ago











          • Yes, good catch Temani! Thanks

            – KhaledMohamedP
            3 hours ago











          • never realized it would always be the last and second last element. the layout makes it look like it's the 3rd element and 6th element. thanks

            – supersan
            3 hours ago















          3














          1: Use Another CSS class



          We can create another CSS class which removes any styling form an existence element



          .no-border 
          border-bottom: none;



          Then add this class to the html element e.g.



           <div class="qa no-border" style="width:50%;">
          <div>Question</div>
          <div>Answer</div>
          </div>


          2: Use CSS pseudo selector




          .qa:last-child
          border-bottom: none;


          .qa:nth-last-child(2)
          border-bottom: none;






          share|improve this answer

























          • they are called pseudo classes (developer.mozilla.org/fr/docs/Web/CSS/Pseudo-classes)

            – Temani Afif
            3 hours ago











          • Yes, good catch Temani! Thanks

            – KhaledMohamedP
            3 hours ago











          • never realized it would always be the last and second last element. the layout makes it look like it's the 3rd element and 6th element. thanks

            – supersan
            3 hours ago













          3












          3








          3







          1: Use Another CSS class



          We can create another CSS class which removes any styling form an existence element



          .no-border 
          border-bottom: none;



          Then add this class to the html element e.g.



           <div class="qa no-border" style="width:50%;">
          <div>Question</div>
          <div>Answer</div>
          </div>


          2: Use CSS pseudo selector




          .qa:last-child
          border-bottom: none;


          .qa:nth-last-child(2)
          border-bottom: none;






          share|improve this answer















          1: Use Another CSS class



          We can create another CSS class which removes any styling form an existence element



          .no-border 
          border-bottom: none;



          Then add this class to the html element e.g.



           <div class="qa no-border" style="width:50%;">
          <div>Question</div>
          <div>Answer</div>
          </div>


          2: Use CSS pseudo selector




          .qa:last-child
          border-bottom: none;


          .qa:nth-last-child(2)
          border-bottom: none;







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited 3 hours ago









          Temani Afif

          81.8k104793




          81.8k104793










          answered 3 hours ago









          KhaledMohamedPKhaledMohamedP

          2,29021720




          2,29021720












          • they are called pseudo classes (developer.mozilla.org/fr/docs/Web/CSS/Pseudo-classes)

            – Temani Afif
            3 hours ago











          • Yes, good catch Temani! Thanks

            – KhaledMohamedP
            3 hours ago











          • never realized it would always be the last and second last element. the layout makes it look like it's the 3rd element and 6th element. thanks

            – supersan
            3 hours ago

















          • they are called pseudo classes (developer.mozilla.org/fr/docs/Web/CSS/Pseudo-classes)

            – Temani Afif
            3 hours ago











          • Yes, good catch Temani! Thanks

            – KhaledMohamedP
            3 hours ago











          • never realized it would always be the last and second last element. the layout makes it look like it's the 3rd element and 6th element. thanks

            – supersan
            3 hours ago
















          they are called pseudo classes (developer.mozilla.org/fr/docs/Web/CSS/Pseudo-classes)

          – Temani Afif
          3 hours ago





          they are called pseudo classes (developer.mozilla.org/fr/docs/Web/CSS/Pseudo-classes)

          – Temani Afif
          3 hours ago













          Yes, good catch Temani! Thanks

          – KhaledMohamedP
          3 hours ago





          Yes, good catch Temani! Thanks

          – KhaledMohamedP
          3 hours ago













          never realized it would always be the last and second last element. the layout makes it look like it's the 3rd element and 6th element. thanks

          – supersan
          3 hours ago





          never realized it would always be the last and second last element. the layout makes it look like it's the 3rd element and 6th element. thanks

          – supersan
          3 hours ago













          3














          judging by your layout, the items are numbered:



           [1] [2]
          [3] [4]
          [5] [6]


          now, you can either:



          • remove border-bottom from 5th & 6th items

          .qa 
          border-bottom: 1px solid #ccc;


          .qa:nth-of-type(5),
          .qa:nth-of-type(6)
          border-bottom: none;



          • add border-bottom to 1st-4th items:

          .qa:nth-of-type(n+5) 
          border-bottom: 1px solid #ccc;



          • do similar math but for adding border-top


          you can also flip the flex direction to make it more "reasonable" but also requires a fixed height (needed for wrapping, see here):



          .container 
          display: flex;
          flex-direction: column;
          flex-wrap: wrap;



          which numbers items in a different orientation:



           [1] [4]
          [2] [5]
          [3] [6]


          now you reomove border-bottom on every 3rd item:



          .qa 
          border-bottom: 1px solid #ccc;


          .qa:nth-of-type(3n)
          border-bottom: none;




          there are more complex fixes as well. for instance, you can group items in rows and apply border on row based selectors. This will be closest to what you really intended in the first place:



          .row .qa 
          border-bottom: 1px solid #ccc;


          .row:last-of-type .qa
          border-bottom: none;






          share|improve this answer



























            3














            judging by your layout, the items are numbered:



             [1] [2]
            [3] [4]
            [5] [6]


            now, you can either:



            • remove border-bottom from 5th & 6th items

            .qa 
            border-bottom: 1px solid #ccc;


            .qa:nth-of-type(5),
            .qa:nth-of-type(6)
            border-bottom: none;



            • add border-bottom to 1st-4th items:

            .qa:nth-of-type(n+5) 
            border-bottom: 1px solid #ccc;



            • do similar math but for adding border-top


            you can also flip the flex direction to make it more "reasonable" but also requires a fixed height (needed for wrapping, see here):



            .container 
            display: flex;
            flex-direction: column;
            flex-wrap: wrap;



            which numbers items in a different orientation:



             [1] [4]
            [2] [5]
            [3] [6]


            now you reomove border-bottom on every 3rd item:



            .qa 
            border-bottom: 1px solid #ccc;


            .qa:nth-of-type(3n)
            border-bottom: none;




            there are more complex fixes as well. for instance, you can group items in rows and apply border on row based selectors. This will be closest to what you really intended in the first place:



            .row .qa 
            border-bottom: 1px solid #ccc;


            .row:last-of-type .qa
            border-bottom: none;






            share|improve this answer

























              3












              3








              3







              judging by your layout, the items are numbered:



               [1] [2]
              [3] [4]
              [5] [6]


              now, you can either:



              • remove border-bottom from 5th & 6th items

              .qa 
              border-bottom: 1px solid #ccc;


              .qa:nth-of-type(5),
              .qa:nth-of-type(6)
              border-bottom: none;



              • add border-bottom to 1st-4th items:

              .qa:nth-of-type(n+5) 
              border-bottom: 1px solid #ccc;



              • do similar math but for adding border-top


              you can also flip the flex direction to make it more "reasonable" but also requires a fixed height (needed for wrapping, see here):



              .container 
              display: flex;
              flex-direction: column;
              flex-wrap: wrap;



              which numbers items in a different orientation:



               [1] [4]
              [2] [5]
              [3] [6]


              now you reomove border-bottom on every 3rd item:



              .qa 
              border-bottom: 1px solid #ccc;


              .qa:nth-of-type(3n)
              border-bottom: none;




              there are more complex fixes as well. for instance, you can group items in rows and apply border on row based selectors. This will be closest to what you really intended in the first place:



              .row .qa 
              border-bottom: 1px solid #ccc;


              .row:last-of-type .qa
              border-bottom: none;






              share|improve this answer













              judging by your layout, the items are numbered:



               [1] [2]
              [3] [4]
              [5] [6]


              now, you can either:



              • remove border-bottom from 5th & 6th items

              .qa 
              border-bottom: 1px solid #ccc;


              .qa:nth-of-type(5),
              .qa:nth-of-type(6)
              border-bottom: none;



              • add border-bottom to 1st-4th items:

              .qa:nth-of-type(n+5) 
              border-bottom: 1px solid #ccc;



              • do similar math but for adding border-top


              you can also flip the flex direction to make it more "reasonable" but also requires a fixed height (needed for wrapping, see here):



              .container 
              display: flex;
              flex-direction: column;
              flex-wrap: wrap;



              which numbers items in a different orientation:



               [1] [4]
              [2] [5]
              [3] [6]


              now you reomove border-bottom on every 3rd item:



              .qa 
              border-bottom: 1px solid #ccc;


              .qa:nth-of-type(3n)
              border-bottom: none;




              there are more complex fixes as well. for instance, you can group items in rows and apply border on row based selectors. This will be closest to what you really intended in the first place:



              .row .qa 
              border-bottom: 1px solid #ccc;


              .row:last-of-type .qa
              border-bottom: none;







              share|improve this answer












              share|improve this answer



              share|improve this answer










              answered 3 hours ago









              zhirzhzhirzh

              1,6801723




              1,6801723





















                  1














                  Don't think about it as border-bottom.



                  Think about it as border-top and exclude the first two elements.



                  So instead of this:



                  .qa border-bottom: 1px solid #ccc; 


                  Try this:



                  .qa + .qa + .qa border-top: 1px solid #ccc; 





                  .qa + .qa + .qa 
                  border-top: 1px solid #ccc;

                  <div style="display: flex; flex-wrap: wrap; flex-direction: row">
                  <div class="qa" style="width:50%;">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" style="width:50%;">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" style="width:50%;">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" style="width:50%;">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" style="width:50%;">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" style="width:50%;">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" style="width:50%;">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" style="width:50%;">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" style="width:50%;">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" style="width:50%;">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  </div>





                  The next-sibling combinator (+) targets an element that is immediately preceded by another element, and both share the same parent.



                  So .qa + .qa would target only .qa elements that are preceded by one .qa element.



                  .qa + .qa + .qa targets only .qa elements that are preceded by two .qa elements.




                  Alternatively, you can try this:



                  .qa:nth-child(n + 3) border-top: 1px solid #ccc; 





                  .qa:nth-child(n + 3) 
                  border-top: 1px solid #ccc;

                  <div style="display: flex; flex-wrap: wrap; flex-direction: row">
                  <div class="qa" style="width:50%;">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" style="width:50%;">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" style="width:50%;">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" style="width:50%;">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" style="width:50%;">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" style="width:50%;">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" style="width:50%;">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" style="width:50%;">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>


                  </div>








                  share|improve this answer

























                  • Your first solution is absolutely unreadable. Your second option I like.

                    – Raz0rwire
                    4 hours ago











                  • @Raz0rwire, what don't you understand?

                    – Michael_B
                    4 hours ago











                  • @Micheal_B Understanding it now is not the problem, looking at the code 6 months from now could introduce some head scratching. Maybe I was being a little dramatic..

                    – Raz0rwire
                    4 hours ago















                  1














                  Don't think about it as border-bottom.



                  Think about it as border-top and exclude the first two elements.



                  So instead of this:



                  .qa border-bottom: 1px solid #ccc; 


                  Try this:



                  .qa + .qa + .qa border-top: 1px solid #ccc; 





                  .qa + .qa + .qa 
                  border-top: 1px solid #ccc;

                  <div style="display: flex; flex-wrap: wrap; flex-direction: row">
                  <div class="qa" style="width:50%;">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" style="width:50%;">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" style="width:50%;">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" style="width:50%;">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" style="width:50%;">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" style="width:50%;">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" style="width:50%;">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" style="width:50%;">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" style="width:50%;">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" style="width:50%;">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  </div>





                  The next-sibling combinator (+) targets an element that is immediately preceded by another element, and both share the same parent.



                  So .qa + .qa would target only .qa elements that are preceded by one .qa element.



                  .qa + .qa + .qa targets only .qa elements that are preceded by two .qa elements.




                  Alternatively, you can try this:



                  .qa:nth-child(n + 3) border-top: 1px solid #ccc; 





                  .qa:nth-child(n + 3) 
                  border-top: 1px solid #ccc;

                  <div style="display: flex; flex-wrap: wrap; flex-direction: row">
                  <div class="qa" style="width:50%;">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" style="width:50%;">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" style="width:50%;">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" style="width:50%;">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" style="width:50%;">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" style="width:50%;">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" style="width:50%;">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" style="width:50%;">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>


                  </div>








                  share|improve this answer

























                  • Your first solution is absolutely unreadable. Your second option I like.

                    – Raz0rwire
                    4 hours ago











                  • @Raz0rwire, what don't you understand?

                    – Michael_B
                    4 hours ago











                  • @Micheal_B Understanding it now is not the problem, looking at the code 6 months from now could introduce some head scratching. Maybe I was being a little dramatic..

                    – Raz0rwire
                    4 hours ago













                  1












                  1








                  1







                  Don't think about it as border-bottom.



                  Think about it as border-top and exclude the first two elements.



                  So instead of this:



                  .qa border-bottom: 1px solid #ccc; 


                  Try this:



                  .qa + .qa + .qa border-top: 1px solid #ccc; 





                  .qa + .qa + .qa 
                  border-top: 1px solid #ccc;

                  <div style="display: flex; flex-wrap: wrap; flex-direction: row">
                  <div class="qa" style="width:50%;">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" style="width:50%;">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" style="width:50%;">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" style="width:50%;">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" style="width:50%;">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" style="width:50%;">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" style="width:50%;">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" style="width:50%;">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" style="width:50%;">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" style="width:50%;">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  </div>





                  The next-sibling combinator (+) targets an element that is immediately preceded by another element, and both share the same parent.



                  So .qa + .qa would target only .qa elements that are preceded by one .qa element.



                  .qa + .qa + .qa targets only .qa elements that are preceded by two .qa elements.




                  Alternatively, you can try this:



                  .qa:nth-child(n + 3) border-top: 1px solid #ccc; 





                  .qa:nth-child(n + 3) 
                  border-top: 1px solid #ccc;

                  <div style="display: flex; flex-wrap: wrap; flex-direction: row">
                  <div class="qa" style="width:50%;">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" style="width:50%;">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" style="width:50%;">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" style="width:50%;">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" style="width:50%;">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" style="width:50%;">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" style="width:50%;">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" style="width:50%;">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>


                  </div>








                  share|improve this answer















                  Don't think about it as border-bottom.



                  Think about it as border-top and exclude the first two elements.



                  So instead of this:



                  .qa border-bottom: 1px solid #ccc; 


                  Try this:



                  .qa + .qa + .qa border-top: 1px solid #ccc; 





                  .qa + .qa + .qa 
                  border-top: 1px solid #ccc;

                  <div style="display: flex; flex-wrap: wrap; flex-direction: row">
                  <div class="qa" style="width:50%;">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" style="width:50%;">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" style="width:50%;">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" style="width:50%;">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" style="width:50%;">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" style="width:50%;">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" style="width:50%;">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" style="width:50%;">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" style="width:50%;">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" style="width:50%;">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  </div>





                  The next-sibling combinator (+) targets an element that is immediately preceded by another element, and both share the same parent.



                  So .qa + .qa would target only .qa elements that are preceded by one .qa element.



                  .qa + .qa + .qa targets only .qa elements that are preceded by two .qa elements.




                  Alternatively, you can try this:



                  .qa:nth-child(n + 3) border-top: 1px solid #ccc; 





                  .qa:nth-child(n + 3) 
                  border-top: 1px solid #ccc;

                  <div style="display: flex; flex-wrap: wrap; flex-direction: row">
                  <div class="qa" style="width:50%;">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" style="width:50%;">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" style="width:50%;">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" style="width:50%;">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" style="width:50%;">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" style="width:50%;">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" style="width:50%;">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" style="width:50%;">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>


                  </div>








                  .qa + .qa + .qa 
                  border-top: 1px solid #ccc;

                  <div style="display: flex; flex-wrap: wrap; flex-direction: row">
                  <div class="qa" style="width:50%;">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" style="width:50%;">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" style="width:50%;">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" style="width:50%;">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" style="width:50%;">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" style="width:50%;">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" style="width:50%;">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" style="width:50%;">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" style="width:50%;">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" style="width:50%;">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  </div>





                  .qa + .qa + .qa 
                  border-top: 1px solid #ccc;

                  <div style="display: flex; flex-wrap: wrap; flex-direction: row">
                  <div class="qa" style="width:50%;">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" style="width:50%;">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" style="width:50%;">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" style="width:50%;">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" style="width:50%;">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" style="width:50%;">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" style="width:50%;">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" style="width:50%;">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" style="width:50%;">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" style="width:50%;">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  </div>





                  .qa:nth-child(n + 3) 
                  border-top: 1px solid #ccc;

                  <div style="display: flex; flex-wrap: wrap; flex-direction: row">
                  <div class="qa" style="width:50%;">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" style="width:50%;">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" style="width:50%;">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" style="width:50%;">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" style="width:50%;">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" style="width:50%;">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" style="width:50%;">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" style="width:50%;">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>


                  </div>





                  .qa:nth-child(n + 3) 
                  border-top: 1px solid #ccc;

                  <div style="display: flex; flex-wrap: wrap; flex-direction: row">
                  <div class="qa" style="width:50%;">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" style="width:50%;">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" style="width:50%;">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" style="width:50%;">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" style="width:50%;">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" style="width:50%;">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" style="width:50%;">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" style="width:50%;">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>


                  </div>






                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited 4 hours ago

























                  answered 4 hours ago









                  Michael_BMichael_B

                  157k50255363




                  157k50255363












                  • Your first solution is absolutely unreadable. Your second option I like.

                    – Raz0rwire
                    4 hours ago











                  • @Raz0rwire, what don't you understand?

                    – Michael_B
                    4 hours ago











                  • @Micheal_B Understanding it now is not the problem, looking at the code 6 months from now could introduce some head scratching. Maybe I was being a little dramatic..

                    – Raz0rwire
                    4 hours ago

















                  • Your first solution is absolutely unreadable. Your second option I like.

                    – Raz0rwire
                    4 hours ago











                  • @Raz0rwire, what don't you understand?

                    – Michael_B
                    4 hours ago











                  • @Micheal_B Understanding it now is not the problem, looking at the code 6 months from now could introduce some head scratching. Maybe I was being a little dramatic..

                    – Raz0rwire
                    4 hours ago
















                  Your first solution is absolutely unreadable. Your second option I like.

                  – Raz0rwire
                  4 hours ago





                  Your first solution is absolutely unreadable. Your second option I like.

                  – Raz0rwire
                  4 hours ago













                  @Raz0rwire, what don't you understand?

                  – Michael_B
                  4 hours ago





                  @Raz0rwire, what don't you understand?

                  – Michael_B
                  4 hours ago













                  @Micheal_B Understanding it now is not the problem, looking at the code 6 months from now could introduce some head scratching. Maybe I was being a little dramatic..

                  – Raz0rwire
                  4 hours ago





                  @Micheal_B Understanding it now is not the problem, looking at the code 6 months from now could introduce some head scratching. Maybe I was being a little dramatic..

                  – Raz0rwire
                  4 hours ago











                  1














                  You can add a negative bottom margin to your elements then hide the overflow. This will hide the unwanted borders.






                  .qa 
                  border-bottom: 1px solid #ccc;
                  margin-bottom:-1px;
                  margin-top:1px; /*to rectify the bottom margin, we can also consider padding-bottom*/

                  /*irrelevant styles*/
                  padding: 5px;
                  margin-left:5px;
                  margin-right:5px;
                  box-sizing: border-box;
                  flex:1 1 40%;


                  .wrapper
                  display: flex;
                  flex-wrap: wrap;
                  flex-direction: row;
                  overflow:hidden;

                  <div class="wrapper">
                  <div class="qa">
                  <div>Question</div>
                  <div>Answer<br>Answer</div>
                  </div>
                  <div class="qa">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa">
                  <div>Question</div>
                  <div>Answer<br>Answer</div>
                  </div>
                  <div class="qa">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa">
                  <div>Question</div>
                  <div>Answer<br>Answer</div>
                  </div>
                  </div>





                  This trick should work even if the number of element in a row is different from 2:






                  .qa 
                  border-bottom: 1px solid #ccc;
                  margin-bottom:-1px;
                  margin-top:1px;


                  /*irrelevant styles*/
                  padding: 5px;
                  margin-left:5px;
                  margin-right:5px;
                  box-sizing: border-box;
                  flex:1 1 20%;


                  .wrapper
                  display: flex;
                  flex-wrap: wrap;
                  flex-direction: row;
                  overflow:hidden;

                  <div class="wrapper">
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer<br> answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer<br> answer</div>
                  </div>
                  </div>





                  It will also work with a reponsive layout where the number of columns can change on small screens:






                  .qa 
                  border-bottom: 1px solid #ccc;
                  margin-bottom:-1px;
                  margin-top:1px;


                  /*irrelevant styles*/
                  padding: 5px;
                  margin-left:5px;
                  margin-right:5px;
                  box-sizing: border-box;
                  flex:1 1 20%;


                  .wrapper
                  display: flex;
                  flex-wrap: wrap;
                  flex-direction: row;
                  overflow:hidden;


                  @media all and (max-width:800px)
                  .qa
                  flex:1 1 30%;



                  @media all and (max-width:400px)
                  .qa
                  flex:1 1 40%;


                  <div class="wrapper">
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer<br> answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer<br> answer</div>
                  </div>
                  </div>








                  share|improve this answer




















                  • 1





                    This is great out of the box thinking! and it covers both flex row and columns. That's why I love SO, you get to learn so much! thanks

                    – supersan
                    3 hours ago











                  • @supersan yes exactly ;) it will cover all the different configuration and more important the responsive part as I am sure that your layout will change to one column for example on small screens.

                    – Temani Afif
                    2 hours ago















                  1














                  You can add a negative bottom margin to your elements then hide the overflow. This will hide the unwanted borders.






                  .qa 
                  border-bottom: 1px solid #ccc;
                  margin-bottom:-1px;
                  margin-top:1px; /*to rectify the bottom margin, we can also consider padding-bottom*/

                  /*irrelevant styles*/
                  padding: 5px;
                  margin-left:5px;
                  margin-right:5px;
                  box-sizing: border-box;
                  flex:1 1 40%;


                  .wrapper
                  display: flex;
                  flex-wrap: wrap;
                  flex-direction: row;
                  overflow:hidden;

                  <div class="wrapper">
                  <div class="qa">
                  <div>Question</div>
                  <div>Answer<br>Answer</div>
                  </div>
                  <div class="qa">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa">
                  <div>Question</div>
                  <div>Answer<br>Answer</div>
                  </div>
                  <div class="qa">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa">
                  <div>Question</div>
                  <div>Answer<br>Answer</div>
                  </div>
                  </div>





                  This trick should work even if the number of element in a row is different from 2:






                  .qa 
                  border-bottom: 1px solid #ccc;
                  margin-bottom:-1px;
                  margin-top:1px;


                  /*irrelevant styles*/
                  padding: 5px;
                  margin-left:5px;
                  margin-right:5px;
                  box-sizing: border-box;
                  flex:1 1 20%;


                  .wrapper
                  display: flex;
                  flex-wrap: wrap;
                  flex-direction: row;
                  overflow:hidden;

                  <div class="wrapper">
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer<br> answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer<br> answer</div>
                  </div>
                  </div>





                  It will also work with a reponsive layout where the number of columns can change on small screens:






                  .qa 
                  border-bottom: 1px solid #ccc;
                  margin-bottom:-1px;
                  margin-top:1px;


                  /*irrelevant styles*/
                  padding: 5px;
                  margin-left:5px;
                  margin-right:5px;
                  box-sizing: border-box;
                  flex:1 1 20%;


                  .wrapper
                  display: flex;
                  flex-wrap: wrap;
                  flex-direction: row;
                  overflow:hidden;


                  @media all and (max-width:800px)
                  .qa
                  flex:1 1 30%;



                  @media all and (max-width:400px)
                  .qa
                  flex:1 1 40%;


                  <div class="wrapper">
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer<br> answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer<br> answer</div>
                  </div>
                  </div>








                  share|improve this answer




















                  • 1





                    This is great out of the box thinking! and it covers both flex row and columns. That's why I love SO, you get to learn so much! thanks

                    – supersan
                    3 hours ago











                  • @supersan yes exactly ;) it will cover all the different configuration and more important the responsive part as I am sure that your layout will change to one column for example on small screens.

                    – Temani Afif
                    2 hours ago













                  1












                  1








                  1







                  You can add a negative bottom margin to your elements then hide the overflow. This will hide the unwanted borders.






                  .qa 
                  border-bottom: 1px solid #ccc;
                  margin-bottom:-1px;
                  margin-top:1px; /*to rectify the bottom margin, we can also consider padding-bottom*/

                  /*irrelevant styles*/
                  padding: 5px;
                  margin-left:5px;
                  margin-right:5px;
                  box-sizing: border-box;
                  flex:1 1 40%;


                  .wrapper
                  display: flex;
                  flex-wrap: wrap;
                  flex-direction: row;
                  overflow:hidden;

                  <div class="wrapper">
                  <div class="qa">
                  <div>Question</div>
                  <div>Answer<br>Answer</div>
                  </div>
                  <div class="qa">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa">
                  <div>Question</div>
                  <div>Answer<br>Answer</div>
                  </div>
                  <div class="qa">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa">
                  <div>Question</div>
                  <div>Answer<br>Answer</div>
                  </div>
                  </div>





                  This trick should work even if the number of element in a row is different from 2:






                  .qa 
                  border-bottom: 1px solid #ccc;
                  margin-bottom:-1px;
                  margin-top:1px;


                  /*irrelevant styles*/
                  padding: 5px;
                  margin-left:5px;
                  margin-right:5px;
                  box-sizing: border-box;
                  flex:1 1 20%;


                  .wrapper
                  display: flex;
                  flex-wrap: wrap;
                  flex-direction: row;
                  overflow:hidden;

                  <div class="wrapper">
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer<br> answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer<br> answer</div>
                  </div>
                  </div>





                  It will also work with a reponsive layout where the number of columns can change on small screens:






                  .qa 
                  border-bottom: 1px solid #ccc;
                  margin-bottom:-1px;
                  margin-top:1px;


                  /*irrelevant styles*/
                  padding: 5px;
                  margin-left:5px;
                  margin-right:5px;
                  box-sizing: border-box;
                  flex:1 1 20%;


                  .wrapper
                  display: flex;
                  flex-wrap: wrap;
                  flex-direction: row;
                  overflow:hidden;


                  @media all and (max-width:800px)
                  .qa
                  flex:1 1 30%;



                  @media all and (max-width:400px)
                  .qa
                  flex:1 1 40%;


                  <div class="wrapper">
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer<br> answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer<br> answer</div>
                  </div>
                  </div>








                  share|improve this answer















                  You can add a negative bottom margin to your elements then hide the overflow. This will hide the unwanted borders.






                  .qa 
                  border-bottom: 1px solid #ccc;
                  margin-bottom:-1px;
                  margin-top:1px; /*to rectify the bottom margin, we can also consider padding-bottom*/

                  /*irrelevant styles*/
                  padding: 5px;
                  margin-left:5px;
                  margin-right:5px;
                  box-sizing: border-box;
                  flex:1 1 40%;


                  .wrapper
                  display: flex;
                  flex-wrap: wrap;
                  flex-direction: row;
                  overflow:hidden;

                  <div class="wrapper">
                  <div class="qa">
                  <div>Question</div>
                  <div>Answer<br>Answer</div>
                  </div>
                  <div class="qa">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa">
                  <div>Question</div>
                  <div>Answer<br>Answer</div>
                  </div>
                  <div class="qa">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa">
                  <div>Question</div>
                  <div>Answer<br>Answer</div>
                  </div>
                  </div>





                  This trick should work even if the number of element in a row is different from 2:






                  .qa 
                  border-bottom: 1px solid #ccc;
                  margin-bottom:-1px;
                  margin-top:1px;


                  /*irrelevant styles*/
                  padding: 5px;
                  margin-left:5px;
                  margin-right:5px;
                  box-sizing: border-box;
                  flex:1 1 20%;


                  .wrapper
                  display: flex;
                  flex-wrap: wrap;
                  flex-direction: row;
                  overflow:hidden;

                  <div class="wrapper">
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer<br> answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer<br> answer</div>
                  </div>
                  </div>





                  It will also work with a reponsive layout where the number of columns can change on small screens:






                  .qa 
                  border-bottom: 1px solid #ccc;
                  margin-bottom:-1px;
                  margin-top:1px;


                  /*irrelevant styles*/
                  padding: 5px;
                  margin-left:5px;
                  margin-right:5px;
                  box-sizing: border-box;
                  flex:1 1 20%;


                  .wrapper
                  display: flex;
                  flex-wrap: wrap;
                  flex-direction: row;
                  overflow:hidden;


                  @media all and (max-width:800px)
                  .qa
                  flex:1 1 30%;



                  @media all and (max-width:400px)
                  .qa
                  flex:1 1 40%;


                  <div class="wrapper">
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer<br> answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer<br> answer</div>
                  </div>
                  </div>








                  .qa 
                  border-bottom: 1px solid #ccc;
                  margin-bottom:-1px;
                  margin-top:1px; /*to rectify the bottom margin, we can also consider padding-bottom*/

                  /*irrelevant styles*/
                  padding: 5px;
                  margin-left:5px;
                  margin-right:5px;
                  box-sizing: border-box;
                  flex:1 1 40%;


                  .wrapper
                  display: flex;
                  flex-wrap: wrap;
                  flex-direction: row;
                  overflow:hidden;

                  <div class="wrapper">
                  <div class="qa">
                  <div>Question</div>
                  <div>Answer<br>Answer</div>
                  </div>
                  <div class="qa">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa">
                  <div>Question</div>
                  <div>Answer<br>Answer</div>
                  </div>
                  <div class="qa">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa">
                  <div>Question</div>
                  <div>Answer<br>Answer</div>
                  </div>
                  </div>





                  .qa 
                  border-bottom: 1px solid #ccc;
                  margin-bottom:-1px;
                  margin-top:1px; /*to rectify the bottom margin, we can also consider padding-bottom*/

                  /*irrelevant styles*/
                  padding: 5px;
                  margin-left:5px;
                  margin-right:5px;
                  box-sizing: border-box;
                  flex:1 1 40%;


                  .wrapper
                  display: flex;
                  flex-wrap: wrap;
                  flex-direction: row;
                  overflow:hidden;

                  <div class="wrapper">
                  <div class="qa">
                  <div>Question</div>
                  <div>Answer<br>Answer</div>
                  </div>
                  <div class="qa">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa">
                  <div>Question</div>
                  <div>Answer<br>Answer</div>
                  </div>
                  <div class="qa">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa">
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa">
                  <div>Question</div>
                  <div>Answer<br>Answer</div>
                  </div>
                  </div>





                  .qa 
                  border-bottom: 1px solid #ccc;
                  margin-bottom:-1px;
                  margin-top:1px;


                  /*irrelevant styles*/
                  padding: 5px;
                  margin-left:5px;
                  margin-right:5px;
                  box-sizing: border-box;
                  flex:1 1 20%;


                  .wrapper
                  display: flex;
                  flex-wrap: wrap;
                  flex-direction: row;
                  overflow:hidden;

                  <div class="wrapper">
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer<br> answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer<br> answer</div>
                  </div>
                  </div>





                  .qa 
                  border-bottom: 1px solid #ccc;
                  margin-bottom:-1px;
                  margin-top:1px;


                  /*irrelevant styles*/
                  padding: 5px;
                  margin-left:5px;
                  margin-right:5px;
                  box-sizing: border-box;
                  flex:1 1 20%;


                  .wrapper
                  display: flex;
                  flex-wrap: wrap;
                  flex-direction: row;
                  overflow:hidden;

                  <div class="wrapper">
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer<br> answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer<br> answer</div>
                  </div>
                  </div>





                  .qa 
                  border-bottom: 1px solid #ccc;
                  margin-bottom:-1px;
                  margin-top:1px;


                  /*irrelevant styles*/
                  padding: 5px;
                  margin-left:5px;
                  margin-right:5px;
                  box-sizing: border-box;
                  flex:1 1 20%;


                  .wrapper
                  display: flex;
                  flex-wrap: wrap;
                  flex-direction: row;
                  overflow:hidden;


                  @media all and (max-width:800px)
                  .qa
                  flex:1 1 30%;



                  @media all and (max-width:400px)
                  .qa
                  flex:1 1 40%;


                  <div class="wrapper">
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer<br> answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer<br> answer</div>
                  </div>
                  </div>





                  .qa 
                  border-bottom: 1px solid #ccc;
                  margin-bottom:-1px;
                  margin-top:1px;


                  /*irrelevant styles*/
                  padding: 5px;
                  margin-left:5px;
                  margin-right:5px;
                  box-sizing: border-box;
                  flex:1 1 20%;


                  .wrapper
                  display: flex;
                  flex-wrap: wrap;
                  flex-direction: row;
                  overflow:hidden;


                  @media all and (max-width:800px)
                  .qa
                  flex:1 1 30%;



                  @media all and (max-width:400px)
                  .qa
                  flex:1 1 40%;


                  <div class="wrapper">
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer<br> answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer</div>
                  </div>
                  <div class="qa" >
                  <div>Question</div>
                  <div>Answer<br> answer</div>
                  </div>
                  </div>






                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited 2 hours ago

























                  answered 3 hours ago









                  Temani AfifTemani Afif

                  81.8k104793




                  81.8k104793







                  • 1





                    This is great out of the box thinking! and it covers both flex row and columns. That's why I love SO, you get to learn so much! thanks

                    – supersan
                    3 hours ago











                  • @supersan yes exactly ;) it will cover all the different configuration and more important the responsive part as I am sure that your layout will change to one column for example on small screens.

                    – Temani Afif
                    2 hours ago












                  • 1





                    This is great out of the box thinking! and it covers both flex row and columns. That's why I love SO, you get to learn so much! thanks

                    – supersan
                    3 hours ago











                  • @supersan yes exactly ;) it will cover all the different configuration and more important the responsive part as I am sure that your layout will change to one column for example on small screens.

                    – Temani Afif
                    2 hours ago







                  1




                  1





                  This is great out of the box thinking! and it covers both flex row and columns. That's why I love SO, you get to learn so much! thanks

                  – supersan
                  3 hours ago





                  This is great out of the box thinking! and it covers both flex row and columns. That's why I love SO, you get to learn so much! thanks

                  – supersan
                  3 hours ago













                  @supersan yes exactly ;) it will cover all the different configuration and more important the responsive part as I am sure that your layout will change to one column for example on small screens.

                  – Temani Afif
                  2 hours ago





                  @supersan yes exactly ;) it will cover all the different configuration and more important the responsive part as I am sure that your layout will change to one column for example on small screens.

                  – Temani Afif
                  2 hours ago











                  0














                  If you can add a :after pseudo Element in parent container of .qa (make sure your parent container is set to position: relative; or position: absolute;)



                  Css for .qa parent element




                  content: "";
                  position: relative;
                  bottom: 0;
                  left:0;
                  right:0;
                  height: /* set this to your (bottom padding of container + bottom margin of .qa box + border width) */
                  background: #fff; /* match this with your parent element background colour*/






                  share|improve this answer





























                    0














                    If you can add a :after pseudo Element in parent container of .qa (make sure your parent container is set to position: relative; or position: absolute;)



                    Css for .qa parent element




                    content: "";
                    position: relative;
                    bottom: 0;
                    left:0;
                    right:0;
                    height: /* set this to your (bottom padding of container + bottom margin of .qa box + border width) */
                    background: #fff; /* match this with your parent element background colour*/






                    share|improve this answer



























                      0












                      0








                      0







                      If you can add a :after pseudo Element in parent container of .qa (make sure your parent container is set to position: relative; or position: absolute;)



                      Css for .qa parent element




                      content: "";
                      position: relative;
                      bottom: 0;
                      left:0;
                      right:0;
                      height: /* set this to your (bottom padding of container + bottom margin of .qa box + border width) */
                      background: #fff; /* match this with your parent element background colour*/






                      share|improve this answer















                      If you can add a :after pseudo Element in parent container of .qa (make sure your parent container is set to position: relative; or position: absolute;)



                      Css for .qa parent element




                      content: "";
                      position: relative;
                      bottom: 0;
                      left:0;
                      right:0;
                      height: /* set this to your (bottom padding of container + bottom margin of .qa box + border width) */
                      background: #fff; /* match this with your parent element background colour*/







                      share|improve this answer














                      share|improve this answer



                      share|improve this answer








                      edited 3 hours ago

























                      answered 4 hours ago









                      vaibhav kumarvaibhav kumar

                      295




                      295





















                          0














                          You could use border-top and remove the first two with the :nth-child CSS selector. Like this:






                          .qa 
                          border-top: 1px solid #ccc;


                          .qa:nth-child(-n+2)
                          border-top: none;

                          <div style="display: flex; flex-wrap: wrap; flex-direction: row">
                          <div class="qa" style="width:50%;">
                          <div>Question</div>
                          <div>Answer</div>
                          </div>
                          <div class="qa" style="width:50%;">
                          <div>Question</div>
                          <div>Answer</div>
                          </div>
                          <div class="qa" style="width:50%;">
                          <div>Question</div>
                          <div>Answer</div>
                          </div>
                          <div class="qa" style="width:50%;">
                          <div>Question</div>
                          <div>Answer</div>
                          </div>
                          <div class="qa" style="width:50%;">
                          <div>Question</div>
                          <div>Answer</div>
                          </div>
                          <div class="qa" style="width:50%;">
                          <div>Question</div>
                          <div>Answer</div>
                          </div>
                          <div class="qa" style="width:50%;">
                          <div>Question</div>
                          <div>Answer</div>
                          </div>
                          <div class="qa" style="width:50%;">
                          <div>Question</div>
                          <div>Answer</div>
                          </div>
                          <div class="qa" style="width:50%;">
                          <div>Question</div>
                          <div>Answer</div>
                          </div>
                          <div class="qa" style="width:50%;">
                          <div>Question</div>
                          <div>Answer</div>
                          </div>
                          </div>








                          share|improve this answer



























                            0














                            You could use border-top and remove the first two with the :nth-child CSS selector. Like this:






                            .qa 
                            border-top: 1px solid #ccc;


                            .qa:nth-child(-n+2)
                            border-top: none;

                            <div style="display: flex; flex-wrap: wrap; flex-direction: row">
                            <div class="qa" style="width:50%;">
                            <div>Question</div>
                            <div>Answer</div>
                            </div>
                            <div class="qa" style="width:50%;">
                            <div>Question</div>
                            <div>Answer</div>
                            </div>
                            <div class="qa" style="width:50%;">
                            <div>Question</div>
                            <div>Answer</div>
                            </div>
                            <div class="qa" style="width:50%;">
                            <div>Question</div>
                            <div>Answer</div>
                            </div>
                            <div class="qa" style="width:50%;">
                            <div>Question</div>
                            <div>Answer</div>
                            </div>
                            <div class="qa" style="width:50%;">
                            <div>Question</div>
                            <div>Answer</div>
                            </div>
                            <div class="qa" style="width:50%;">
                            <div>Question</div>
                            <div>Answer</div>
                            </div>
                            <div class="qa" style="width:50%;">
                            <div>Question</div>
                            <div>Answer</div>
                            </div>
                            <div class="qa" style="width:50%;">
                            <div>Question</div>
                            <div>Answer</div>
                            </div>
                            <div class="qa" style="width:50%;">
                            <div>Question</div>
                            <div>Answer</div>
                            </div>
                            </div>








                            share|improve this answer

























                              0












                              0








                              0







                              You could use border-top and remove the first two with the :nth-child CSS selector. Like this:






                              .qa 
                              border-top: 1px solid #ccc;


                              .qa:nth-child(-n+2)
                              border-top: none;

                              <div style="display: flex; flex-wrap: wrap; flex-direction: row">
                              <div class="qa" style="width:50%;">
                              <div>Question</div>
                              <div>Answer</div>
                              </div>
                              <div class="qa" style="width:50%;">
                              <div>Question</div>
                              <div>Answer</div>
                              </div>
                              <div class="qa" style="width:50%;">
                              <div>Question</div>
                              <div>Answer</div>
                              </div>
                              <div class="qa" style="width:50%;">
                              <div>Question</div>
                              <div>Answer</div>
                              </div>
                              <div class="qa" style="width:50%;">
                              <div>Question</div>
                              <div>Answer</div>
                              </div>
                              <div class="qa" style="width:50%;">
                              <div>Question</div>
                              <div>Answer</div>
                              </div>
                              <div class="qa" style="width:50%;">
                              <div>Question</div>
                              <div>Answer</div>
                              </div>
                              <div class="qa" style="width:50%;">
                              <div>Question</div>
                              <div>Answer</div>
                              </div>
                              <div class="qa" style="width:50%;">
                              <div>Question</div>
                              <div>Answer</div>
                              </div>
                              <div class="qa" style="width:50%;">
                              <div>Question</div>
                              <div>Answer</div>
                              </div>
                              </div>








                              share|improve this answer













                              You could use border-top and remove the first two with the :nth-child CSS selector. Like this:






                              .qa 
                              border-top: 1px solid #ccc;


                              .qa:nth-child(-n+2)
                              border-top: none;

                              <div style="display: flex; flex-wrap: wrap; flex-direction: row">
                              <div class="qa" style="width:50%;">
                              <div>Question</div>
                              <div>Answer</div>
                              </div>
                              <div class="qa" style="width:50%;">
                              <div>Question</div>
                              <div>Answer</div>
                              </div>
                              <div class="qa" style="width:50%;">
                              <div>Question</div>
                              <div>Answer</div>
                              </div>
                              <div class="qa" style="width:50%;">
                              <div>Question</div>
                              <div>Answer</div>
                              </div>
                              <div class="qa" style="width:50%;">
                              <div>Question</div>
                              <div>Answer</div>
                              </div>
                              <div class="qa" style="width:50%;">
                              <div>Question</div>
                              <div>Answer</div>
                              </div>
                              <div class="qa" style="width:50%;">
                              <div>Question</div>
                              <div>Answer</div>
                              </div>
                              <div class="qa" style="width:50%;">
                              <div>Question</div>
                              <div>Answer</div>
                              </div>
                              <div class="qa" style="width:50%;">
                              <div>Question</div>
                              <div>Answer</div>
                              </div>
                              <div class="qa" style="width:50%;">
                              <div>Question</div>
                              <div>Answer</div>
                              </div>
                              </div>








                              .qa 
                              border-top: 1px solid #ccc;


                              .qa:nth-child(-n+2)
                              border-top: none;

                              <div style="display: flex; flex-wrap: wrap; flex-direction: row">
                              <div class="qa" style="width:50%;">
                              <div>Question</div>
                              <div>Answer</div>
                              </div>
                              <div class="qa" style="width:50%;">
                              <div>Question</div>
                              <div>Answer</div>
                              </div>
                              <div class="qa" style="width:50%;">
                              <div>Question</div>
                              <div>Answer</div>
                              </div>
                              <div class="qa" style="width:50%;">
                              <div>Question</div>
                              <div>Answer</div>
                              </div>
                              <div class="qa" style="width:50%;">
                              <div>Question</div>
                              <div>Answer</div>
                              </div>
                              <div class="qa" style="width:50%;">
                              <div>Question</div>
                              <div>Answer</div>
                              </div>
                              <div class="qa" style="width:50%;">
                              <div>Question</div>
                              <div>Answer</div>
                              </div>
                              <div class="qa" style="width:50%;">
                              <div>Question</div>
                              <div>Answer</div>
                              </div>
                              <div class="qa" style="width:50%;">
                              <div>Question</div>
                              <div>Answer</div>
                              </div>
                              <div class="qa" style="width:50%;">
                              <div>Question</div>
                              <div>Answer</div>
                              </div>
                              </div>





                              .qa 
                              border-top: 1px solid #ccc;


                              .qa:nth-child(-n+2)
                              border-top: none;

                              <div style="display: flex; flex-wrap: wrap; flex-direction: row">
                              <div class="qa" style="width:50%;">
                              <div>Question</div>
                              <div>Answer</div>
                              </div>
                              <div class="qa" style="width:50%;">
                              <div>Question</div>
                              <div>Answer</div>
                              </div>
                              <div class="qa" style="width:50%;">
                              <div>Question</div>
                              <div>Answer</div>
                              </div>
                              <div class="qa" style="width:50%;">
                              <div>Question</div>
                              <div>Answer</div>
                              </div>
                              <div class="qa" style="width:50%;">
                              <div>Question</div>
                              <div>Answer</div>
                              </div>
                              <div class="qa" style="width:50%;">
                              <div>Question</div>
                              <div>Answer</div>
                              </div>
                              <div class="qa" style="width:50%;">
                              <div>Question</div>
                              <div>Answer</div>
                              </div>
                              <div class="qa" style="width:50%;">
                              <div>Question</div>
                              <div>Answer</div>
                              </div>
                              <div class="qa" style="width:50%;">
                              <div>Question</div>
                              <div>Answer</div>
                              </div>
                              <div class="qa" style="width:50%;">
                              <div>Question</div>
                              <div>Answer</div>
                              </div>
                              </div>






                              share|improve this answer












                              share|improve this answer



                              share|improve this answer










                              answered 3 hours ago









                              aridlehooveraridlehoover

                              1,8041615




                              1,8041615





















                                  0














                                  I don't like adding a rule when you know you're immediately going to overwrite it, so here's a slightly different version of aridlehoover's answer with only one CSS rule.






                                  .qa:not(:nth-child(-n+2)) 
                                  border-top: 1px solid #ccc;

                                  <div style="display: flex; flex-wrap: wrap; flex-direction: row">
                                  <div class="qa" style="width:50%;">
                                  <div>Question</div>
                                  <div>Answer</div>
                                  </div>
                                  <div class="qa" style="width:50%;">
                                  <div>Question</div>
                                  <div>Answer</div>
                                  </div>
                                  <div class="qa" style="width:50%;">
                                  <div>Question</div>
                                  <div>Answer</div>
                                  </div>
                                  <div class="qa" style="width:50%;">
                                  <div>Question</div>
                                  <div>Answer</div>
                                  </div>
                                  <div class="qa" style="width:50%;">
                                  <div>Question</div>
                                  <div>Answer</div>
                                  </div>
                                  <div class="qa" style="width:50%;">
                                  <div>Question</div>
                                  <div>Answer</div>
                                  </div>
                                  <div class="qa" style="width:50%;">
                                  <div>Question</div>
                                  <div>Answer</div>
                                  </div>
                                  <div class="qa" style="width:50%;">
                                  <div>Question</div>
                                  <div>Answer</div>
                                  </div>
                                  <div class="qa" style="width:50%;">
                                  <div>Question</div>
                                  <div>Answer</div>
                                  </div>
                                  <div class="qa" style="width:50%;">
                                  <div>Question</div>
                                  <div>Answer</div>
                                  </div>
                                  </div>








                                  share|improve this answer



























                                    0














                                    I don't like adding a rule when you know you're immediately going to overwrite it, so here's a slightly different version of aridlehoover's answer with only one CSS rule.






                                    .qa:not(:nth-child(-n+2)) 
                                    border-top: 1px solid #ccc;

                                    <div style="display: flex; flex-wrap: wrap; flex-direction: row">
                                    <div class="qa" style="width:50%;">
                                    <div>Question</div>
                                    <div>Answer</div>
                                    </div>
                                    <div class="qa" style="width:50%;">
                                    <div>Question</div>
                                    <div>Answer</div>
                                    </div>
                                    <div class="qa" style="width:50%;">
                                    <div>Question</div>
                                    <div>Answer</div>
                                    </div>
                                    <div class="qa" style="width:50%;">
                                    <div>Question</div>
                                    <div>Answer</div>
                                    </div>
                                    <div class="qa" style="width:50%;">
                                    <div>Question</div>
                                    <div>Answer</div>
                                    </div>
                                    <div class="qa" style="width:50%;">
                                    <div>Question</div>
                                    <div>Answer</div>
                                    </div>
                                    <div class="qa" style="width:50%;">
                                    <div>Question</div>
                                    <div>Answer</div>
                                    </div>
                                    <div class="qa" style="width:50%;">
                                    <div>Question</div>
                                    <div>Answer</div>
                                    </div>
                                    <div class="qa" style="width:50%;">
                                    <div>Question</div>
                                    <div>Answer</div>
                                    </div>
                                    <div class="qa" style="width:50%;">
                                    <div>Question</div>
                                    <div>Answer</div>
                                    </div>
                                    </div>








                                    share|improve this answer

























                                      0












                                      0








                                      0







                                      I don't like adding a rule when you know you're immediately going to overwrite it, so here's a slightly different version of aridlehoover's answer with only one CSS rule.






                                      .qa:not(:nth-child(-n+2)) 
                                      border-top: 1px solid #ccc;

                                      <div style="display: flex; flex-wrap: wrap; flex-direction: row">
                                      <div class="qa" style="width:50%;">
                                      <div>Question</div>
                                      <div>Answer</div>
                                      </div>
                                      <div class="qa" style="width:50%;">
                                      <div>Question</div>
                                      <div>Answer</div>
                                      </div>
                                      <div class="qa" style="width:50%;">
                                      <div>Question</div>
                                      <div>Answer</div>
                                      </div>
                                      <div class="qa" style="width:50%;">
                                      <div>Question</div>
                                      <div>Answer</div>
                                      </div>
                                      <div class="qa" style="width:50%;">
                                      <div>Question</div>
                                      <div>Answer</div>
                                      </div>
                                      <div class="qa" style="width:50%;">
                                      <div>Question</div>
                                      <div>Answer</div>
                                      </div>
                                      <div class="qa" style="width:50%;">
                                      <div>Question</div>
                                      <div>Answer</div>
                                      </div>
                                      <div class="qa" style="width:50%;">
                                      <div>Question</div>
                                      <div>Answer</div>
                                      </div>
                                      <div class="qa" style="width:50%;">
                                      <div>Question</div>
                                      <div>Answer</div>
                                      </div>
                                      <div class="qa" style="width:50%;">
                                      <div>Question</div>
                                      <div>Answer</div>
                                      </div>
                                      </div>








                                      share|improve this answer













                                      I don't like adding a rule when you know you're immediately going to overwrite it, so here's a slightly different version of aridlehoover's answer with only one CSS rule.






                                      .qa:not(:nth-child(-n+2)) 
                                      border-top: 1px solid #ccc;

                                      <div style="display: flex; flex-wrap: wrap; flex-direction: row">
                                      <div class="qa" style="width:50%;">
                                      <div>Question</div>
                                      <div>Answer</div>
                                      </div>
                                      <div class="qa" style="width:50%;">
                                      <div>Question</div>
                                      <div>Answer</div>
                                      </div>
                                      <div class="qa" style="width:50%;">
                                      <div>Question</div>
                                      <div>Answer</div>
                                      </div>
                                      <div class="qa" style="width:50%;">
                                      <div>Question</div>
                                      <div>Answer</div>
                                      </div>
                                      <div class="qa" style="width:50%;">
                                      <div>Question</div>
                                      <div>Answer</div>
                                      </div>
                                      <div class="qa" style="width:50%;">
                                      <div>Question</div>
                                      <div>Answer</div>
                                      </div>
                                      <div class="qa" style="width:50%;">
                                      <div>Question</div>
                                      <div>Answer</div>
                                      </div>
                                      <div class="qa" style="width:50%;">
                                      <div>Question</div>
                                      <div>Answer</div>
                                      </div>
                                      <div class="qa" style="width:50%;">
                                      <div>Question</div>
                                      <div>Answer</div>
                                      </div>
                                      <div class="qa" style="width:50%;">
                                      <div>Question</div>
                                      <div>Answer</div>
                                      </div>
                                      </div>








                                      .qa:not(:nth-child(-n+2)) 
                                      border-top: 1px solid #ccc;

                                      <div style="display: flex; flex-wrap: wrap; flex-direction: row">
                                      <div class="qa" style="width:50%;">
                                      <div>Question</div>
                                      <div>Answer</div>
                                      </div>
                                      <div class="qa" style="width:50%;">
                                      <div>Question</div>
                                      <div>Answer</div>
                                      </div>
                                      <div class="qa" style="width:50%;">
                                      <div>Question</div>
                                      <div>Answer</div>
                                      </div>
                                      <div class="qa" style="width:50%;">
                                      <div>Question</div>
                                      <div>Answer</div>
                                      </div>
                                      <div class="qa" style="width:50%;">
                                      <div>Question</div>
                                      <div>Answer</div>
                                      </div>
                                      <div class="qa" style="width:50%;">
                                      <div>Question</div>
                                      <div>Answer</div>
                                      </div>
                                      <div class="qa" style="width:50%;">
                                      <div>Question</div>
                                      <div>Answer</div>
                                      </div>
                                      <div class="qa" style="width:50%;">
                                      <div>Question</div>
                                      <div>Answer</div>
                                      </div>
                                      <div class="qa" style="width:50%;">
                                      <div>Question</div>
                                      <div>Answer</div>
                                      </div>
                                      <div class="qa" style="width:50%;">
                                      <div>Question</div>
                                      <div>Answer</div>
                                      </div>
                                      </div>





                                      .qa:not(:nth-child(-n+2)) 
                                      border-top: 1px solid #ccc;

                                      <div style="display: flex; flex-wrap: wrap; flex-direction: row">
                                      <div class="qa" style="width:50%;">
                                      <div>Question</div>
                                      <div>Answer</div>
                                      </div>
                                      <div class="qa" style="width:50%;">
                                      <div>Question</div>
                                      <div>Answer</div>
                                      </div>
                                      <div class="qa" style="width:50%;">
                                      <div>Question</div>
                                      <div>Answer</div>
                                      </div>
                                      <div class="qa" style="width:50%;">
                                      <div>Question</div>
                                      <div>Answer</div>
                                      </div>
                                      <div class="qa" style="width:50%;">
                                      <div>Question</div>
                                      <div>Answer</div>
                                      </div>
                                      <div class="qa" style="width:50%;">
                                      <div>Question</div>
                                      <div>Answer</div>
                                      </div>
                                      <div class="qa" style="width:50%;">
                                      <div>Question</div>
                                      <div>Answer</div>
                                      </div>
                                      <div class="qa" style="width:50%;">
                                      <div>Question</div>
                                      <div>Answer</div>
                                      </div>
                                      <div class="qa" style="width:50%;">
                                      <div>Question</div>
                                      <div>Answer</div>
                                      </div>
                                      <div class="qa" style="width:50%;">
                                      <div>Question</div>
                                      <div>Answer</div>
                                      </div>
                                      </div>






                                      share|improve this answer












                                      share|improve this answer



                                      share|improve this answer










                                      answered 2 hours ago









                                      GeatGeat

                                      208110




                                      208110



























                                          draft saved

                                          draft discarded
















































                                          Thanks for contributing an answer to Stack Overflow!


                                          • Please be sure to answer the question. Provide details and share your research!

                                          But avoid


                                          • Asking for help, clarification, or responding to other answers.

                                          • Making statements based on opinion; back them up with references or personal experience.

                                          To learn more, see our tips on writing great answers.




                                          draft saved


                                          draft discarded














                                          StackExchange.ready(
                                          function ()
                                          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55480980%2fhow-to-remove-border-from-elements-in-the-last-row%23new-answer', 'question_page');

                                          );

                                          Post as a guest















                                          Required, but never shown





















































                                          Required, but never shown














                                          Required, but never shown












                                          Required, but never shown







                                          Required, but never shown

































                                          Required, but never shown














                                          Required, but never shown












                                          Required, but never shown







                                          Required, but never shown







                                          Popular posts from this blog

                                          Францішак Багушэвіч Змест Сям'я | Біяграфія | Творчасць | Мова Багушэвіча | Ацэнкі дзейнасці | Цікавыя факты | Спадчына | Выбраная бібліяграфія | Ушанаванне памяці | У філатэліі | Зноскі | Літаратура | Спасылкі | НавігацыяЛяхоўскі У. Рупіўся дзеля Бога і людзей: Жыццёвы шлях Лявона Вітан-Дубейкаўскага // Вольскі і Памідораў з песняй пра немца Адвакат, паэт, народны заступнік Ашмянскі веснікВ Минске появится площадь Богушевича и улица Сырокомли, Белорусская деловая газета, 19 июля 2001 г.Айцец беларускай нацыянальнай ідэі паўстаў у бронзе Сяргей Аляксандравіч Адашкевіч (1918, Мінск). 80-я гады. Бюст «Францішак Багушэвіч».Яўген Мікалаевіч Ціхановіч. «Партрэт Францішка Багушэвіча»Мікола Мікалаевіч Купава. «Партрэт зачынальніка новай беларускай літаратуры Францішка Багушэвіча»Уладзімір Іванавіч Мелехаў. На помніку «Змагарам за родную мову» Барэльеф «Францішак Багушэвіч»Памяць пра Багушэвіча на Віленшчыне Страчаная сталіца. Беларускія шыльды на вуліцах Вільні«Krynica». Ideologia i przywódcy białoruskiego katolicyzmuФранцішак БагушэвічТворы на knihi.comТворы Францішка Багушэвіча на bellib.byСодаль Уладзімір. Францішак Багушэвіч на Лідчыне;Луцкевіч Антон. Жыцьцё і творчасьць Фр. Багушэвіча ў успамінах ягоных сучасьнікаў // Запісы Беларускага Навуковага таварыства. Вільня, 1938. Сшытак 1. С. 16-34.Большая российская1188761710000 0000 5537 633Xn9209310021619551927869394п

                                          Беларусь Змест Назва Гісторыя Геаграфія Сімволіка Дзяржаўны лад Палітычныя партыі Міжнароднае становішча і знешняя палітыка Адміністрацыйны падзел Насельніцтва Эканоміка Культура і грамадства Сацыяльная сфера Узброеныя сілы Заўвагі Літаратура Спасылкі НавігацыяHGЯOiТоп-2011 г. (па версіі ej.by)Топ-2013 г. (па версіі ej.by)Топ-2016 г. (па версіі ej.by)Топ-2017 г. (па версіі ej.by)Нацыянальны статыстычны камітэт Рэспублікі БеларусьШчыльнасць насельніцтва па краінахhttp://naviny.by/rubrics/society/2011/09/16/ic_articles_116_175144/А. Калечыц, У. Ксяндзоў. Спробы засялення краю неандэртальскім чалавекам.І ў Менску былі мамантыА. Калечыц, У. Ксяндзоў. Старажытны каменны век (палеаліт). Першапачатковае засяленне тэрыторыіГ. Штыхаў. Балты і славяне ў VI—VIII стст.М. Клімаў. Полацкае княства ў IX—XI стст.Г. Штыхаў, В. Ляўко. Палітычная гісторыя Полацкай зямліГ. Штыхаў. Дзяржаўны лад у землях-княствахГ. Штыхаў. Дзяржаўны лад у землях-княствахБеларускія землі ў складзе Вялікага Княства ЛітоўскагаЛюблінская унія 1569 г."The Early Stages of Independence"Zapomniane prawdy25 гадоў таму было аб'яўлена, што Язэп Пілсудскі — беларус (фота)Наша вадаДакументы ЧАЭС: Забруджванне тэрыторыі Беларусі « ЧАЭС Зона адчужэнняСведения о политических партиях, зарегистрированных в Республике Беларусь // Министерство юстиции Республики БеларусьСтатыстычны бюлетэнь „Полаўзроставая структура насельніцтва Рэспублікі Беларусь на 1 студзеня 2012 года і сярэднегадовая колькасць насельніцтва за 2011 год“Индекс человеческого развития Беларуси — не было бы нижеБеларусь занимает первое место в СНГ по индексу развития с учетом гендерного факцёраНацыянальны статыстычны камітэт Рэспублікі БеларусьКанстытуцыя РБ. Артыкул 17Трансфармацыйныя задачы БеларусіВыйсце з крызісу — далейшае рэфармаванне Беларускі рубель — сусветны лідар па дэвальвацыяхПра змену коштаў у кастрычніку 2011 г.Бядней за беларусаў у СНД толькі таджыкіСярэдні заробак у верасні дасягнуў 2,26 мільёна рублёўЭканомікаГаласуем за ТОП-100 беларускай прозыСучасныя беларускія мастакіАрхитектура Беларуси BELARUS.BYА. Каханоўскі. Культура Беларусі ўсярэдзіне XVII—XVIII ст.Анталогія беларускай народнай песні, гуказапісы спеваўБеларускія Музычныя IнструментыБеларускі рок, які мы страцілі. Топ-10 гуртоў«Мясцовы час» — нязгаслая легенда беларускай рок-музыкіСЯРГЕЙ БУДКІН. МЫ НЯ ЗНАЕМ СВАЁЙ МУЗЫКІМ. А. Каладзінскі. НАРОДНЫ ТЭАТРМагнацкія культурныя цэнтрыПублічная дыскусія «Беларуская новая пьеса: без беларускай мовы ці беларуская?»Беларускія драматургі па-ранейшаму лепш ставяцца за мяжой, чым на радзіме«Працэс незалежнага кіно пайшоў, і дзяржаву турбуе яго непадкантрольнасць»Беларускія філосафы ў пошуках прасторыВсе идём в библиотекуАрхіваванаАб Нацыянальнай праграме даследавання і выкарыстання касмічнай прасторы ў мірных мэтах на 2008—2012 гадыУ космас — разам.У суседнім з Барысаўскім раёне пабудуюць Камандна-вымяральны пунктСвяты і абрады беларусаў«Мірныя бульбашы з малой краіны» — 5 непраўдзівых стэрэатыпаў пра БеларусьМ. Раманюк. Беларускае народнае адзеннеУ Беларусі скарачаецца колькасць злачынстваўЛукашэнка незадаволены мінскімі ўладамі Крадзяжы складаюць у Мінску каля 70% злачынстваў Узровень злачыннасці ў Мінскай вобласці — адзін з самых высокіх у краіне Генпракуратура аналізуе стан са злачыннасцю ў Беларусі па каэфіцыенце злачыннасці У Беларусі стабілізавалася крымінагеннае становішча, лічыць генпракурорЗамежнікі сталі здзяйсняць у Беларусі больш злачынстваўМУС Беларусі турбуе рост рэцыдыўнай злачыннасціЯ з ЖЭСа. Дазволіце вас абкрасці! Рэйтынг усіх службаў і падраздзяленняў ГУУС Мінгарвыканкама вырасАб КДБ РБГісторыя Аператыўна-аналітычнага цэнтра РБГісторыя ДКФРТаможняagentura.ruБеларусьBelarus.by — Афіцыйны сайт Рэспублікі БеларусьСайт урада БеларусіRadzima.org — Збор архітэктурных помнікаў, гісторыя Беларусі«Глобус Беларуси»Гербы и флаги БеларусиАсаблівасці каменнага веку на БеларусіА. Калечыц, У. Ксяндзоў. Старажытны каменны век (палеаліт). Першапачатковае засяленне тэрыторыіУ. Ксяндзоў. Сярэдні каменны век (мезаліт). Засяленне краю плямёнамі паляўнічых, рыбакоў і збіральнікаўА. Калечыц, М. Чарняўскі. Плямёны на тэрыторыі Беларусі ў новым каменным веку (неаліце)А. Калечыц, У. Ксяндзоў, М. Чарняўскі. Гаспадарчыя заняткі ў каменным векуЭ. Зайкоўскі. Духоўная культура ў каменным векуАсаблівасці бронзавага веку на БеларусіФарміраванне супольнасцей ранняга перыяду бронзавага векуФотографии БеларусиРоля беларускіх зямель ва ўтварэнні і ўмацаванні ВКЛВ. Фадзеева. З гісторыі развіцця беларускай народнай вышыўкіDMOZGran catalanaБольшая российскаяBritannica (анлайн)Швейцарскі гістарычны15325917611952699xDA123282154079143-90000 0001 2171 2080n9112870100577502ge128882171858027501086026362074122714179пппппп

                                          ValueError: Expected n_neighbors <= n_samples, but n_samples = 1, n_neighbors = 6 (SMOTE) The 2019 Stack Overflow Developer Survey Results Are InCan SMOTE be applied over sequence of words (sentences)?ValueError when doing validation with random forestsSMOTE and multi class oversamplingLogic behind SMOTE-NC?ValueError: Error when checking target: expected dense_1 to have shape (7,) but got array with shape (1,)SmoteBoost: Should SMOTE be ran individually for each iteration/tree in the boosting?solving multi-class imbalance classification using smote and OSSUsing SMOTE for Synthetic Data generation to improve performance on unbalanced dataproblem of entry format for a simple model in KerasSVM SMOTE fit_resample() function runs forever with no result