Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8608603
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T03:39:18+00:00 2026-06-12T03:39:18+00:00

I am creating lists that display in columns of three, every <li> has a

  • 0

I am creating lists that display in columns of three, every <li> has a border-bottom like so:

x | x | x
---------    
x | x | x
---------      
z | z | z
---------  

<ul>
    <li>x</li><li>x</li><li>x</li>
    <li>x</li><li>x</li><li>x</li>
    <li>z</li><li>z</li><li>z</li>
</ul>

What I wish to do is create an nth-child expression to remove the border-bottom on the last line of three, so for the above example that would be:

ul li:nth-child(-n+6) {
    border-bottom:0;
}

The Problem

However where it get’s slightly more complicated is that the amount of items in the list varies so any of the following scenarios could come about:

Scenario 1

x | x | x
---------   
x | x | x
---------   
z |
---  

<ul>
    <li>x</li><li>x</li><li>x</li>
    <li>x</li><li>x</li><li>x</li>
    <li>z</li>
</ul>

Scenario 2

x | x | x
---------   
x | x | x
---------   
z | z |
-------

<ul>
    <li>x</li><li>x</li><li>x</li>
    <li>x</li><li>x</li><li>x</li>
    <li>z</li><li>z</li>
</ul>

Scenario 3

x | x | x
---------   
z | z |
-------

<ul>
    <li>x</li><li>x</li><li>x</li>
    <li>z</li><li>z</li>
</ul>

Conclusion

My aim is to always remove the border-bottom on the last row (or in this example the character z) so that it does not have the style applied to it.

An ideal soloution would be:

ul {
    padding-bottom:-20px;
}

But padding-bottom:-#px; is not supported in CSS.

The only other way I can think of to do this is to create an nth-child expression to capture only rows that include 3, that aren’t the last line?

I guess it may need some sort of division by 3 to look for the amount to apply it too?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T03:39:19+00:00Added an answer on June 12, 2026 at 3:39 am

    So far, I’ve created a selector that applies a style to the last row

    /* all the cells */
    li {
       background: #ccc;
    }
    
    /* last row, doesn't matter how many cells */
    li:nth-last-child(-n + 3):nth-child(3n + 1), /* first element of the last row */
    li:nth-last-child(-n + 3):nth-child(3n + 1) ~ li /* all its following elements */
    {
       /* reset the style, eg: */
       background: transparent;
    }
    

    You can see a live example here http://jsbin.com/ufosox/1/edit

    Of course this doesn’t support IE8 and less.

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

Sidebar

Related Questions

I'm creating an XPages application that will display a view that lists all the
I'm creating a report that lists patient deaths by date and by doctor. There
I'm creating a javascript method that populates lists depending on a radio button selected
I am creating a calendar list system, that has tabbed dates on top, with
I am creating a web application that will display the dates of various events
I am creating a page that lists celebrities on Twitter. The page displays 10
How can I create a dynamic url to display an image? I am creating
I have an ARM project that I'm building with make. I'm creating the list
I'm creating an app that should list the date and time when a button
I am creating an application that will have a list of items that can

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.