How to remove border from elements in the last row?Targeting flex items on the last or specific 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

Replacing matching entries in one column of a file by another column from a different file

Horror movie about a virus at the prom; beginning and end are stylized as a cartoon

Approximately how much travel time was saved by the opening of the Suez Canal in 1869?

Important Resources for Dark Age Civilizations?

Arrow those variables!

Modeling an IP Address

Why doesn't Newton's third law mean a person bounces back to where they started when they hit the ground?

Why does Kotter return in Welcome Back Kotter?

Convert two switches to a dual stack, and add outlet - possible here?

Is it unprofessional to ask if a job posting on GlassDoor is real?

"You are your self first supporter", a more proper way to say it

How does one intimidate enemies without having the capacity for violence?

Can I make popcorn with any corn?

Languages that we cannot (dis)prove to be Context-Free

Alternative to sending password over mail?

How is the claim "I am in New York only if I am in America" the same as "If I am in New York, then I am in America?

Does object always see its latest internal state irrespective of thread?

NMaximize is not converging to a solution

Perform and show arithmetic with LuaLaTeX

Unable to deploy metadata from Partner Developer scratch org because of extra fields

How to move a thin line with the black arrow in Illustrator?

How do I deal with an unproductive colleague in a small company?

Is it legal for company to use my work email to pretend I still work there?

Do I have a twin with permutated remainders?



How to remove border from elements in the last row?


Targeting flex items on the last or specific 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






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








12















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
    Apr 2 at 18:05











  • 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
    Apr 2 at 18:09






  • 5





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

    – bea
    Apr 2 at 18:28






  • 2





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

    – enxaneta
    Apr 2 at 18:55

















12















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
    Apr 2 at 18:05











  • 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
    Apr 2 at 18:09






  • 5





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

    – bea
    Apr 2 at 18:28






  • 2





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

    – enxaneta
    Apr 2 at 18:55













12












12








12


1






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 Apr 2 at 21:16









Michael_B

158k50255363




158k50255363










asked Apr 2 at 18:01









supersansupersan

1,8121838




1,8121838












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

    – Funk Doc
    Apr 2 at 18:05











  • 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
    Apr 2 at 18:09






  • 5





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

    – bea
    Apr 2 at 18:28






  • 2





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

    – enxaneta
    Apr 2 at 18:55

















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

    – Funk Doc
    Apr 2 at 18:05











  • 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
    Apr 2 at 18:09






  • 5





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

    – bea
    Apr 2 at 18:28






  • 2





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

    – enxaneta
    Apr 2 at 18:55
















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

– Funk Doc
Apr 2 at 18:05





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

– Funk Doc
Apr 2 at 18:05













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
Apr 2 at 18:09





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
Apr 2 at 18:09




5




5





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

– bea
Apr 2 at 18:28





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

– bea
Apr 2 at 18:28




2




2





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

– enxaneta
Apr 2 at 18:55





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

– enxaneta
Apr 2 at 18:55












7 Answers
7






active

oldest

votes


















6














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
    Apr 2 at 19:40











  • Yes, good catch Temani! Thanks

    – KhaledMohamedP
    Apr 2 at 19:42











  • 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
    Apr 2 at 19:48


















5














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
    Apr 2 at 19:55











  • @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
    Apr 2 at 20:19


















4














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
    Apr 2 at 19:06











  • @Raz0rwire, what don't you understand?

    – Michael_B
    Apr 2 at 19:07











  • @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
    Apr 2 at 19:11


















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














    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














      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














        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









          6














          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
            Apr 2 at 19:40











          • Yes, good catch Temani! Thanks

            – KhaledMohamedP
            Apr 2 at 19:42











          • 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
            Apr 2 at 19:48















          6














          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
            Apr 2 at 19:40











          • Yes, good catch Temani! Thanks

            – KhaledMohamedP
            Apr 2 at 19:42











          • 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
            Apr 2 at 19:48













          6












          6








          6







          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 Apr 2 at 19:39









          Temani Afif

          82.2k104794




          82.2k104794










          answered Apr 2 at 19:34









          KhaledMohamedPKhaledMohamedP

          2,32021720




          2,32021720












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

            – Temani Afif
            Apr 2 at 19:40











          • Yes, good catch Temani! Thanks

            – KhaledMohamedP
            Apr 2 at 19:42











          • 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
            Apr 2 at 19:48

















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

            – Temani Afif
            Apr 2 at 19:40











          • Yes, good catch Temani! Thanks

            – KhaledMohamedP
            Apr 2 at 19:42











          • 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
            Apr 2 at 19:48
















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

          – Temani Afif
          Apr 2 at 19:40





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

          – Temani Afif
          Apr 2 at 19:40













          Yes, good catch Temani! Thanks

          – KhaledMohamedP
          Apr 2 at 19:42





          Yes, good catch Temani! Thanks

          – KhaledMohamedP
          Apr 2 at 19:42













          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
          Apr 2 at 19:48





          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
          Apr 2 at 19:48













          5














          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
            Apr 2 at 19:55











          • @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
            Apr 2 at 20:19















          5














          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
            Apr 2 at 19:55











          • @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
            Apr 2 at 20:19













          5












          5








          5







          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 Apr 2 at 20:21

























          answered Apr 2 at 19:15









          Temani AfifTemani Afif

          82.2k104794




          82.2k104794







          • 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
            Apr 2 at 19:55











          • @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
            Apr 2 at 20:19












          • 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
            Apr 2 at 19:55











          • @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
            Apr 2 at 20:19







          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
          Apr 2 at 19:55





          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
          Apr 2 at 19:55













          @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
          Apr 2 at 20:19





          @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
          Apr 2 at 20:19











          4














          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
            Apr 2 at 19:06











          • @Raz0rwire, what don't you understand?

            – Michael_B
            Apr 2 at 19:07











          • @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
            Apr 2 at 19:11















          4














          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
            Apr 2 at 19:06











          • @Raz0rwire, what don't you understand?

            – Michael_B
            Apr 2 at 19:07











          • @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
            Apr 2 at 19:11













          4












          4








          4







          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 Apr 2 at 19:02

























          answered Apr 2 at 18:47









          Michael_BMichael_B

          158k50255363




          158k50255363












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

            – Raz0rwire
            Apr 2 at 19:06











          • @Raz0rwire, what don't you understand?

            – Michael_B
            Apr 2 at 19:07











          • @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
            Apr 2 at 19:11

















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

            – Raz0rwire
            Apr 2 at 19:06











          • @Raz0rwire, what don't you understand?

            – Michael_B
            Apr 2 at 19:07











          • @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
            Apr 2 at 19:11
















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

          – Raz0rwire
          Apr 2 at 19:06





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

          – Raz0rwire
          Apr 2 at 19:06













          @Raz0rwire, what don't you understand?

          – Michael_B
          Apr 2 at 19:07





          @Raz0rwire, what don't you understand?

          – Michael_B
          Apr 2 at 19:07













          @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
          Apr 2 at 19:11





          @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
          Apr 2 at 19:11











          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 Apr 2 at 19:43









              zhirzhzhirzh

              1,7101723




              1,7101723





















                  1














                  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



























                    1














                    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

























                      1












                      1








                      1







                      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 Apr 2 at 19:45









                      aridlehooveraridlehoover

                      1,8291615




                      1,8291615





















                          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 Apr 2 at 19:27

























                              answered Apr 2 at 18:47









                              vaibhav kumarvaibhav kumar

                              475




                              475





















                                  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 Apr 2 at 21:05









                                      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

                                          Club Baloncesto Breogán Índice Historia | Pavillón | Nome | O Breogán na cultura popular | Xogadores | Adestradores | Presidentes | Palmarés | Historial | Líderes | Notas | Véxase tamén | Menú de navegacióncbbreogan.galCadroGuía oficial da ACB 2009-10, páxina 201Guía oficial ACB 1992, páxina 183. Editorial DB.É de 6.500 espectadores sentados axeitándose á última normativa"Estudiantes Junior, entre as mellores canteiras"o orixinalHemeroteca El Mundo Deportivo, 16 setembro de 1970, páxina 12Historia do BreogánAlfredo Pérez, o último canoneiroHistoria C.B. BreogánHemeroteca de El Mundo DeportivoJimmy Wright, norteamericano do Breogán deixará Lugo por ameazas de morteResultados de Breogán en 1986-87Resultados de Breogán en 1990-91Ficha de Velimir Perasović en acb.comResultados de Breogán en 1994-95Breogán arrasa al Barça. "El Mundo Deportivo", 27 de setembro de 1999, páxina 58CB Breogán - FC BarcelonaA FEB invita a participar nunha nova Liga EuropeaCharlie Bell na prensa estatalMáximos anotadores 2005Tempada 2005-06 : Tódolos Xogadores da Xornada""Non quero pensar nunha man negra, mais pregúntome que está a pasar""o orixinalRaúl López, orgulloso dos xogadores, presume da boa saúde económica do BreogánJulio González confirma que cesa como presidente del BreogánHomenaxe a Lisardo GómezA tempada do rexurdimento celesteEntrevista a Lisardo GómezEl COB dinamita el Pazo para forzar el quinto (69-73)Cafés Candelas, patrocinador del CB Breogán"Suso Lázare, novo presidente do Breogán"o orixinalCafés Candelas Breogán firma el mayor triunfo de la historiaEl Breogán realizará 17 homenajes por su cincuenta aniversario"O Breogán honra ao seu fundador e primeiro presidente"o orixinalMiguel Giao recibiu a homenaxe do PazoHomenaxe aos primeiros gladiadores celestesO home que nos amosa como ver o Breo co corazónTita Franco será homenaxeada polos #50anosdeBreoJulio Vila recibirá unha homenaxe in memoriam polos #50anosdeBreo"O Breogán homenaxeará aos seus aboados máis veteráns"Pechada ovación a «Capi» Sanmartín e Ricardo «Corazón de González»Homenaxe por décadas de informaciónPaco García volve ao Pazo con motivo do 50 aniversario"Resultados y clasificaciones""O Cafés Candelas Breogán, campión da Copa Princesa""O Cafés Candelas Breogán, equipo ACB"C.B. Breogán"Proxecto social"o orixinal"Centros asociados"o orixinalFicha en imdb.comMario Camus trata la recuperación del amor en 'La vieja música', su última película"Páxina web oficial""Club Baloncesto Breogán""C. B. Breogán S.A.D."eehttp://www.fegaba.com

                                          Vilaño, A Laracha Índice Patrimonio | Lugares e parroquias | Véxase tamén | Menú de navegación43°14′52″N 8°36′03″O / 43.24775, -8.60070

                                          Cegueira Índice Epidemioloxía | Deficiencia visual | Tipos de cegueira | Principais causas de cegueira | Tratamento | Técnicas de adaptación e axudas | Vida dos cegos | Primeiros auxilios | Crenzas respecto das persoas cegas | Crenzas das persoas cegas | O neno deficiente visual | Aspectos psicolóxicos da cegueira | Notas | Véxase tamén | Menú de navegación54.054.154.436928256blindnessDicionario da Real Academia GalegaPortal das Palabras"International Standards: Visual Standards — Aspects and Ranges of Vision Loss with Emphasis on Population Surveys.""Visual impairment and blindness""Presentan un plan para previr a cegueira"o orixinalACCDV Associació Catalana de Cecs i Disminuïts Visuals - PMFTrachoma"Effect of gene therapy on visual function in Leber's congenital amaurosis"1844137110.1056/NEJMoa0802268Cans guía - os mellores amigos dos cegosArquivadoEscola de cans guía para cegos en Mortágua, PortugalArquivado"Tecnología para ciegos y deficientes visuales. Recopilación de recursos gratuitos en la Red""Colorino""‘COL.diesis’, escuchar los sonidos del color""COL.diesis: Transforming Colour into Melody and Implementing the Result in a Colour Sensor Device"o orixinal"Sistema de desarrollo de sinestesia color-sonido para invidentes utilizando un protocolo de audio""Enseñanza táctil - geometría y color. Juegos didácticos para niños ciegos y videntes""Sistema Constanz"L'ocupació laboral dels cecs a l'Estat espanyol està pràcticament equiparada a la de les persones amb visió, entrevista amb Pedro ZuritaONCE (Organización Nacional de Cegos de España)Prevención da cegueiraDescrición de deficiencias visuais (Disc@pnet)Braillín, un boneco atractivo para calquera neno, con ou sen discapacidade, que permite familiarizarse co sistema de escritura e lectura brailleAxudas Técnicas36838ID00897494007150-90057129528256DOID:1432HP:0000618D001766C10.597.751.941.162C97109C0155020